AppSettings returns the proxy type as QNetworkProxy instead of int now.
[debian/confclerk.git] / src / app / appsettings.cpp
index 477c1b0e40317ab686832cabcac09c7d07e2600d..f220969b04de2d21dcdda4aa0fd0161b5e9cc1c7 100644 (file)
@@ -36,10 +36,12 @@ quint16 AppSettings::proxyPort()
     return mSettings.value(PROXY_PORT_SETTING).toUInt();
 }
 
-//QNetworkProxy::ProxyType
-int AppSettings::proxyType()
+QNetworkProxy::ProxyType AppSettings::proxyType()
 {
-    return mSettings.value(PROXY_TYPE_SETTING).toInt();
+    bool ok;
+    int proxyType = mSettings.value(PROXY_TYPE_SETTING).toInt(&ok);
+    if (!ok || proxyType < 0 || proxyType > 5) return QNetworkProxy::DefaultProxy;
+    return QNetworkProxy::ProxyType(proxyType);
 }
 
 bool AppSettings::isDirectConnection()
@@ -57,10 +59,9 @@ void AppSettings::setProxyPort(const quint16 aPort)
     mSettings.setValue(PROXY_PORT_SETTING, aPort);
 }
 
-// QNetworkProxy::ProxyType
-void AppSettings::setProxyType(const int aType)
+void AppSettings::setProxyType(QNetworkProxy::ProxyType aProxyType)
 {
-    mSettings.setValue(PROXY_TYPE_SETTING, aType);
+    mSettings.setValue(PROXY_TYPE_SETTING, aProxyType);
 }
 
 void AppSettings::setDirectConnection(bool aDirectConnection)