mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-28 08:49:42 -05:00
Check for updates every 7 days while running
* Check every hour to see if another update check should be performed. Nothing actually happens unless 7 days has elapsed since the last update check. * Fixes #3706
This commit is contained in:
parent
f129768f07
commit
e039006667
@ -489,7 +489,11 @@ MainWindow::MainWindow()
|
||||
connect(UpdateChecker::instance(),
|
||||
SIGNAL(updateCheckFinished(bool, QString, bool)),
|
||||
SLOT(hasUpdateAvailable(bool, QString, bool)));
|
||||
QTimer::singleShot(500, this, SLOT(showUpdateCheckStartup()));
|
||||
// Setup an update check every hour (checked only occur every 7 days)
|
||||
connect(&m_updateCheckTimer, &QTimer::timeout, this, &MainWindow::performUpdateCheck);
|
||||
m_updateCheckTimer.start(3.6e6);
|
||||
// Perform the startup update check after 500 ms
|
||||
QTimer::singleShot(500, this, SLOT(performUpdateCheck()));
|
||||
#else
|
||||
m_ui->actionCheckForUpdates->setVisible(false);
|
||||
#endif
|
||||
@ -892,7 +896,7 @@ void MainWindow::showAboutDialog()
|
||||
aboutDialog->open();
|
||||
}
|
||||
|
||||
void MainWindow::showUpdateCheckStartup()
|
||||
void MainWindow::performUpdateCheck()
|
||||
{
|
||||
#ifdef WITH_XC_UPDATECHECK
|
||||
if (!config()->get(Config::UpdateCheckMessageShown).toBool()) {
|
||||
|
@ -92,7 +92,7 @@ private slots:
|
||||
void updateToolbarSeparatorVisibility();
|
||||
void updateWindowTitle();
|
||||
void showAboutDialog();
|
||||
void showUpdateCheckStartup();
|
||||
void performUpdateCheck();
|
||||
void showUpdateCheckDialog();
|
||||
void focusWindowChanged(QWindow* focusWindow);
|
||||
void hasUpdateAvailable(bool hasUpdate, const QString& version, bool isManuallyRequested);
|
||||
@ -175,6 +175,7 @@ private:
|
||||
bool m_showToolbarSeparator = false;
|
||||
qint64 m_lastFocusOutTime = 0;
|
||||
qint64 m_lastShowTime = 0;
|
||||
QTimer m_updateCheckTimer;
|
||||
QTimer m_trayIconTriggerTimer;
|
||||
QSystemTrayIcon::ActivationReason m_trayIconTriggerReason;
|
||||
};
|
||||
|
@ -42,6 +42,11 @@ UpdateChecker::~UpdateChecker()
|
||||
|
||||
void UpdateChecker::checkForUpdates(bool manuallyRequested)
|
||||
{
|
||||
// Skip update if we are already performing one
|
||||
if (m_reply) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto nextCheck = config()->get(Config::GUI_CheckForUpdatesNextCheck).toULongLong();
|
||||
m_isManuallyRequested = manuallyRequested;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user