[Pkg-owncloud-commits] [owncloud-client] 151/498: Frequent update check: read check frequency from config file.

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit fa0faee8ba1cd39ea772e1b1fcd9818a731321b7
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon Jun 15 12:24:18 2015 +0200

    Frequent update check: read check frequency from config file.
---
 src/gui/application.cpp    |  3 ++-
 src/libsync/configfile.cpp | 19 +++++++++++++++++++
 src/libsync/configfile.h   |  4 +++-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 8bc0e05..0ffca98 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -178,7 +178,8 @@ Application::Application(int &argc, char **argv) :
     QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
 
     // Update checks
-    _updaterTimer.setInterval(1000*120*60); // check every two hours
+    _updaterTimer.setInterval(cfg.updateCheckInterval()); // check every two hours
+
     connect(&_updaterTimer, SIGNAL(timeout()), this, SLOT(slotStartUpdateDetector()));
     QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() ));
 
diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp
index 2b04b11..5cf4e05 100644
--- a/src/libsync/configfile.cpp
+++ b/src/libsync/configfile.cpp
@@ -47,6 +47,7 @@ static const char monoIconsC[] = "monoIcons";
 static const char crashReporterC[] = "crashReporter";
 static const char optionalDesktopNoficationsC[] = "optionalDesktopNotifications";
 static const char skipUpdateCheckC[] = "skipUpdateCheck";
+static const char updateCheckIntervalC[] = "updateCheckInterval";
 static const char geometryC[] = "geometry";
 static const char timeoutC[] = "timeout";
 static const char transmissionChecksumC[] = "transmissionChecksum";
@@ -381,6 +382,24 @@ quint64 ConfigFile::forceSyncInterval(const QString& connection) const
     return interval;
 }
 
+bool ConfigFile::updateCheckInterval( const QString& connection ) const
+{
+    QString con( connection );
+    if( connection.isEmpty() ) con = defaultConnection();
+    QSettings settings(configFile(), QSettings::IniFormat);
+    settings.beginGroup( con );
+
+    quint64 defaultInterval = 1000*120*60;
+    quint64 interval = settings.value( QLatin1String(updateCheckIntervalC), defaultInterval ).toULongLong();
+
+    quint64 minInterval = 1000*60*5;
+    if( interval < minInterval) {
+        qDebug() << "Update check interval less than fife minutes, setting " << minInterval;
+        interval = minInterval;
+    }
+    return interval;
+}
+
 bool ConfigFile::skipUpdateCheck( const QString& connection ) const
 {
     QString con( connection );
diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h
index d1af84c..d887e30 100644
--- a/src/libsync/configfile.h
+++ b/src/libsync/configfile.h
@@ -112,7 +112,9 @@ public:
     void saveGeometry(QWidget *w);
     void restoreGeometry(QWidget *w);
 
-    // installer
+    // how often the check about new versions runs, default two hours
+    bool updateCheckInterval( const QString& connection = QString() ) const;
+
     bool skipUpdateCheck( const QString& connection = QString() ) const;
     void setSkipUpdateCheck( bool, const QString& );
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list