if the application is run for first time, network connection is set to Direct connection
authorpavelpa <pavelpa@localhost>
Fri, 29 Jan 2010 14:37:22 +0000 (14:37 +0000)
committerpavelpa <pavelpa@localhost>
Fri, 29 Jan 2010 14:37:22 +0000 (14:37 +0000)
src/app/appsettings.cpp
src/app/appsettings.h
src/gui/mainwindow.cpp

index 2d48066..61c526f 100644 (file)
@@ -6,8 +6,6 @@ const QString PROXY_ISDIRECT_SETTING ("proxyIsDirectConnection");
 
 QSettings AppSettings::mSettings("Ixonos", "FOSDEM");
 
-
-
 QString AppSettings::proxyAddress()
 {
     return mSettings.value(PROXY_ADDRESS_SETTING).toString();
@@ -38,3 +36,8 @@ void AppSettings::setDirectConnection(bool aDirectConnection)
     mSettings.setValue(PROXY_ISDIRECT_SETTING, aDirectConnection);
 }
 
+bool AppSettings::contains(const QString &aKey)
+{
+    return mSettings.contains(aKey);
+}
+
index efae165..a20af3c 100644 (file)
@@ -12,6 +12,8 @@ class AppSettings
         static QSettings mSettings;
 
     public:
+        static bool contains(const QString &aKey);
+
         static QString proxyAddress();
         static quint16 proxyPort();
         static bool isDirectConnection();
index 15f5071..cd60429 100644 (file)
@@ -31,7 +31,14 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
 {
     setupUi(this);
 
-    qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
+    // first time run aplication: -> let's have it direct connection in this case
+    if(!AppSettings::contains("proxyIsDirectConnection"))
+        AppSettings::setDirectConnection(true);
+
+    if(AppSettings::isDirectConnection())
+    {
+        qDebug() << "Setting-up proxy: " << AppSettings::proxyAddress() << ":" << AppSettings::proxyPort();
+    }
     QNetworkProxy proxy(
             AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
             AppSettings::proxyAddress(),