[PC-BSD Commits] r2600 - pcbsd/trunk/SystemUpdater

svn at pcbsd.org svn at pcbsd.org
Fri Aug 15 12:01:40 PDT 2008


Author: kris
Date: 2008-08-15 12:01:40 -0700 (Fri, 15 Aug 2008)
New Revision: 2600

Modified:
   pcbsd/trunk/SystemUpdater/SystemUpdater.pro
   pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
   pcbsd/trunk/SystemUpdater/UpdaterTray.h
   pcbsd/trunk/SystemUpdater/updaterDialog.cpp
   pcbsd/trunk/SystemUpdater/updaterDialog.h
Log:

Fixed the SystemUpdater to use KJob not KIO::Job now. Also updated some of our slots to match the KDE4 prototypes



Modified: pcbsd/trunk/SystemUpdater/SystemUpdater.pro
===================================================================
--- pcbsd/trunk/SystemUpdater/SystemUpdater.pro	2008-08-14 18:19:07 UTC (rev 2599)
+++ pcbsd/trunk/SystemUpdater/SystemUpdater.pro	2008-08-15 19:01:40 UTC (rev 2600)
@@ -18,6 +18,7 @@
 
 LIBS += -L/usr/local/kde4/lib
 
+QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
 
 TARGET  = SystemUpdater
 DESTDIR = /PCBSD/SystemUpdater/bin/

Modified: pcbsd/trunk/SystemUpdater/UpdaterTray.cpp
===================================================================
--- pcbsd/trunk/SystemUpdater/UpdaterTray.cpp	2008-08-14 18:19:07 UTC (rev 2599)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.cpp	2008-08-15 19:01:40 UTC (rev 2600)
@@ -17,7 +17,10 @@
 #include <kmessagebox.h>
 #include <kpassivepopup.h>
 #include <iostream>
+#include <unistd.h>
+#include <kjob.h>
 #include <kio/job.h>
+#include <kio/copyjob.h>
 
 #include "UpdaterTray.h"
 #include "SystemUpdater.h"
@@ -151,23 +154,9 @@
  
 
 // Get the username of the person running X
-  command="who | grep ':0' | cut -d ' ' -f 1";
-  FILE *file = popen(command,"r");
-  char buffer[100];
+  username = getlogin();
 
-  QString line = "";
-  char firstChar;
 
-  if ((firstChar = fgetc(file)) != -1){
-         line += firstChar;
-         line += fgets(buffer,100,file);
-  }
-
-  pclose(file);
-  line.truncate(line.length() -1);
-  username = line;
-
-
   // Set the tray icon that we are checking for updates
   QIcon Icon;
   Icon.addFile("/PCBSD/SystemUpdater/images/working.png");
@@ -1061,14 +1050,14 @@
    UpdaterStatusDialog->setLabelSysUpdateStatus(status);
 
     UpdaterStatusDialog->setProgressTotalSteps(100);
+     
+    copyJob = KIO::copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", KIO::HideProgressInfo);
     
-    copyJob = KIO::file_copy(SysUpdateURL[currentSysWorkingItem], "/PCBSD/tmp/patch" + tmp.setNum(currentSysWorkingItem) + ".lzma", -1, KIO::HideProgressInfo);
-    
-    connect(copyJob, SIGNAL(totalSize(KIO::Job*, KIO::filesize_t)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KIO::Job*, KIO::filesize_t)));
-    connect(copyJob, SIGNAL(percent(KIO::Job*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KIO::Job*, unsigned long)));
-    connect(copyJob, SIGNAL(speed(KIO::Job*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KIO::Job*, unsigned long)));
-    connect(copyJob, SIGNAL(processedSize(KIO::Job*, KIO::filesize_t)), UpdaterStatusDialog, SLOT(slotJobUpdateProcessedSize( KIO::Job*, KIO::filesize_t)));
-    connect(copyJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotStartCheckSysMD5()));
+    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
+    connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
+    connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
+    connect(copyJob, SIGNAL(processedSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateProcessedSize( KJob*, qulonglong)));
+    connect(copyJob, SIGNAL(result(KJob *)), this, SLOT(slotStartCheckSysMD5()));
 
 
 }
@@ -1391,8 +1380,7 @@
 {
    QString command;
    command = "su " + username + " -c 'konqueror " + SysUpdateDetailsURL[id] + "' &";
-   FILE *file = popen(command,"r"); 
-   pclose(file);
+   system(command); 
 }
 
 
@@ -1842,13 +1830,13 @@
 
     UpdaterStatusDialog->setProgressTotalSteps(100);
     
-    copyJob = KIO::file_copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", -1,KIO::HideProgressInfo);
+    copyJob = KIO::copy(URL, "/PCBSD/tmp/" + tmp.setNum(currentWorkingPBI) + ".pbi", KIO::HideProgressInfo);
     
