[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/karchiver
From:       Eric Coquelle <eric.coquelle () gmail ! com>
Date:       2006-09-13 10:38:27
Message-ID: 1158143907.114559.25333.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 583762 by coquelle:

Just a bit of code cleanup


 M  +32 -14    carchiveoperation.cpp  
 M  +7 -2      carchiveoperation.h  


--- trunk/kdenonbeta/karchiver/carchiveoperation.cpp #583761:583762
@@ -875,7 +875,7 @@
   tempdirsfx=tempdir+"Data/";
 }
 
-/** Extract current archive in tempdirsfx */
+/** Creates an sfx archive */
 void CArchiveOperationSfx::makeSfxArchive(QString namesfxarchive=QString::null, int \
type=UNIVERSAL_SFX)  {
   if( archiveobj== NULL )
@@ -884,23 +884,45 @@
     return;
   }
   
+  newarchivename=namesfxarchive;
+  sfxtype=type;
+  
+  extractAllFiles();
+}
+
+/** Extract current archive in tempdirsfx */
+void CArchiveOperationSfx::extractAllFiles()
+{
   QString tmp=NULL;
-  newarchivename=namesfxarchive;
   //We will extract the archive to a temp folder, so let's clean it
   eraseTempDir();
 
   progressbar->reset();
   progressbar->setTotalSteps ( archiveobj->countFiles() );
-  if(type==UNIVERSAL_SFX)
-    connect(archiveobj, SIGNAL(archiveReadEnded()), this, \
                SLOT(slotExtractProcessEnded()));
-  else
-    connect(archiveobj, SIGNAL(archiveReadEnded()), this, SLOT(slotMake7zSfx()));
+  
+  connect(archiveobj, SIGNAL(archiveReadEnded()), this, \
SLOT(slotExtractProcessEnded()));  archiveobj->extractArchive(tempdirsfx,0,tmp);
 }
 
-/** Create the Sfx archive from the files extracted in tempdirsfx */
 void CArchiveOperationSfx::slotExtractProcessEnded()
 {
+  disconnect(archiveobj, SIGNAL(archiveReadEnded()), this, \
SLOT(slotExtractProcessEnded())); +
+   switch(sfxtype)
+   {
+      case SEVENZ_SFX:
+         make7zSfx();
+         break;
+      default:
+      case UNIVERSAL_SFX:
+         makeUniversalSfx();
+         break;
+   }
+}
+
+/** Create an Universal Sfx archive from the files extracted in tempdirsfx */
+void CArchiveOperationSfx::makeUniversalSfx()
+{
   archiveobj->getAllFiles();
   QString baserep;
   QString file;
@@ -909,8 +931,6 @@
   QStringList filestoadd;
   QStringList fileswithpathtoadd;
   
-  disconnect(archiveobj, SIGNAL(archiveReadEnded()), this, \
                SLOT(slotExtractProcessEnded()));
-
   if(newarchivename.isEmpty())
     newarchivename=KFileDialog::getSaveFileName(QDir::homeDirPath(), QString::null, \
0L, i18n("Please give a name to your SelfExtracting archive"));  
@@ -951,7 +971,7 @@
 }
 
 /** Create the 7z Sfx archive from the files extracted in tempdirsfx */
-void CArchiveOperationSfx::slotMake7zSfx()
+void CArchiveOperationSfx::make7zSfx()
 {
   archiveobj->getAllFiles();
   QString baserep;
@@ -961,8 +981,6 @@
   QStringList filestoadd;
   QStringList fileswithpathtoadd;
   
-  disconnect(archiveobj, SIGNAL(archiveReadEnded()), this, SLOT(slotMake7zSfx()));
-
   if(newarchivename.isEmpty())
     newarchivename=KFileDialog::getSaveFileName(QDir::homeDirPath(), QString::null, \
0L, i18n("Please give a name to your SelfExtracting archive"));  
@@ -1056,7 +1074,7 @@
 
 void CArchiveOperationTest::testArchive()
 {
-  makeSfxArchive();//just extract to the temp dir...
+  extractAllFiles();//just extract to the temp dir...
 }
 
 void CArchiveOperationTest::slotExtractProcessEnded()
@@ -1123,7 +1141,7 @@
   if(KStandardDirs::findExe(scanprogramm)==NULL)
     emit(operationEnded(SCAN_ACHIEVED, i18n("Cannot find the anti-virus scanner: \
")+scanprogramm.latin1()));  else
-    makeSfxArchive();//just extract to the temp dir...
+    extractAllFiles();//just extract to the temp dir...
 }
 
 void CArchiveOperationScanForVirus::slotExtractProcessEnded()
--- trunk/kdenonbeta/karchiver/carchiveoperation.h #583761:583762
@@ -258,22 +258,27 @@
   Q_OBJECT
   public:
     CArchiveOperationSfx(CArchive* archive_obj, QProgressBar* progress_bar, QString \
                temp_dir );
-    /** Extract current archive in tempdirsfx */
+    /** Creates an sfx archive */
     void makeSfxArchive(QString, int);
 
   protected:
     /** Catenates an archive to its sfx module */
     void cat();
+    /** Make a Sfx executable file from files extracted in tempdirsfx*/
+    void makeUniversalSfx();
+    void make7zSfx();
+    /** Extract current archive in tempdirsfx */
+    void extractAllFiles();
     
   protected slots:
     /** Create the Sfx archive from the files extracted in tempdirsfx */
     virtual void slotExtractProcessEnded();
     virtual void slotFilesAdded();
-    virtual void slotMake7zSfx();
     virtual void slot7zSfxReady();
     
   private:
     CArchive* sfx_archiveobj;
+    int sfxtype;
   protected:
     QString tempdirsfx;
     QString exearchivename;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic