Re: [linux-minidisc] qhimdtransfer windows autoupdate feature


Hi,
WinSparkle asks the user for update checks at application start, but it doesn't perform these checks.
It just saves the users answer in a registry entry.
We need to read this entry and then perform the check if choosen by the user.

Thomas
>From 684198b1480eb8cd0b18b0a462309ab2678e9d85 Mon Sep 17 00:00:00 2001
From: Thomas Arp <manner.moe@gmx.de>
Date: Sun, 27 Jan 2013 16:30:43 +0100
Subject: [PATCH 4/4] check for updates at application start if the user
 applied to this winsparkle option

---
 qhimdtransfer/qhimdmainwindow.cpp | 2 --
 qhimdtransfer/qhimdwinupdate.cpp  | 9 +++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp
index 70494ab..ed64bb2 100644
--- a/qhimdtransfer/qhimdmainwindow.cpp
+++ b/qhimdtransfer/qhimdmainwindow.cpp
@@ -400,8 +400,6 @@ QHiMDMainWindow::QHiMDMainWindow(QWidget *parent)
         ui->statusBar->showMessage(" autodetection disabled", 10000);
     update = createUpdate();
     ui->action_Update->setEnabled(update->is_active());
-    if(update->is_active())
-        update->check_for_updates();
 }
 
 QHiMDMainWindow::~QHiMDMainWindow()
diff --git a/qhimdtransfer/qhimdwinupdate.cpp b/qhimdtransfer/qhimdwinupdate.cpp
index cae25dd..bbce050 100644
--- a/qhimdtransfer/qhimdwinupdate.cpp
+++ b/qhimdtransfer/qhimdwinupdate.cpp
@@ -1,4 +1,5 @@
 #include "qhimdupdate.h"
+#include <QSettings>
 
 /* a sample appcast rss feed for qhimdtransfer can be found on my web server for testing
  * TODO: create release notes html site, so winsparkle can display it if an update is available
@@ -24,6 +25,7 @@ QHiMDUpdate * createUpdate()
 
 QHiMDWinUpdate::QHiMDWinUpdate()
 {
+    QSettings s;
     wchar_t org[strlen(ORG_NAME)+1], app[strlen(APP_NAME)+1], vers[strlen(VER)+1];
     size_t t;
 
@@ -36,6 +38,13 @@ QHiMDWinUpdate::QHiMDWinUpdate()
     win_sparkle_set_appcast_url(WIN_APPCAST_URL);
     win_sparkle_set_app_details(org, app, vers);
     win_sparkle_init();
+
+    /* winsparkle asks the user for automatical update checks at first start, but it does not
+     * perform the check. It just saves the users answer in a regirtry entry.
+     * Read this entry first and check for updates if choosen
+     */
+    if(s.value("WinSparkle/CheckForUpdates", false).toBool())
+        win_sparkle_check_update_with_ui();
     active = true;
 }
 
-- 
1.8.0.msysgit.0