summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-09-12 21:13:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-09-12 21:13:01 (GMT)
commit6bc9ff75b3971cc8d1c610bc348279be89c95d9d (patch)
treecea1010530fb6c0fbc4235f926d5effc8235f023 /Swift/Controllers/ProfileSettingsProvider.h
parent7dafb815ca404f1e15c9cdf6b26817c941dae4ec (diff)
downloadswift-6bc9ff75b3971cc8d1c610bc348279be89c95d9d.zip
swift-6bc9ff75b3971cc8d1c610bc348279be89c95d9d.tar.bz2
Allow storing of settings for multiple profiles.
Diffstat (limited to 'Swift/Controllers/ProfileSettingsProvider.h')
-rw-r--r--Swift/Controllers/ProfileSettingsProvider.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Swift/Controllers/ProfileSettingsProvider.h b/Swift/Controllers/ProfileSettingsProvider.h
new file mode 100644
index 0000000..c485418
--- /dev/null
+++ b/Swift/Controllers/ProfileSettingsProvider.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "Swiften/Settings/SettingsProvider.h"
+
+namespace Swift {
+
+class ProfileSettingsProvider {
+ public:
+ ProfileSettingsProvider(const String& profile, SettingsProvider* provider) : profile_(profile) {
+ provider_ = provider;
+ bool found = false;
+ foreach (String existingProfile, provider->getAvailableProfiles()) {
+ if (existingProfile == profile) {
+ found = true;
+ }
+ }
+ if (!found) {
+ provider_->createProfile(profile);
+ }
+ };
+ virtual ~ProfileSettingsProvider() {};
+ virtual String getStringSetting(const String &settingPath) {return provider_->getStringSetting(profileSettingPath(settingPath));};
+ virtual void storeString(const String &settingPath, const String &settingValue) {provider_->storeString(profileSettingPath(settingPath), settingValue);};
+
+ private:
+ String profileSettingPath(const String &settingPath) {return profile_ + ":" + settingPath;};
+ SettingsProvider* provider_;
+ String profile_;
+};
+
+}
+
+