[PC-BSD Commits] r2088 - pcbsd/trunk/kcmPBMsource

svn at pcbsd.org svn at pcbsd.org
Wed Jun 11 08:49:18 PDT 2008


Author: tim
Date: 2008-06-11 08:49:18 -0700 (Wed, 11 Jun 2008)
New Revision: 2088

Modified:
   pcbsd/trunk/kcmPBMsource/PBM.pro
   pcbsd/trunk/kcmPBMsource/kcm.cpp
   pcbsd/trunk/kcmPBMsource/kcm.h
   pcbsd/trunk/kcmPBMsource/pbi.cpp
   pcbsd/trunk/kcmPBMsource/pbi.h
   pcbsd/trunk/kcmPBMsource/pbm.ui
   pcbsd/trunk/kcmPBMsource/pbm.ui.h
Log:
PBM now compiles under Qt4, doesn't quite work yet though.

Modified: pcbsd/trunk/kcmPBMsource/PBM.pro
===================================================================
--- pcbsd/trunk/kcmPBMsource/PBM.pro	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/PBM.pro	2008-06-11 15:49:18 UTC (rev 2088)
@@ -3,19 +3,22 @@
 
 CONFIG	+= qt warn_on release
 
+INCLUDEPATH += /usr/local/kde4/include
+
 HEADERS	+= kcm.h
 
 SOURCES	+= kcm.cpp \
 	pbi.cpp
 
-FORMS	= pbm.ui \
+#The following line was changed from FORMS to FORMS3 by qt3to4
+FORMS3	= pbm.ui \
 	notroot.ui
 
 IMAGES	= application.png \
 	NewLogoSmall.png
 
 TARGET  = kcm_pcbsdpbm
-DESTDIR = /usr/local/lib/kde3/
+DESTDIR = /usr/local/kde4/lib/kde4/
 
 
 
@@ -32,3 +35,8 @@
 }
 
 
+#The following line was inserted by qt3to4
+QT +=  qt3support 
+#The following line was inserted by qt3to4
+CONFIG += uic3
+

Modified: pcbsd/trunk/kcmPBMsource/kcm.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/kcm.cpp	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/kcm.cpp	2008-06-11 15:49:18 UTC (rev 2088)
@@ -1,20 +1,22 @@
 #include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
 
 #include <klocale.h>
 #include <kglobal.h>
-#include <kparts/genericfactory.h>
+#include <kgenericfactory.h>
 #include ".ui/pbm.h"
 #include ".ui/notroot.h"
 #include <kcm.h>
 #include <qtranslator.h>
 
+K_PLUGIN_FACTORY(PCBSDPBMFactory, registerPlugin<PCBSDPBM>();)
+K_EXPORT_PLUGIN(PCBSDPBMFactory("kcm_pcbsdpbm"))
 
-PCBSDKCModule::PCBSDKCModule(QWidget  *parent,
-                           const char  *name,
-                           __unused  const QStringList &  list)
-   :    KCModule(parent, name)
+PCBSDPBM::PCBSDPBM(QWidget *parent, const QVariantList &args)
+   :    KCModule(PCBSDPBMFactory::componentData(), parent, args)
 {
-  layout = new QGridLayout(this);
+  layout = new Q3GridLayout(this);
   layout->setAutoAdd(true);
   
   buttons();
@@ -24,7 +26,7 @@
    buttons();
    setButtons(KCModule::Help);
   QString LANG="PBMsource";
-  KGlobal::locale()->insertCatalogue(LANG);
+  KGlobal::locale()->insertCatalog(LANG);
 
   PBM *pbmproc = new PBM(parent);
   pbmproc->reparent(this, QPoint());
@@ -37,52 +39,24 @@
    
 }
 
