[Pkg-owncloud-commits] [owncloud-client] 486/498: Updater: update Linux updater code to work with changes in master

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:21 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 ecf545a0b910d5163f29bf6baa82c79904bf1dee
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Thu Aug 6 19:34:23 2015 +0200

    Updater: update Linux updater code to work with changes in master
    
    master moved much of the responsibility of the updating process
    to the updater class.
    
    This also fixes a build failure
---
 src/gui/application.cpp       | 18 ++----------------
 src/gui/application.h         |  1 -
 src/gui/updater/ocupdater.cpp | 18 ++++++++++++++++++
 src/gui/updater/ocupdater.h   |  4 ++++
 4 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 3a777fe..7810267 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -171,15 +171,11 @@ Application::Application(int &argc, char **argv) :
     UpdaterScheduler *updaterScheduler = new UpdaterScheduler(this);
     connect(updaterScheduler, SIGNAL(updaterAnnouncement(QString, QString)),
             _gui, SLOT(slotShowTrayMessage(QString, QString)));
+    connect(updaterScheduler, SIGNAL(requestRestart()),
+            _folderManager.data(), SLOT(slotScheduleAppRestart()));
 
     // Cleanup at Quit.
     connect (this, SIGNAL(aboutToQuit()), SLOT(slotCleanup()));
-
-    // remember the version of the currently running binary. On Linux it might happen that the
-    // package management updates the package while the app is running. This is detected in the
-    // updater slot: If the installed binary on the hd has a different version than the one
-    // running, the running app is restart. That happens in folderman.
-    _runningAppVersion = Utility::versionOfInstalledBinary();
 }
 
 Application::~Application()
@@ -217,16 +213,6 @@ void Application::slotCleanup()
     _gui->deleteLater();
 }
 
-
-    if( Utility::isLinux() ) {
-        // on linux, check if the installed binary is still the same version
-        // as the one that is running. If not, restart if possible.
-        const QByteArray fsVersion = Utility::versionOfInstalledBinary();
-
-        if( !(fsVersion.isEmpty() || _runningAppVersion.isEmpty()) && fsVersion != _runningAppVersion ) {
-            _folderManager->slotScheduleAppRestart();
-        }
-    }
 void Application::slotCheckConnection()
 {
     auto list = AccountManager::instance()->accounts();
diff --git a/src/gui/application.h b/src/gui/application.h
index b09895c..7a246e6 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -105,7 +105,6 @@ private:
     bool    _logFlush;
     bool    _userTriggeredConnect;
     bool    _debugMode;
-    QByteArray _runningAppVersion;
 
     ClientProxy _proxy;
 
diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp
index b62a40d..1313470 100644
--- a/src/gui/updater/ocupdater.cpp
+++ b/src/gui/updater/ocupdater.cpp
@@ -48,6 +48,7 @@ UpdaterScheduler::UpdaterScheduler(QObject *parent) :
     if (OCUpdater *updater = dynamic_cast<OCUpdater*>(Updater::instance())) {
         connect(updater,  SIGNAL(newUpdateAvailable(QString,QString)),
                 this,     SIGNAL(updaterAnnouncement(QString,QString)) );
+        connect(updater, SIGNAL(requestRestart()), SIGNAL(requestRestart()));
     }
 
     // at startup, do a check in any case.
@@ -421,7 +422,24 @@ void NSISUpdater::slotSetSeenVersion()
 PassiveUpdateNotifier::PassiveUpdateNotifier(const QUrl &url, QObject *parent)
     : OCUpdater(url, parent)
 {
+    // remember the version of the currently running binary. On Linux it might happen that the
+    // package management updates the package while the app is running. This is detected in the
+    // updater slot: If the installed binary on the hd has a different version than the one
+    // running, the running app is restart. That happens in folderman.
+    _runningAppVersion = Utility::versionOfInstalledBinary();
+}
 
+void PassiveUpdateNotifier::backgroundCheckForUpdate()
+{
+    if( Utility::isLinux() ) {
+        // on linux, check if the installed binary is still the same version
+        // as the one that is running. If not, restart if possible.
+        const QByteArray fsVersion = Utility::versionOfInstalledBinary();
+        qDebug() << Q_FUNC_INFO;
+        if( !(fsVersion.isEmpty() || _runningAppVersion.isEmpty()) && fsVersion != _runningAppVersion ) {
+            emit requestRestart();
+        }
+    }
 }
 
 void PassiveUpdateNotifier::versionInfoArrived(const UpdateInfo &info)
diff --git a/src/gui/updater/ocupdater.h b/src/gui/updater/ocupdater.h
index 08c1c5a..3983ac3 100644
--- a/src/gui/updater/ocupdater.h
+++ b/src/gui/updater/ocupdater.h
@@ -72,6 +72,7 @@ public:
 
 signals:
     void updaterAnnouncement(const QString& title, const QString& msg);
+    void requestRestart();
 
 private slots:
     void slotTimerFired();
@@ -106,6 +107,7 @@ public:
 signals:
     void downloadStateChanged();
     void newUpdateAvailable(const QString& header, const QString& message);
+    void requestRestart();
 
 public slots:
     void slotStartInstaller();
@@ -166,9 +168,11 @@ class PassiveUpdateNotifier : public OCUpdater {
 public:
     explicit PassiveUpdateNotifier(const QUrl &url, QObject *parent = 0);
     bool handleStartup() Q_DECL_OVERRIDE { return false; }
+    void backgroundCheckForUpdate() Q_DECL_OVERRIDE;
 
 private:
     void versionInfoArrived(const UpdateInfo &info) Q_DECL_OVERRIDE;
+     QByteArray _runningAppVersion;
 };
 
 

-- 
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