-    connect(copyJob, SIGNAL(totalSize(KIO::Job*, KIO::filesize_t)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KIO::Job*, KIO::filesize_t)));
-    connect(copyJob, SIGNAL(percent(KIO::Job*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KIO::Job*, unsigned long)));
-    connect(copyJob, SIGNAL(speed(KIO::Job*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KIO::Job*, unsigned long)));
-    connect(copyJob, SIGNAL(processedSize(KIO::Job*, KIO::filesize_t)), UpdaterStatusDialog, SLOT(slotJobUpdateProcessedSize( KIO::Job*, KIO::filesize_t)));
-    connect(copyJob, SIGNAL(result(KIO::Job*)), this, SLOT(slotDownloadPBIDone()));
+    connect(copyJob, SIGNAL(totalSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateTotalSize( KJob*, qulonglong)));
+    connect(copyJob, SIGNAL(percent(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobSetPercent(KJob*, unsigned long)));
+    connect(copyJob, SIGNAL(speed(KJob*, unsigned long)), UpdaterStatusDialog, SLOT(slotJobUpdateSpeed( KJob*, unsigned long)));
+    connect(copyJob, SIGNAL(processedSize(KJob*, qulonglong)), UpdaterStatusDialog, SLOT(slotJobUpdateProcessedSize( KJob*, qulonglong)));
+    connect(copyJob, SIGNAL(result(KJob*)), this, SLOT(slotDownloadPBIDone()));
     
 }
 

Modified: pcbsd/trunk/SystemUpdater/UpdaterTray.h
===================================================================
--- pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-08-14 18:19:07 UTC (rev 2599)
+++ pcbsd/trunk/SystemUpdater/UpdaterTray.h	2008-08-15 19:01:40 UTC (rev 2600)
@@ -62,7 +62,7 @@
    void loadUpdaterPrefs();
    void loadPatchData(QString patchFile, int patchNum);
 
-   KIO::FileCopyJob *copyJob;
+   KJob *copyJob;
 };
 
 

Modified: pcbsd/trunk/SystemUpdater/updaterDialog.cpp
===================================================================
--- pcbsd/trunk/SystemUpdater/updaterDialog.cpp	2008-08-14 18:19:07 UTC (rev 2599)
+++ pcbsd/trunk/SystemUpdater/updaterDialog.cpp	2008-08-15 19:01:40 UTC (rev 2600)
@@ -105,27 +105,27 @@
 }
 
 
-void updaterStatus::slotJobSetPercent( KIO::Job*, unsigned long percent )
+void updaterStatus::slotJobSetPercent( KJob*, unsigned long percent )
 {
    progressInstall->setProgress(percent);
 }
 
 
-void updaterStatus::slotJobUpdateTotalSize( KIO::Job *, KIO::filesize_t size )
+void updaterStatus::slotJobUpdateTotalSize( KJob *, qulonglong size )
 {
    totalSize = size;
    generateCopyLabel();
 }
 
 
-void updaterStatus::slotJobUpdateProcessedSize( KIO::Job *, KIO::filesize_t size )
+void updaterStatus::slotJobUpdateProcessedSize( KJob *, qulonglong size )
 {
    processedSize = size;
    generateCopyLabel();
 }
 
 
-void updaterStatus::slotJobUpdateSpeed( KIO::Job *, unsigned long speed )
+void updaterStatus::slotJobUpdateSpeed( KJob *, unsigned long speed )
 {
    this->speed = speed;
    generateCopyLabel();

Modified: pcbsd/trunk/SystemUpdater/updaterDialog.h
===================================================================
--- pcbsd/trunk/SystemUpdater/updaterDialog.h	2008-08-14 18:19:07 UTC (rev 2599)
+++ pcbsd/trunk/SystemUpdater/updaterDialog.h	2008-08-15 19:01:40 UTC (rev 2600)
@@ -30,10 +30,10 @@
 
 
 public slots:
-    void slotJobSetPercent(KIO::Job*, unsigned long percent);
-    void slotJobUpdateTotalSize(KIO::Job*, KIO::filesize_t size);
-    void slotJobUpdateProcessedSize(KIO::Job*, KIO::filesize_t size);
-    void slotJobUpdateSpeed(KIO::Job*, unsigned long speed);
+    void slotJobSetPercent(KJob*, unsigned long percent);
+    void slotJobUpdateTotalSize(KJob*, qulonglong size);
+    void slotJobUpdateProcessedSize(KJob*, qulonglong size);
+    void slotJobUpdateSpeed(KJob*, unsigned long speed);
 
 
 private slots:



More information about the Commits mailing list