mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
Updater: Do a tray notification if a new update is available.
This commit is contained in:
parent
5b65bbf8e5
commit
c8cb604c18
4 changed files with 23 additions and 5 deletions
|
@ -34,6 +34,8 @@
|
|||
#include "sharedialog.h"
|
||||
|
||||
#include "updater/updater.h"
|
||||
#include "updater/ocupdater.h"
|
||||
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
||||
#include "config.h"
|
||||
|
@ -253,8 +255,24 @@ void Application::slotStartUpdateDetector()
|
|||
if( cfg.skipUpdateCheck() ) {
|
||||
qDebug() << Q_FUNC_INFO << "Skipping update check because of config file";
|
||||
} else {
|
||||
Updater *updater = Updater::instance();
|
||||
updater->backgroundCheckForUpdate();
|
||||
if (OCUpdater *updater = dynamic_cast<OCUpdater*>(Updater::instance())) {
|
||||
connect(updater, SIGNAL(downloadStateChanged()), this,
|
||||
SLOT(slotNotifyAboutAvailableUpdate()), Qt::UniqueConnection);
|
||||
|
||||
updater->backgroundCheckForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::slotNotifyAboutAvailableUpdate()
|
||||
{
|
||||
if( _gui ) {
|
||||
if (OCUpdater *updater = dynamic_cast<OCUpdater*>(Updater::instance())) {
|
||||
// Show a tray message if an Update is ready...
|
||||
if( updater->downloadState() == OCUpdater::DownloadComplete ) {
|
||||
_gui->slotShowTrayMessage( tr("Update Check"), updater->statusString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ protected slots:
|
|||
void slotAccountStateRemoved(AccountState *accountState);
|
||||
void slotAccountStateChanged(int state);
|
||||
void slotCrash();
|
||||
void slotNotifyAboutAvailableUpdate();
|
||||
|
||||
private:
|
||||
void setHelp();
|
||||
|
|
|
@ -85,8 +85,7 @@ void GeneralSettings::loadMiscSettings()
|
|||
|
||||
void GeneralSettings::slotUpdateInfo()
|
||||
{
|
||||
if (OCUpdater *updater = dynamic_cast<OCUpdater*>(Updater::instance()))
|
||||
{
|
||||
if (OCUpdater *updater = dynamic_cast<OCUpdater*>(Updater::instance())) {
|
||||
connect(updater, SIGNAL(downloadStateChanged()), SLOT(slotUpdateInfo()), Qt::UniqueConnection);
|
||||
connect(_ui->restartButton, SIGNAL(clicked()), updater, SLOT(slotStartInstaller()), Qt::UniqueConnection);
|
||||
connect(_ui->restartButton, SIGNAL(clicked()), qApp, SLOT(quit()), Qt::UniqueConnection);
|
||||
|
|
|
@ -69,7 +69,7 @@ void OCUpdater::backgroundCheckForUpdate()
|
|||
|
||||
if( dlState == Unknown ||
|
||||
dlState == UpToDate ||
|
||||
dlState == DownloadComplete ||
|
||||
/* dlState == DownloadComplete || <- are we checking if a previous download was successful already? */
|
||||
dlState == DownloadFailed ||
|
||||
dlState == DownloadTimedOut ) {
|
||||
// how about UpdateOnlyAvailableThroughSystem?
|
||||
|
|
Loading…
Reference in a new issue