[PC-BSD Commits] r16084 - in pcbsd/current/src-qt4/pc-systemupdatertray: . images

svn at pcbsd.org svn at pcbsd.org
Wed Mar 28 14:42:37 PDT 2012


Author: kenmoore
Date: 2012-03-28 21:42:36 +0000 (Wed, 28 Mar 2012)
New Revision: 16084

Added:
   pcbsd/current/src-qt4/pc-systemupdatertray/images/restart.png
Modified:
   pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp
Log:
Add a new status to the updater tray for a system restart required. Will not open update manager while the computer requires a restart to finish current updates.



Modified: pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp	2012-03-28 20:11:35 UTC (rev 16083)
+++ pcbsd/current/src-qt4/pc-systemupdatertray/UpdaterTray.cpp	2012-03-28 21:42:36 UTC (rev 16084)
@@ -28,6 +28,7 @@
 #define SYSTEM_CHECKING4UPDATES 4
 #define SYSTEM_UPDATING 5
 #define CHECK_FAILED 6
+#define SYSTEM_RESTART_NEEDED 7
 
 #define PBI_UPDATED 0
 #define PBI_UPDATES_AVAIL 1
@@ -310,6 +311,13 @@
 
   qDebug() << "Starting System Update Check";
 
+  //Check for installed system updates needing computer to restart to finish
+  bool needRestart = false;
+  if( QFile::exists("/usr/local/tmp/update-stagedir/doupdate.sh") ){
+    needRestart = true;
+  }
+  
+  // Check for PC-BSD updates
   QProcess p;
   bool haveUp = false;
   p.start(QString("pc-updatemanager"), QStringList() << "check");
@@ -340,19 +348,18 @@
        break;
     }
   }
-
-  if ( haveUp ) {
+  if ( needRestart ) {
+    programstatus = SYSTEM_RESTART_NEEDED;
+  } else if ( haveUp ) {
     programstatus = SYSTEM_UPDATE_AVAIL;
-    contextMenuRefresh();
-    displayTooltip();
-
   } else {
     // We have no updates available, indicate that now.
     programstatus = SYSTEM_UP2DATE;
-
-    contextMenuRefresh();
-    displayTooltip();
   }
+  
+  //Display the info based on the program status
+  contextMenuRefresh();
+  displayTooltip();
 
 }
 
@@ -398,6 +405,11 @@
      Icon.addFile(PREFIX + "/share/pcbsd/pc-systemupdatertray/images/updating.png");
   }
 
+  if ( programstatus == SYSTEM_RESTART_NEEDED)
+  {
+     Icon.addFile(PREFIX + "/share/pcbsd/pc-systemupdatertray/images/restart.png");
+  }
+  
   // Check if we are downloading a system update in the background
   if ( autoStatus == AUTODOWNLOAD)
   {
@@ -465,7 +477,12 @@
 
 void UpdaterTray::slotOpenUpdateManager(void)
 {   
-    system ("(sudo pc-updategui) &"); 
+   if ( programstatus == SYSTEM_RESTART_NEEDED ){
+     qDebug() << "System restart required: Do not open update manager";
+     QMessageBox::warning(this, tr("Restart Required"), tr("Please restart your computer to complete the pending updates") );
+   }else{
+     system ("(sudo pc-updategui) &"); 
+   }
 }
 
 void UpdaterTray::slotOpenSoftwareManager(void)
@@ -512,6 +529,10 @@
         QTimer::singleShot(15000, this, SLOT(slotShowSysUpdatePopup()));
       }
    }
+   
+   if (programstatus == SYSTEM_RESTART_NEEDED) {
+     tooltipStr += "<br>" + tr("System restart required to finish updates");
+   }
 
    // If the program has a PBI update
    if ( pbistatus == PBI_UPDATES_AVAIL ) 

Index: pcbsd/current/src-qt4/pc-systemupdatertray/images/restart.png
===================================================================
--- pcbsd/current/src-qt4/pc-systemupdatertray/images/restart.png	2012-03-28 20:11:35 UTC (rev 16083)
+++ pcbsd/current/src-qt4/pc-systemupdatertray/images/restart.png	2012-03-28 21:42:36 UTC (rev 16084)

Property changes on: pcbsd/current/src-qt4/pc-systemupdatertray/images/restart.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png


More information about the Commits mailing list