summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2014-10-03 10:20:07 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2014-10-03 10:20:07 (GMT)
commit71d27eaa017f02d527479475205c3772b892ce46 (patch)
tree696d337d65890808b9380873bd8173ffdffbb35d
parent9f907d2e9a747c7b1deaddbcb488a1a152458aa4 (diff)
downloadlibkolabxml-71d27eaa017f02d527479475205c3772b892ce46.tar.gz
Implemented host, port, username, password filedriver settings.
-rw-r--r--schemas/kolabformat.xsd13
-rw-r--r--src/containers/kolabconfiguration.h23
-rw-r--r--src/kolabconversions.h17
-rw-r--r--tests/bindingstest.cpp5
4 files changed, 50 insertions, 8 deletions
diff --git a/schemas/kolabformat.xsd b/schemas/kolabformat.xsd
index 46697f6..adbe422 100644
--- a/schemas/kolabformat.xsd
+++ b/schemas/kolabformat.xsd
@@ -140,6 +140,17 @@
</xs:complexType>
<xs:element name="snippet" type="Snippet"/>
+
+ <xs:complexType name="FileDriverSettings" mixed="true" >
+ <xs:sequence>
+ <xs:element name="host" type="xs:string" minOccurs="0"/>
+ <xs:element name="port" type="xs:integer" minOccurs="0"/>
+ <xs:element name="username" type="xs:string" minOccurs="0"/>
+ <xs:element name="password" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="settings" type="FileDriverSettings"/>
<xs:complexType name="Configuration">
<xs:complexContent mixed="false">
@@ -170,7 +181,7 @@
<xs:element name="driver" type="xs:string" minOccurs="0"/>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="enabled" type="xs:boolean" minOccurs="0"/>
- <xs:element name="settings" type="xs:string" minOccurs="0"/>
+ <xs:element name="settings" type="FileDriverSettings" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
diff --git a/src/containers/kolabconfiguration.h b/src/containers/kolabconfiguration.h
index 7b5c106..c011131 100644
--- a/src/containers/kolabconfiguration.h
+++ b/src/containers/kolabconfiguration.h
@@ -158,7 +158,10 @@ struct FileDriver {
return mDriver == other.mDriver
&& mTitle == other.mTitle
&& mEnabled == other.mEnabled
- && mSettings == other.mSettings;
+ && mHost == other.mHost
+ && mPort == other.mPort
+ && mUsername == other.mUsername
+ && mPassword == other.mPassword;
}
void setDriver(const std::string &driver) { mDriver = driver; }
@@ -170,14 +173,26 @@ struct FileDriver {
void setEnabled(bool enabled) { mEnabled = enabled; }
bool enabled() const { return mEnabled; }
- void setSettings(const std::string &settings) { mSettings = settings; }
- std::string settings() const { return mSettings; }
+ void setHost(const std::string &host) { mHost = host; }
+ std::string host() const { return mHost; }
+
+ void setPort(int port) { mPort = port; }
+ int port() const { return mPort; }
+
+ void setUsername(const std::string &username) { mUsername = username; }
+ std::string username() const { return mUsername; }
+
+ void setPassword(const std::string &password) { mPassword = password; }
+ std::string password() const { return mPassword; }
private:
std::string mDriver;
std::string mTitle;
bool mEnabled;
- std::string mSettings;
+ std::string mHost;
+ int mPort;
+ std::string mUsername;
+ std::string mPassword;
};
class Configuration {
diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 05e3064..daa9164 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -228,7 +228,13 @@ std::string serializeObject <Kolab::Configuration> (const Kolab::Configuration &
n.driver(fileDriver.driver());
n.title(fileDriver.title());
n.enabled(fileDriver.enabled());
- n.settings(fileDriver.settings());
+
+ KolabXSD::FileDriverSettings settings;
+ settings.host(fileDriver.host());
+ settings.port(fileDriver.port());
+ settings.username(fileDriver.username());
+ settings.password(fileDriver.password());
+ n.settings(settings);
}
break;
default:
@@ -593,7 +599,14 @@ boost::shared_ptr<Kolab::Configuration> deserializeObject <Kolab::Configuration>
}
Kolab::FileDriver fileDriver(driver, title);
fileDriver.setEnabled(*configuration->enabled());
- fileDriver.setSettings(*configuration->settings());
+ if (configuration->settings()) {
+ fileDriver.setHost(*configuration->settings()->host());
+ fileDriver.setPort(convertToInt(*configuration->settings()->port()));
+ fileDriver.setUsername(*configuration->settings()->username());
+ fileDriver.setPassword(*configuration->settings()->password());
+ } else {
+ CRITICAL("Settings are missing");
+ }
n = boost::shared_ptr<Kolab::Configuration>(new Kolab::Configuration(fileDriver));
} else {
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 5b5718e..7f54b38 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -138,7 +138,10 @@ void BindingsTest::fileDriverConfigurationCompletness()
{
Kolab::FileDriver fileDriver("driver", "title");
fileDriver.setEnabled(false);
- fileDriver.setSettings("settings");
+ fileDriver.setHost("host");
+ fileDriver.setPort(9);
+ fileDriver.setUsername("username");
+ fileDriver.setPassword("password");
Kolab::Configuration configuration(fileDriver);
configuration.setUid("uid");