mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-28 07:54:49 +03:00
Frequent update check: read check frequency from config file.
This commit is contained in:
parent
c8cb604c18
commit
fa0faee8ba
3 changed files with 24 additions and 2 deletions
|
@ -178,7 +178,8 @@ Application::Application(int &argc, char **argv) :
|
||||||
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
|
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
|
||||||
|
|
||||||
// Update checks
|
// 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()));
|
connect(&_updaterTimer, SIGNAL(timeout()), this, SLOT(slotStartUpdateDetector()));
|
||||||
QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() ));
|
QTimer::singleShot( 3000, this, SLOT( slotStartUpdateDetector() ));
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ static const char monoIconsC[] = "monoIcons";
|
||||||
static const char crashReporterC[] = "crashReporter";
|
static const char crashReporterC[] = "crashReporter";
|
||||||
static const char optionalDesktopNoficationsC[] = "optionalDesktopNotifications";
|
static const char optionalDesktopNoficationsC[] = "optionalDesktopNotifications";
|
||||||
static const char skipUpdateCheckC[] = "skipUpdateCheck";
|
static const char skipUpdateCheckC[] = "skipUpdateCheck";
|
||||||
|
static const char updateCheckIntervalC[] = "updateCheckInterval";
|
||||||
static const char geometryC[] = "geometry";
|
static const char geometryC[] = "geometry";
|
||||||
static const char timeoutC[] = "timeout";
|
static const char timeoutC[] = "timeout";
|
||||||
static const char transmissionChecksumC[] = "transmissionChecksum";
|
static const char transmissionChecksumC[] = "transmissionChecksum";
|
||||||
|
@ -381,6 +382,24 @@ quint64 ConfigFile::forceSyncInterval(const QString& connection) const
|
||||||
return interval;
|
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
|
bool ConfigFile::skipUpdateCheck( const QString& connection ) const
|
||||||
{
|
{
|
||||||
QString con( connection );
|
QString con( connection );
|
||||||
|
|
|
@ -112,7 +112,9 @@ public:
|
||||||
void saveGeometry(QWidget *w);
|
void saveGeometry(QWidget *w);
|
||||||
void restoreGeometry(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;
|
bool skipUpdateCheck( const QString& connection = QString() ) const;
|
||||||
void setSkipUpdateCheck( bool, const QString& );
|
void setSkipUpdateCheck( bool, const QString& );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue