schemas/kolabformat.xsd src/containers src/kolabconversions.h tests/bindingstest.cpp
Christian Mollekopf
mollekopf at kolabsys.com
Fri Oct 3 12:20:13 CEST 2014
schemas/kolabformat.xsd | 13 ++++++++++++-
src/containers/kolabconfiguration.h | 23 +++++++++++++++++++----
src/kolabconversions.h | 17 +++++++++++++++--
tests/bindingstest.cpp | 5 ++++-
4 files changed, 50 insertions(+), 8 deletions(-)
New commits:
commit 71d27eaa017f02d527479475205c3772b892ce46
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Fri Oct 3 12:20:07 2014 +0200
Implemented host, port, username, password filedriver settings.
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");
More information about the commits
mailing list