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

[vidalia-svn] r3244: Save and load the "how often do you want to check for update (vidalia/branches/auto-updates/src/vidalia/config)



Author: edmanm
Date: 2008-10-19 14:19:22 -0400 (Sun, 19 Oct 2008)
New Revision: 3244

Modified:
   vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp
   vidalia/branches/auto-updates/src/vidalia/config/generalpage.ui
   vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.cpp
   vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.h
Log:
Save and load the "how often do you want to check for updates" setting using
the combo box added in r3239.


Modified: vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp	2008-10-19 17:07:41 UTC (rev 3243)
+++ vidalia/branches/auto-updates/src/vidalia/config/generalpage.cpp	2008-10-19 18:19:22 UTC (rev 3244)
@@ -43,11 +43,11 @@
   ui.chkRunVidaliaAtSystemStartup->setVisible(false);
   ui.lineHorizontalSeparator->setVisible(false);
   ui.grpSoftwareUpdates->setVisible(false);
-  ui.cmbUpdateFrequency->setVisible(false);
+  ui.cmbUpdateInterval->setVisible(false);
 #else
-  ui.cmbUpdateFrequency->addItem(tr("Daily"), "daily");
-  ui.cmbUpdateFrequency->addItem(tr("Weekly"), "weekly");
-  ui.cmbUpdateFrequency->addItem(tr("Monthly"), "monthly");
+  ui.cmbUpdateInterval->addItem(tr("Daily"), "daily");
+  ui.cmbUpdateInterval->addItem(tr("Weekly"), "weekly");
+  ui.cmbUpdateInterval->addItem(tr("Monthly"), "monthly");
 #endif
 }
 
@@ -130,8 +130,15 @@
     ui.chkRunVidaliaAtSystemStartup->isChecked());
   _vidaliaSettings->setRunProxyAtStart(
     ui.chkRunProxyAtTorStartup->isChecked());
+
+#if defined(Q_OS_WIN32)
   _vidaliaSettings->setAutoUpdateEnabled(
     ui.chkAutoUpdates->isChecked());
+
+  int idx = ui.cmbUpdateInterval->currentIndex();
+  QString interval = ui.cmbUpdateInterval->itemData(idx).toString();
+  _vidaliaSettings->setCheckForUpdatesInterval(interval);
+#endif
   return true;
 }
 
@@ -149,7 +156,16 @@
   ui.lineProxyExecutableArguments->setText(
     string_format_arguments(_vidaliaSettings->getProxyExecutableArguments()));
   ui.chkRunProxyAtTorStartup->setChecked(_vidaliaSettings->runProxyAtStart());
+
+#if defined(Q_OS_WIN32)
   ui.chkAutoUpdates->setChecked(_vidaliaSettings->isAutoUpdateEnabled());
+
+  QString interval = _vidaliaSettings->checkForUpdatesInterval();
+  int idx = ui.cmbUpdateInterval->findData(interval);
+  if (idx < 0)
+    idx = 1;
+  ui.cmbUpdateInterval->setCurrentIndex(idx);
+#endif
 }
 
 void

Modified: vidalia/branches/auto-updates/src/vidalia/config/generalpage.ui
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/generalpage.ui	2008-10-19 17:07:41 UTC (rev 3243)
+++ vidalia/branches/auto-updates/src/vidalia/config/generalpage.ui	2008-10-19 18:19:22 UTC (rev 3244)
@@ -162,7 +162,7 @@
        </widget>
       </item>
       <item>
-       <widget class="QComboBox" name="cmbUpdateFrequency" >
+       <widget class="QComboBox" name="cmbUpdateInterval" >
         <property name="maxVisibleItems" >
          <number>10</number>
         </property>

Modified: vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.cpp	2008-10-19 17:07:41 UTC (rev 3243)
+++ vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.cpp	2008-10-19 18:19:22 UTC (rev 3244)
@@ -38,6 +38,7 @@
 #define SETTING_PROXY_EXECUTABLE_ARGUMENTS  "ProxyExecutableArguments"
 #define SETTING_CHECK_FOR_UPDATES   "CheckForUpdates"
 #define SETTING_LAST_UPDATE_CHECK   "LastUpdateCheck"
+#define SETTING_CHECK_FOR_UPDATES_INTERVAL "CheckForUpdatesInterval"
 
 #if defined(Q_OS_WIN32)
 #define STARTUP_REG_KEY        "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
@@ -79,6 +80,7 @@
   setDefault(SETTING_CHECK_FOR_UPDATES, false);
 #endif
   setDefault(SETTING_LAST_UPDATE_CHECK, QDateTime());
+  setDefault(SETTING_CHECK_FOR_UPDATES_INTERVAL, "weekly");
 }
 
 /** Gets the currently preferred language code for Vidalia. */
@@ -278,3 +280,20 @@
   setValue(SETTING_LAST_UPDATE_CHECK, checkedAt);
 }
 
+/** Returns the interval between automated checks for available software
+ * updates. */
+QString
+VidaliaSettings::checkForUpdatesInterval() const
+{
+  return value(SETTING_CHECK_FOR_UPDATES_INTERVAL).toString();
+}
+
+/** Sets to <b>interval</b> the frequency with which we will automatically
+ * check for available software updates. */
+void
+VidaliaSettings::setCheckForUpdatesInterval(const QString &interval)
+{
+  setValue(SETTING_CHECK_FOR_UPDATES_INTERVAL, interval);
+}
+
+

Modified: vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.h
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.h	2008-10-19 17:07:41 UTC (rev 3243)
+++ vidalia/branches/auto-updates/src/vidalia/config/vidaliasettings.h	2008-10-19 18:19:22 UTC (rev 3244)
@@ -107,6 +107,13 @@
   /** Sets to <b>checkedAt</b> the time at which Vidalia last checked for
    * available software updates. */
   void setLastCheckedForUpdates(const QDateTime &checkedAt);
+
+  /** Returns the interval between automated checks for available software
+   * updates. */
+  QString checkForUpdatesInterval() const;
+  /** Sets to <b>interval</b> the frequency with which we will automatically
+   * check for available software updates. */
+  void setCheckForUpdatesInterval(const QString &interval);
 };
 
 #endif