[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3385: When the user clicks the "Check Now" button in the General s (vidalia/branches/auto-updates/src/vidalia/config)



Author: edmanm
Date: 2008-12-12 21:55:11 -0500 (Fri, 12 Dec 2008)
New Revision: 3385

Modified:
   vidalia/branches/auto-updates/src/vidalia/config/configdialog.cpp
   vidalia/branches/auto-updates/src/vidalia/config/configdialog.h
   vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp
   vidalia/branches/auto-updates/src/vidalia/config/generalpage.h
Log:
When the user clicks the "Check Now" button in the General settings page,
relay the signal out through ConfigDialog so we can catch it in the 
main window.


Modified: vidalia/branches/auto-updates/src/vidalia/config/configdialog.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/configdialog.cpp	2008-12-12 22:33:30 UTC (rev 3384)
+++ vidalia/branches/auto-updates/src/vidalia/config/configdialog.cpp	2008-12-13 02:55:11 UTC (rev 3385)
@@ -72,9 +72,12 @@
 
   /* Create the config pages and actions */
   QActionGroup *grp = new QActionGroup(this);
-  ui.stackPages->add(new GeneralPage(ui.stackPages),
+  GeneralPage *generalPage = new GeneralPage(ui.stackPages);
+  ui.stackPages->add(generalPage,
                      createPageAction(QIcon(IMAGE_GENERAL),
                                       tr("General"), "General", grp));
+  connect(generalPage, SIGNAL(checkForUpdates()),
+          this, SLOT(onCheckForUpdates()));
 
   ui.stackPages->add(new NetworkPage(ui.stackPages),
                      createPageAction(QIcon(IMAGE_NETWORK),
@@ -282,6 +285,15 @@
   }
 }
 
+/** Stub method that relays the checkForUpdates() signal from the General
+ * settings page to the owner of the config dialog (MainWindow). */
+void
+ConfigDialog::onCheckForUpdates()
+{
+  emit checkForUpdates();
+}
+
+
 /** Called when a ConfigPage in the dialog requests help on a specific
  * <b>topic</b>. */
 void

Modified: vidalia/branches/auto-updates/src/vidalia/config/configdialog.h
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/configdialog.h	2008-12-12 22:33:30 UTC (rev 3384)
+++ vidalia/branches/auto-updates/src/vidalia/config/configdialog.h	2008-12-13 02:55:11 UTC (rev 3385)
@@ -53,6 +53,11 @@
   /** Shows the config dialog with focus set to the given page. */
   void showWindow(Page page = General);
 
+signals:
+  /** Emitted when the user clicks "Check Now" to initiate a check
+   * for software updates. */
+  void checkForUpdates();
+
 protected:
   /** Called when the user changes the UI translation. */
   virtual void retranslateUi();
@@ -74,6 +79,9 @@
   /** Shows general help information for whichever settings page the user is
    * currently viewing. */
   void help();
+  /** Stub method that relays the checkForUpdates() signal from the General
+   * settings page to the owner of the config dialog (MainWindow). */
+  void onCheckForUpdates();
 
 private:
   /** Loads the current configuration settings */

Modified: vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp	2008-12-12 22:33:30 UTC (rev 3384)
+++ vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp	2008-12-13 02:55:11 UTC (rev 3385)
@@ -36,8 +36,7 @@
           this, SLOT(browseTorExecutable()));
   connect(ui.btnBrowseProxyExecutable, SIGNAL(clicked()), 
           this, SLOT(browseProxyExecutable()));
-  connect(ui.btnUpdateNow, SIGNAL(clicked()),
-          this, SLOT(checkForUpdates()));
+  connect(ui.btnUpdateNow, SIGNAL(clicked()), this, SLOT(updateNow()));
 
   /* Hide platform specific features */
 #ifndef Q_WS_WIN
@@ -151,15 +150,9 @@
 }
 
 void
-GeneralPage::checkForUpdates()
+GeneralPage::updateNow()
 {
-  /* TODO: Check for software updates. Ideally this will have a foreground
-   *       window that tells the user "Hey, your stuff is current!" or not.
-   */
-
-  /* Remember the last time we checked for updates */
-  QDateTime lastCheckedAt = QDateTime::currentDateTime().toUTC();
-  _vidaliaSettings->setLastCheckedForUpdates(lastCheckedAt);
+  emit checkForUpdates();
 }
 
 

Modified: vidalia/branches/auto-updates/src/vidalia/config/generalpage.h
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/generalpage.h	2008-12-12 22:33:30 UTC (rev 3384)
+++ vidalia/branches/auto-updates/src/vidalia/config/generalpage.h	2008-12-13 02:55:11 UTC (rev 3385)
@@ -40,13 +40,17 @@
   /** Called when the user changes the UI translation. */
   virtual void retranslateUi();
 
+signals:
+  /** Emitted when the user clicks the "Check Now" button. */
+  void checkForUpdates();
+
 private slots:
   /** Open a QFileDialog to browse for a Tor executable file. */
   void browseTorExecutable();
   /** Open a QFileDialog to browse for a proxy executable file. */
   void browseProxyExecutable();
   /** Initiate an immediate check for software updates. */
-  void checkForUpdates();
+  void updateNow();
 
 private:
   /** Displays a file dialog allowing the user to browse for an executable