-PCBSDKCModule::~PCBSDKCModule() {
+PCBSDPBM::~PCBSDPBM() {
 }
 
 
-bool    PCBSDKCModule::checkRoot() {
+bool    PCBSDPBM::checkRoot() {
     return (getuid() == 0);
 }
 
 
-void    PCBSDKCModule::load() {
+void    PCBSDPBM::load() {
     
 }
 
 
-void    PCBSDKCModule::defaults() {
+void    PCBSDPBM::defaults() {
    load();
 }
 
 
-void    PCBSDKCModule::save() {
+void    PCBSDPBM::save() {
 }
-
-
-/*
-* Start the KFactory Creation  
-*
-*/
-
-
-
-typedef KGenericFactory<PCBSDPBM, QWidget> PCBSDPBMFactory;
-K_EXPORT_COMPONENT_FACTORY(kcm_PCBSDPBM, PCBSDPBMFactory("kcm_pcbsdpbm"))
-
-extern "C" {
-      KCModule *create_pcbsdpbm(QWidget  *parent, const char  *name) {
-      return new PCBSDPBM(parent, name);
-   }
-}
-
-PCBSDPBM::PCBSDPBM( QWidget  *parent,  const char *name,  const QStringList& ) : PCBSDKCModule( parent, name)
-{
-}
-
-PCBSDPBM::~PCBSDPBM() {
-}
-
-QString  PCBSDPBM::kcmoduleName() {
-   return  "pcbsdpbm";
-}

Modified: pcbsd/trunk/kcmPBMsource/kcm.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/kcm.h	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/kcm.h	2008-06-11 15:49:18 UTC (rev 2088)
@@ -6,12 +6,12 @@
 
 
 
-class  PCBSDKCModule : public KCModule {
+class  PCBSDPBM : public KCModule {
    Q_OBJECT
 
 public:
-   PCBSDKCModule(QWidget * = NULL,  const char * = NULL,  const QStringList & = QStringList());
-   ~PCBSDKCModule();
+   PCBSDPBM(QWidget *parent, const QVariantList &args);
+   ~PCBSDPBM();
    
    void load();
    void defaults();
@@ -19,18 +19,3 @@
    bool checkRoot();
    QLayout 	*layout;
 };
-
-
-
-
-class PCBSDPBM: public PCBSDKCModule { 
-   Q_OBJECT
-   
-public:
-   PCBSDPBM(QWidget * = NULL,  const char * = NULL,  const QStringList & = QStringList() );
-   virtual  ~PCBSDPBM();
-void   getParent(QWidget * = NULL);
-   
-protected:
-   QString      kcmoduleName();
-};

Modified: pcbsd/trunk/kcmPBMsource/pbi.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbi.cpp	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/pbi.cpp	2008-06-11 15:49:18 UTC (rev 2088)
@@ -25,20 +25,20 @@
 #include "pbi.h"
 #include <qimage.h>
 
-PBI::PBI(QListBox *listbox) : QListBoxPixmap(listbox, QPixmap(), "")
+PBI::PBI(QListWidget *listbox) : QListWidgetItem(QIcon(), "", listbox)
 {
    name = "SOMENAME";
    version = "0.0.1";
    icon = QPixmap();
    author = "";
    website = "";
-   exePath = "";
-   mimeFile = "";
+   exePath = QStringList();
+   mimeFile = QStringList();
    iconPath = "";
    setText(name + " " + version);
 }
 
-PBI::PBI(QListBox *listbox, QString name, QString version, QString iconPath, QString author, QString website) : QListBoxPixmap(listbox, QPixmap(), name + version)
+PBI::PBI(QListWidget *listbox, QString name, QString version, QString iconPath, QString author, QString website) : QListWidgetItem(QIcon(), name + version, listbox)
 {
    this->name = name;
    this->version = version;
@@ -49,9 +49,9 @@
    setText(name + " " + version);
 }
 
-PBI::PBI(QPixmap pixmap, QListBox *listbox) : QListBoxPixmap(listbox, pixmap, "")
+PBI::PBI(QIcon icon, QListWidget *listbox) : QListWidgetItem(icon, "", listbox)
 {
-   icon = pixmap;
+   this->icon = icon;
 }
 
 PBI::~PBI()
@@ -69,7 +69,7 @@
    return version;
 }
 
-QPixmap PBI::getIcon()
+QIcon PBI::getIcon()
 {
    return icon;
 }
@@ -106,14 +106,14 @@
    setText(name + " " + version);
 }
 
-void PBI::setIcon(QPixmap icon)
+void PBI::setIcon(QIcon icon)
 {
    this->icon = icon;
 }
 
 void PBI::setIcon(QString iconPath)
 {
-   icon.convertFromImage(QImage(iconPath).smoothScale(40,40));
+   icon = QIcon(iconPath);
    this->iconPath = iconPath;
 }
 
@@ -144,6 +144,7 @@
 
 void PBI::paint(QPainter *p)
 {
+   QPixmap icon = pixmap();
    p->drawPixmap(3, 0, icon);
    if (!text().isEmpty())
    {
@@ -157,7 +158,7 @@
 
 QPixmap PBI::pixmap()
 {
-   return icon;
+   return icon.pixmap(40,40);
 }
 
 QString PBI::toString()

Modified: pcbsd/trunk/kcmPBMsource/pbi.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbi.h	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/pbi.h	2008-06-11 15:49:18 UTC (rev 2088)
@@ -23,25 +23,24 @@
  ***************************************************************************/
 
 #include <qapplication.h>
-#include <qlistbox.h>
-#include <qpixmap.h>
 #include <qpainter.h>
+#include <QListWidget>
 
 #ifndef INC_PBI_H
 #define INC_PBI_H
 
-class PBI : public QListBoxPixmap {
+class PBI : public QListWidgetItem {
 public:
     //Constructors
-    PBI(QListBox *listbox = 0);
-    PBI(QListBox *listbox, QString name, QString version, QString iconPath, QString author, QString website);
-    PBI(QPixmap icon, QListBox *listbox = 0);
+    PBI(QListWidget *listbox = 0);
+    PBI(QListWidget *listbox, QString name, QString version, QString iconPath, QString author, QString website);
+    PBI(QIcon icon, QListWidget *listbox = 0);
     ~PBI();
     
     //Getters
     virtual QString getName();
     virtual QString getVersion();
-    virtual QPixmap getIcon();
+    virtual QIcon getIcon();
     virtual QString getAuthor();
     virtual QString getWebsite();
     virtual QStringList getExePath();
@@ -51,7 +50,7 @@
     //Setters
     virtual void setName(QString name);
     virtual void setVersion(QString version);
-    virtual void setIcon(QPixmap icon);
+    virtual void setIcon(QIcon icon);
     virtual void setIcon(QString iconPath);
     virtual void setAuthor(QString author);
     virtual void setWebsite(QString website);
@@ -70,7 +69,7 @@
 private:
     QString name;
     QString version;
-    QPixmap icon;
+    QIcon icon;
     QString author;
     QString website;
     QStringList exePath;

Modified: pcbsd/trunk/kcmPBMsource/pbm.ui
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui	2008-06-11 15:49:18 UTC (rev 2088)
@@ -94,7 +94,7 @@
                                     </widget>
                                 </hbox>
                             </widget>
-                            <widget class="QListBox">
+                            <widget class="QListWidget">
                                 <item>
                                     <property name="text">
                                         <string>Populating list, please wait...</string>
@@ -111,12 +111,6 @@
                                         <verstretch>0</verstretch>
                                     </sizepolicy>
                                 </property>
-                                <property name="selectionMode">
-                                    <enum>Extended</enum>
-                                </property>
-                                <property name="variableHeight">
-                                    <bool>false</bool>
-                                </property>
                             </widget>
                             <widget class="QLayoutWidget">
                                 <property name="name">
@@ -236,7 +230,7 @@
                                     </widget>
                                 </hbox>
                             </widget>
-                            <widget class="QListBox">
+                            <widget class="QListWidget">
                                 <property name="name">
                                     <cstring>componentListbox</cstring>
                                 </property>
@@ -305,9 +299,9 @@
 <connections>
     <connection>
         <sender>componentListbox</sender>
-        <signal>selectionChanged(QListBoxItem*)</signal>
+        <signal>itemChanged(QListWidgetItem*)</signal>
         <receiver>PBM</receiver>
-        <slot>componentSelectionChangedSlot(QListBoxItem*)</slot>
+        <slot>componentSelectionChangedSlot(QListWidgetItem*)</slot>
     </connection>
     <connection>
         <sender>componentInstallButton</sender>
@@ -321,6 +315,7 @@
     <include location="global" impldecl="in declaration">kdirwatch.h</include>
     <include location="global" impldecl="in declaration">qfile.h</include>
     <include location="global" impldecl="in declaration">kmessagebox.h</include>
+    <include location="global" impldecl="in declaration">Q3ValueList</include>
     <include location="local" impldecl="in declaration">pbi.h</include>
     <include location="local" impldecl="in implementation">pbm.ui.h</include>
 </includes>
@@ -354,7 +349,7 @@
     <slot access="private">removeComponentSlot()</slot>
     <slot access="private" returnType="bool">checkComponentSlot( int component )</slot>
     <slot access="private">refreshComponentsSlot()</slot>
-    <slot access="private">componentSelectionChangedSlot( QListBoxItem * )</slot>
+    <slot access="private">componentSelectionChangedSlot( QListWidgetItem * )</slot>
     <slot access="private">componentButtonClicked()</slot>
     <slot access="private">removeComponentFinishedSlot()</slot>
     <slot access="private">installComponentFinishedSlot()</slot>

Modified: pcbsd/trunk/kcmPBMsource/pbm.ui.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-06-11 15:47:27 UTC (rev 2087)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-06-11 15:49:18 UTC (rev 2088)
@@ -1,3 +1,8 @@
+//Added by qt3to4:
+#include <Q3TextStream>
+#include <Q3ValueList>
+#include <QPixmap>
+#include <QTimer>
 /***************************************************************************
  *   Copyright (C) 2006 - 2007 PC-BSD Software   *
  *   kris at pcbsd.com  *
@@ -29,7 +34,7 @@
     
     connect(RemoveButton, SIGNAL( clicked() ), this, SLOT(RemoveButtonSlot() ) );
     
-    CheckRoot = new QProcess( this );
+    CheckRoot = new Q3Process( this );
     CheckRoot->addArgument( "whoami" );
     
     connect(CheckRoot, SIGNAL( readyReadStdout() ), this, SLOT(CheckRootSlot() ) );	   
@@ -46,8 +51,8 @@
     
         // Loads the username
     QFile whoami( "/Programs/.tmp/whoami" );
-    if ( whoami.open( IO_ReadOnly ) ) {
-        QTextStream stream3( &whoami );
+    if ( whoami.open( QIODevice::ReadOnly ) ) {
+        Q3TextStream stream3( &whoami );
         while ( !stream3.atEnd() ) {
             	      RealUserName = stream3.readLine();
 	}
@@ -65,10 +70,10 @@
    //Stop the scanner from interfering
    fileWatcher->stopScan();
    
-   QValueList<PBI*> selectedItems;
+   Q3ValueList<PBI*> selectedItems;
    QStringList selectedNames;
    
-   for (int i=0; i<SoftwareListBox->numRows(); i++)
+   for (int i=0; i<SoftwareListBox->count(); i++)
    {
       PBI *pbi = dynamic_cast<PBI*>(SoftwareListBox->item(i));
       if (pbi->isSelected())
@@ -87,7 +92,7 @@
       return;
    }
    
-   for (QValueList<PBI*>::Iterator item = selectedItems.begin(); item != selectedItems.end(); ++item)
+   for (Q3ValueList<PBI*>::Iterator item = selectedItems.begin(); item != selectedItems.end(); ++item)
    {
       qDebug("Removing item: " + (*item)->text());
       CheckScriptSlot(*item);
@@ -115,8 +120,8 @@
 
     qDebug("Opening ProgList");
     QFile file( "/Programs/.config/ProgList" );
-    if ( file.open( IO_ReadOnly ) ) {
-        QTextStream stream( &file );
+    if ( file.open( QIODevice::ReadOnly ) ) {
+        Q3TextStream stream( &file );
         QString line;
         
 	qDebug("Reading ProgList...");
@@ -126,7 +131,7 @@
            {
 		if (line.find("ProgName:" ) ==  0 )
                 {
-                    if (pbi != 0) SoftwareListBox->insertItem(pbi);
+                    if (pbi != 0) SoftwareListBox->addItem(pbi);
                     qDebug("PBI Count: " + QString::number(SoftwareListBox->count()));
                     pbi = new PBI(defaultIcon);
 		    //ProgName[i] = line.replace("ProgName: ", "");
@@ -183,29 +188,29 @@
     }
     // Only insert the PBI into the list if we found some
     if ( foundPBI == 1 ) {
-      SoftwareListBox->insertItem(pbi);
+      SoftwareListBox->addItem(pbi);
       qDebug(pbi->text());
     }
-    SoftwareListBox->sort();
+    SoftwareListBox->sortItems();
 }
 
 
-void PBM::CleanPackageList(QValueList<PBI*> *pbiList)
+void PBM::CleanPackageList(Q3ValueList<PBI*> *pbiList)
 {
     QString NewConfig;
     QString ProgEntry;
     
     // Save new File
     QFile file2( "/Programs/.config/ProgList" );
-    if ( file2.open( IO_WriteOnly ) )
+    if ( file2.open( QIODevice::WriteOnly ) )
     {
-        QTextStream stream2( &file2 );
+        Q3TextStream stream2( &file2 );
 
 	stream2 << "# PC-BSD - Install Config File\n";
 	stream2 << "# Please do not edit this file manually!\n";
 	stream2 << "#######################\n";
 	
-        for (int i=0; i<SoftwareListBox->numRows(); i++)
+        for (int i=0; i<SoftwareListBox->count(); i++)
         {
            PBI *item = dynamic_cast<PBI*>(SoftwareListBox->item(i));
            if (pbiList->contains(item) == 0)
@@ -249,13 +254,13 @@
     for (QStringList::Iterator mime = mimeFile.begin(); mime != mimeFile.end(); ++mime)
     {
 	// Remove the hidden file
-	RemoveFile = new QProcess( this );
+	RemoveFile = new Q3Process( this );
 	RemoveFile->addArgument( "rm" );
 	RemoveFile->addArgument( "/usr/local/share/applnk/.hidden/" + *mime + ".desktop" );
         RemoveFile->start();
 
 	// Remove the application file
-	RemoveFile1 = new QProcess( this );
+	RemoveFile1 = new Q3Process( this );
 	RemoveFile1->addArgument( "rm" );
 	RemoveFile1->addArgument( "/usr/local/share/mimelnk/application/" + *mime + ".desktop" );
         RemoveFile1->start();
@@ -276,13 +281,13 @@
 	}
 	
 	// Remove the script
-	RemoveFile2 = new QProcess( this );
+	RemoveFile2 = new Q3Process( this );
 	RemoveFile2->addArgument( "rm" );
 	RemoveFile2->addArgument( "/Programs/.sbin/" + Binary );
         RemoveFile2->start();
 	
 	// Remove the Desktop item
-	RemoveFile3 = new QProcess( this );
+	RemoveFile3 = new Q3Process( this );
 	RemoveFile3->addArgument( "/Programs/.bin/RemoveDesktopLink.sh" );
 	RemoveFile3->addArgument( Binary + ".desktop" ); 
 	RemoveFile3->addArgument( pbi->getName() );
@@ -290,14 +295,14 @@
      }
      
      // Remove the start menu item
-     RemoveFile4 = new QProcess( this );
+     RemoveFile4 = new Q3Process( this );
      RemoveFile4->addArgument( "rm" );
      RemoveFile4->addArgument( "-r" );
      RemoveFile4->addArgument( "/usr/local/share/applnk/My Programs/" + pbi->getName() );
      RemoveFile4->start();
      
      // Remove the start menu item
-     RemoveFile5 = new QProcess( this );
+     RemoveFile5 = new Q3Process( this );
      RemoveFile5->addArgument( "rm" );
      RemoveFile5->addArgument( "-rf" );
      RemoveFile5->addArgument( "/usr/local/share/applnk/" + pbi->getName());
@@ -352,9 +357,9 @@
 
       // Write out the wrapper script
       QFile file( "/Programs/" + progDir + "/.PBIwrapper.sh" );
-      if ( file.open( IO_WriteOnly ) )
+      if ( file.open( QIODevice::WriteOnly ) )
       {
-         QTextStream stream( &file );
+         Q3TextStream stream( &file );
          stream << "#!/bin/sh\n";
          stream << "PROGDIR=\"" + progDir + "\"; export PROGDIR\n";
          stream << "USERNAME=\"" + RealUserName + "\"; export USERNAME\n";
@@ -368,7 +373,7 @@
          file.close();
       }
       
-      RemoveScript = new QProcess( this );
+      RemoveScript = new Q3Process( this );
       RemoveScript->addArgument( "sh" );
       RemoveScript->addArgument( "/Programs/" + progDir + "/.PBIwrapper.sh" );
       if ( !RemoveScript->start() ) KMessageBox::error(this, tr("Error starting custom removal script!"));
@@ -391,11 +396,11 @@
         for ( uint i = 0; i < d.count(); i++ )
         {
 	    QFile file( "/PCBSD/Components/" + d[i] + "/component.cfg" );
-	    if ( file.open( IO_ReadOnly ) ) {
+	    if ( file.open( QIODevice::ReadOnly ) ) {
 		
 		ComponentDir[found]=d[i];
 		
-		QTextStream stream( &file );
+		Q3TextStream stream( &file );
 		QString line;
 		while ( !stream.atEnd() ) {
 		    line = stream.readLine(); // line of text excluding '\n'
@@ -420,10 +425,12 @@
 	       PixmapIcon.convertFromImage(Icon->smoothScale(40,40));
 	       if ( checkComponentSlot(found) ) {
 		ComponentInstalled[found] = 0;
-		componentListbox->insertItem(PixmapIcon, ComponentName[found] + " (" + ComponentDescr[found] + ") - INSTALLED");
+		QListWidgetItem item(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - INSTALLED");
+		componentListbox->addItem(&item);
                } else {
 		ComponentInstalled[found] = 1;
-	        componentListbox->insertItem(PixmapIcon, ComponentName[found] + " (" + ComponentDescr[found] + ") - NOT INSTALLED");
+		QListWidgetItem item(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - NOT INSTALLED");
+		componentListbox->addItem(&item);
 	       }
 		
 		found++;
@@ -437,9 +444,9 @@
 
 void PBM::installComponentSlot()
 {
-    if (componentListbox->currentItem() != -1)
+    if (componentListbox->currentRow() != NULL)
     {
-             ComponentWorkingItem = componentListbox->currentItem();
+             ComponentWorkingItem = componentListbox->currentRow();
 	     
              switch( QMessageBox::warning( this, tr("Install Component?"), tr("Do you want to install ") + ComponentName[ComponentWorkingItem] + "? This can be removed later from this menu.", tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {
              case 0: // The user clicked the OK again button or pressed Enter    
@@ -449,7 +456,7 @@
             break;
           }
 
-	InfoWindow = new QProcess( this );
+	InfoWindow = new Q3Process( this );
 	InfoWindow->addArgument( "kdialog");
 	InfoWindow->addArgument( "--passivepopup" ); 
 	InfoWindow->addArgument( "Please Wait.. Installing " + ComponentName[ComponentWorkingItem] + ".." ); 
@@ -464,7 +471,7 @@
 
         
 	// Remove the component
-	installComponentProc = new QProcess( this );
+	installComponentProc = new Q3Process( this );
 	installComponentProc->addArgument( "/PCBSD/Components/" + ComponentDir[ComponentWorkingItem] + "/install.sh");
 
 	connect( installComponentProc, SIGNAL(processExited()), this, SLOT(installComponentFinishedSlot() ) );
@@ -481,9 +488,9 @@
 void PBM::removeComponentSlot()
 {
 
-    if (componentListbox->currentItem() != -1)
+    if (componentListbox->currentRow() != -1)
     {
-             ComponentWorkingItem = componentListbox->currentItem();
+             ComponentWorkingItem = componentListbox->currentRow();
 	     
              switch( QMessageBox::warning( this, tr("Remove Component?"), tr("Do you want to remove ") + ComponentName[ComponentWorkingItem] + "? This can be re-added later from this menu.", tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {
              case 0: // The user clicked the OK again button or pressed Enter    
@@ -493,7 +500,7 @@
             break;
           }
 
-	InfoWindow = new QProcess( this );
+	InfoWindow = new Q3Process( this );
 	InfoWindow->addArgument( "kdialog");
 	InfoWindow->addArgument( "--passivepopup" ); 
 	InfoWindow->addArgument( "Please Wait.. Removing " + ComponentName[ComponentWorkingItem] + ".." ); 
@@ -508,7 +515,7 @@
 
         
 	// Remove the component
-	removeComponentProc = new QProcess( this );
+	removeComponentProc = new Q3Process( this );
 	removeComponentProc->addArgument( "/PCBSD/Components/" + ComponentDir[ComponentWorkingItem] + "/remove.sh");
 
 	connect( removeComponentProc, SIGNAL(processExited()), this, SLOT(removeComponentFinishedSlot() ) );
@@ -541,15 +548,15 @@
 }
 
 
-void PBM::componentSelectionChangedSlot( QListBoxItem* )
+void PBM::componentSelectionChangedSlot( QListWidgetItem* )
 {
 
     int selectedItem;
 
-    if (componentListbox->currentItem() != -1)
+    if (componentListbox->currentRow() != -1)
     {
 	
-        selectedItem = componentListbox->currentItem();
+        selectedItem = componentListbox->currentRow();
         componentInstallButton->setEnabled(TRUE);
 	if ( ComponentInstalled[selectedItem] == 0 ) {
  		componentInstallButton->setText("Remove");
@@ -570,10 +577,10 @@
  // If the user clicked to remove / install a component, check which one
     int selectedItem;
 
-    if (componentListbox->currentItem() != -1)
+    if (componentListbox->currentRow() != -1)
     {
 	
-        selectedItem = componentListbox->currentItem();
+        selectedItem = componentListbox->currentRow();
         if ( ComponentInstalled[selectedItem] == 0 ) {
  		removeComponentSlot();
 	} else {
@@ -640,20 +647,18 @@
     QStringList paths;
     paths += path;
     
-    for (uint i=0; i<paths.size(); i++)
+    for (int i=0; i<paths.size(); i++)
     {
 	QFileInfo dirInfo(paths[i]);
 	if (!dirInfo.exists()) break;
 	totalSize += dirInfo.size();
 	QDir dir(paths[i]);
-	const QFileInfoList *files = dir.entryInfoList();
-	QFileInfo *fileInfo;
-	QFileInfoListIterator it( *files );
-	while ((fileInfo = it.current()) != 0)
+	const QFileInfoList files = dir.entryInfoList();
+	for (int i=0; i<files.size(); i++)
 	{
-	    if (fileInfo->isDir() && (( ! fileInfo->isSymLink()) && (fileInfo->fileName() != "..") && (fileInfo->fileName() != "."))) { paths += fileInfo->absFilePath(); }
-	    else if (fileInfo->isFile()) { totalSize += fileInfo->size(); }
-	    ++it;
+	    QFileInfo fileInfo = files.at(i);
+	    if (fileInfo.isDir() && (( ! fileInfo.isSymLink()) && (fileInfo.fileName() != "..") && (fileInfo.fileName() != "."))) { paths += fileInfo.absFilePath(); }
+	    else if (fileInfo.isFile()) { totalSize += fileInfo.size(); }
 	}
     }
     return totalSize;



More information about the Commits mailing list