[PC-BSD Commits] r17488 - pcbsd/current/src-qt4/pc-systemupdatertray

svn at pcbsd.org svn at pcbsd.org
Thu Jun 28 08:12:15 PDT 2012


Author: kris
Date: 2012-06-28 15:12:14 +0000 (Thu, 28 Jun 2012)
New Revision: 17488

Modified:
   pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp
   pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.h
Log:

Fix setting run at startup for the updater tray, and add new option to hide
the popup windows. 



Modified: pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp	2012-06-28 13:38:29 UTC (rev 17487)
+++ pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp	2012-06-28 15:12:14 UTC (rev 17488)
@@ -117,6 +117,9 @@
   runAction = trayIconMenu->addAction( tr("Run at startup"), this, SLOT(slotChangeRunStartup()) );
   runAction->setCheckable( TRUE );
   runAction->setChecked( TRUE );
+  popAction = trayIconMenu->addAction( tr("Display notifications"), this, SLOT(slotChangePopup()) );
+  popAction->setCheckable( TRUE );
+  popAction->setChecked( TRUE );
   trayIconMenu->addSeparator();
   trayIconMenu->addAction( tr("Quit"), this, SLOT(slotQuitTray()) );
   
@@ -268,18 +271,23 @@
 
 void UpdaterTray::slotChangeRunStartup() {
 
- if ( runAction->isChecked() )
-   runAction->setChecked ( FALSE );
- else
-   runAction->setChecked ( TRUE );
-
   // Save & reLoad the program preferences
   slotSaveUpdaterPrefs();
+  QSettings settings("PCBSD");
+  settings.setValue( "/PC-BSD/SystemUpdater/runAtStartup", runAction->isChecked() );
   loadUpdaterPrefs();
 
 }
 
+void UpdaterTray::slotChangePopup() {
 
+  // Save & reLoad the program preferences
+  QSettings settings("PCBSD");
+  settings.setValue( "/PC-BSD/SystemUpdater/displayPopup", popAction->isChecked() );
+  loadUpdaterPrefs();
+
+}
+
 void UpdaterTray::slotScheduledSystemCheck() {
 
    
@@ -499,6 +507,9 @@
 
 
 void UpdaterTray::slotTrayActivated(QSystemTrayIcon::ActivationReason reason) {
+   if(reason == QSystemTrayIcon::Context)
+     return;
+
    if(reason == QSystemTrayIcon::Trigger) {
        if ( (programstatus != SYSTEM_UPDATE_AVAIL) && (pbistatus == PBI_UPDATES_AVAIL) )
        {
@@ -575,7 +586,7 @@
    
    if (programstatus == SYSTEM_UPDATE_AVAIL) {
       tooltipStr += "<br>" + tr("System updates available");
-      if ( !shownPopup ) {
+      if ( !shownPopup && popAction->isChecked() ) {
 	shownPopup=true;
         QTimer::singleShot(15000, this, SLOT(slotShowSysUpdatePopup()));
       }
@@ -583,7 +594,7 @@
 
    if (wardenstatus == WARDEN_UPDATE_AVAIL) {
       tooltipStr += "<br>" + tr("Jail updates available");
-      if ( !shownPopup ) {
+      if ( !shownPopup && popAction->isChecked() ) {
 	shownPopup=true;
         QTimer::singleShot(15000, this, SLOT(slotShowJailUpdatePopup()));
       }
@@ -598,7 +609,7 @@
    {
       tooltipStr += "<br><br>" + tr("PBI updates available") + "<br><br>";
       tooltipStr += updatePBITextList;
-      if ( !shownPopup ) {
+      if ( !shownPopup && popAction->isChecked() ) {
 	shownPopup=true;
         QTimer::singleShot(15000, this, SLOT(slotShowPBIUpdatePopup()));
       }
@@ -610,9 +621,9 @@
 
 void UpdaterTray::slotSaveUpdaterPrefs() {
   if (runAction->isChecked() )
-    system("pbreg /PC-BSD/SystemUpdater/runAtStartup false");
+    system("pbreg set /PC-BSD/SystemUpdater/runAtStartup true");
   else
-    system("pbreg /PC-BSD/SystemUpdater/runAtStartup true");
+    system("pbreg set /PC-BSD/SystemUpdater/runAtStartup false");
 
 
 }
@@ -624,6 +635,9 @@
   bool enableStartup = settings.value( "/PC-BSD/SystemUpdater/runAtStartup", TRUE ).toBool();
   runAction->setChecked( enableStartup );
 
+  bool enablePopupNotify = settings.value( "/PC-BSD/SystemUpdater/displayPopup", TRUE ).toBool();
+  popAction->setChecked( enablePopupNotify );
+
   // Load a custom tmpdir
   customTmpDir = PATCHTMPDIR_DEFAULT;
   customTmpDir = settings.value("/PC-BSD/SystemUpdater/customTmpDir", customTmpDir).toString();

Modified: pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.h
===================================================================
--- pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.h	2012-06-28 13:38:29 UTC (rev 17487)
+++ pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.h	2012-06-28 15:12:14 UTC (rev 17488)
@@ -54,6 +54,7 @@
    void slotShowSysUpdatePopup();
    void slotShowJailUpdatePopup();
    void slotShowPBIUpdatePopup();
+   void slotChangePopup();
    
 protected:
    
@@ -71,6 +72,7 @@
    QString customTmpDir;
    QString patchTmpDir;
    QAction *runAction;
+   QAction *popAction;
    int autoStatus;
    QString autoCurrentUpdate;
    QStringList autoUpdatesFailed;



More information about the Commits mailing list