Add support for adding a space when tab-completing mid-sentence
[quassel.git] / src / client / clientsettings.cpp
index 0af9c6e..dfed519 100644 (file)
@@ -125,6 +125,7 @@ QVariantMap CoreAccountSettings::retrieveAccountData(AccountId id) {
     map["ProxyUser"] = oldmap.value("proxyUser");
     map["ProxyPassword"] = oldmap.value("proxyPassword");
     map["ProxyType"] = oldmap.value("proxyType");
+    map["Internal"] = oldmap.value("InternalAccount");
 
     map["AccountId"] = id.toInt();
     map["Uuid"] = QUuid::createUuid().toString();
@@ -166,6 +167,24 @@ QHash<int, BufferId> CoreAccountSettings::jumpKeyMap() {
   return keyMap;
 }
 
+void CoreAccountSettings::setBufferViewOverlay(const QSet<int> &viewIds) {
+  QVariantList variants;
+  foreach(int viewId, viewIds) {
+    variants << qVariantFromValue(viewId);
+  }
+  setAccountValue("BufferViewOverlay", variants);
+}
+
+QSet<int> CoreAccountSettings::bufferViewOverlay() {
+  QSet<int> viewIds;
+  QVariantList variants = accountValue("BufferViewOverlay").toList();
+  QVariantList::const_iterator iter = variants.constBegin();
+  for(QVariantList::const_iterator iter = variants.constBegin(); iter != variants.constEnd(); iter++) {
+    viewIds << iter->toInt();
+  }
+  return viewIds;
+}
+
 void CoreAccountSettings::removeAccount(AccountId id) {
   removeLocalKey(QString("%1").arg(id.toInt()));
 }
@@ -175,6 +194,48 @@ void CoreAccountSettings::clearAccounts() {
     removeLocalKey(key);
 }
 
+/***********************************************************************************************/
+// CoreConnectionSettings:
+
+CoreConnectionSettings::CoreConnectionSettings() : ClientSettings("CoreConnection") {}
+
+void CoreConnectionSettings::setNetworkDetectionMode(NetworkDetectionMode mode) {
+  setLocalValue("NetworkDetectionMode", mode);
+}
+
+CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettings::networkDetectionMode() {
+#ifdef HAVE_KDE
+  NetworkDetectionMode def = UseSolid;
+#else
+  NetworkDetectionMode def = UsePingTimeout;
+#endif
+  return (NetworkDetectionMode)localValue("NetworkDetectionMode", def).toInt();
+}
+
+void CoreConnectionSettings::setAutoReconnect(bool autoReconnect) {
+  setLocalValue("AutoReconnect", autoReconnect);
+}
+
+bool CoreConnectionSettings::autoReconnect() {
+  return localValue("AutoReconnect", true).toBool();
+}
+
+void CoreConnectionSettings::setPingTimeoutInterval(int interval) {
+  setLocalValue("PingTimeoutInterval", interval);
+}
+
+int CoreConnectionSettings::pingTimeoutInterval() {
+  return localValue("PingTimeoutInterval", 60).toInt();
+}
+
+void CoreConnectionSettings::setReconnectInterval(int interval) {
+  setLocalValue("ReconnectInterval", interval);
+}
+
+int CoreConnectionSettings::reconnectInterval() {
+  return localValue("ReconnectInterval", 60).toInt();
+}
+
 /***********************************************************************************************/
 // NotificationSettings:
 
@@ -220,6 +281,14 @@ QString TabCompletionSettings::completionSuffix() {
   return localValue("CompletionSuffix", ": ").toString();
 }
 
+void TabCompletionSettings::setAddSpaceMidSentence(const bool &space) {
+  setLocalValue("AddSpaceMidSentence", space);
+}
+
+bool TabCompletionSettings::addSpaceMidSentence() {
+  return localValue("AddSpaceMidSentence", false).toBool();
+}
+
 void TabCompletionSettings::setSortMode(SortMode mode) {
   setLocalValue("SortMode", mode);
 }