[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-14 12:57:42
Message-ID: 1158238662.951968.4405.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 584338 by coquelle:

Changed: when an archive is dropped window, check if the compressor is installed onto \
the system.  If no, inform the user and prompt for an action


 M  +17 -15    carchiveoperation.cpp  
 M  +4 -1      carchiveoperation.h  
 M  +2 -0      cchoixfichier.cpp  
 M  +46 -47    cchoixfichier.h  
 M  +1 -1      karchiveur.cpp  


--- trunk/kdenonbeta/karchiver/carchiveoperation.cpp #584337:584338
@@ -52,6 +52,7 @@
   archiveobj=archive_obj;
   progressbar=progress_bar;
   kindofCompressor=UNKNOWN;
+  errormsgnocompressor=i18n("Compressor not available");
 }
 
 CArchiveOperation::CArchiveOperation( QObject * parent , const char * name ): \
QObject(parent, name) @@ -87,18 +88,16 @@
     CArchiveChoice identifyArchive;
     identifyArchive.setArchiveName(archivename);
 
-    if(identifyArchive.findKindOfCompressor()!=0)
+    if(identifyArchive.findKindOfCompressor()==UNKNOWN)
     {
         return i18n("Unknown archive type");
     }
     else if(!identifyArchive.isCurrentCompressorAvaible())
     {
-        return i18n("Compressor not available");
+        return errormsgnocompressor;
     }
     
     kindofCompressor=identifyArchive.getKindOfCompressor();
-    if(kindofCompressor==UNKNOWN)
-      return i18n("Unsupported compressor");
     
     return NULL;
 }
@@ -260,8 +259,6 @@
   extractedfileslist=directory.entryList();
   for (QStringList::Iterator f = extractedfileslist.begin(); \
f!=extractedfileslist.end(); ++f )  {
-  ///REMOVEME
-  kdDebug()<<QString("Convert %1 to %2: added \
%3").arg(previousarchivename).arg(newarchivetype).arg(*f)<<endl;  if( \
!(*f).startsWith(".") && !(*f).startsWith("..") )  filesofnewarchive.append(*f);
   }
@@ -1211,7 +1208,6 @@
    QString namefichselect;
    QString basedir;
    QString repbasetmp;
-   QListViewItem *li;
    int typescript;
 
   QString str;
@@ -1671,8 +1667,20 @@
   if((strlistWithPath.count()==1) && (archiveobj==NULL))
   {
      newarchivename=archivename=strlistWithPath.first();
-     if( !checkCanIdentifyArchive(archivename).isNull() )
+     errormessage=checkCanIdentifyArchive(archivename);
+     if(errormessage.isNull())
      {
+        //We have dropped an archive, so open it!
+        if( canProcessDisplayArchive( archivename ) )
+          return;
+     }
+     else if(errormessage == errormsgnocompressor)
+     {
+      //The dropped file is an archive, but the required compressor is not installed
+      KMessageBox::error(0, errormsgnocompressor);
+     }
+     else
+     {
        //We have dropped one file; so create archivename from it.
        newarchivename=archivename+=preferedtype;
        kdDebug()<<QString("Will create an archive from this file: \
%1").arg(archivename)<<endl; @@ -1688,17 +1696,10 @@
        }
        else
        {
-        KMessageBox::error(0, i18n("Cannot perform operation, exiting") + "\n" + \
errormessage, errormessage);  emit operationEnded(idmessageerror, archivename);
         return;
        }
      }
-     else
-     {
-        //We have dropped an archive, so open it!
-        if( canProcessDisplayArchive( archivename ) )
-          return;
-     }
   }
   
   //Ask what to do...
@@ -1793,6 +1794,7 @@
 bool CArchiveOperationProcessInputFiles::canProcessDisplayArchive(QString& \
archivename)  {
 kdDebug()<<QString("Trying to display %1").arg(archivename)<<endl;
+KMessageBox::information(0, QString("Trying to display \
%1").arg(archivename));//REMOVE  if(archiveobj!=NULL)
     {
       //An archive is already loaded, so try to open this one in a new window
--- trunk/kdenonbeta/karchiver/carchiveoperation.h #584337:584338
@@ -68,7 +68,7 @@
   virtual void processPastedFiles( QStringList , bool) {};
   virtual void mailCurrentArchive() {};
   virtual void launchWizard(QListViewItem*) {};
-  virtual void doCuttUnCutt(QString, int blocksize=1450000 ) {};
+  virtual void doCuttUnCutt(QString, int =1450000 ) {};
   
   signals:
     void operationEnded(int, QString);
@@ -86,7 +86,10 @@
     QProgressBar* progressbar;
     QString newarchivename;
     int kindofCompressor;
+    /* the extension of current compressor */
     QString extension;
+    /* error messages returned by checkCanIdentifyArchive - here required compressor \
not installed */ +    QString errormsgnocompressor;
 };
 
 
--- trunk/kdenonbeta/karchiver/cchoixfichier.cpp #584337:584338
@@ -77,6 +77,8 @@
 }
 
 
+/** Finds which compressor is required to read currentarchive 
+  * returns UNKNOWN if format is not supported, 0 otherwise */
 int CArchiveChoice::findKindOfCompressor()
 {
   QString archive;
--- trunk/kdenonbeta/karchiver/cchoixfichier.h #584337:584338
@@ -32,53 +32,52 @@
 {
 	Q_OBJECT
 public: 
-	CArchiveChoice(QWidget *parent=0, const char *name=0);
-	~CArchiveChoice();
-	
-	/* Open a dialog and return the file's name */
-	QString openArchive();
-	/** Analyse the suffix and set progrcompresseur to: tar, gzip, bzip2, unzip, unrar, \
                lha
-	 * return value: 0 if archive is valid, 1 else
-	 **/
-	int findKindOfCompressor();
-	/* Return the option for compressing files*/
-	QString getCompresseur();
-	/* return the option for uncompressing files */
-	QString getUncompressor();
-	/* return the option for reading archive */
-	QString getReader();
-	/* return the archive's name (with full path) */
-	QString getArchiveName();
-	/* return the compressor's name */
-	QString getProgrCompresseur();
-	/* Get any special option for the compressor */
-	QString getOptionSupp();
-	void initialise();
-	/* return the option for adding files to an archive */
-	QString getConcateneur();
-	/* Define the archive's name */
-	void setArchiveName(QString);
-	/** Set the acess path when opening an archive */
-	void setFullPath( QString path);
-	/** return the directory's path of the opened file */
-	QString getAccessPath();
-	/** Define the default path when opening a file
-	    0: Last dir
-	    1: home dir
-	    2: shell's one */
-	void setFullPath(QString path, int optionOpening);
-	/** returns the exact compressor type */
-	int getKindOfCompressor();
-	/** Define the default path when opening a file
-	 * 0: Last dir
-	 * 1: home dir
-		* 2: shell's one */
-	void setOptionOpening(int optionOuverture);
-	/** return the directory of the current archive */
-	QString getCurrentArchiveDirectory();
-	/** We store somewhere an oldpath variable,
-	 * used to know what is the last open dir */
-	void setForInitPreviousPath( QString path );
+  CArchiveChoice(QWidget *parent=0, const char *name=0);
+  ~CArchiveChoice();
+  
+  /* Open a dialog and return the file's name */
+  QString openArchive();
+  /** Finds which compressor is required to read currentarchive 
+  * returns UNKNOWN if format is not supported, 0 otherwise */
+  int findKindOfCompressor();
+  /* Return the option for compressing files*/
+  QString getCompresseur();
+  /* return the option for uncompressing files */
+  QString getUncompressor();
+  /* return the option for reading archive */
+  QString getReader();
+  /* return the archive's name (with full path) */
+  QString getArchiveName();
+  /* return the compressor's name */
+  QString getProgrCompresseur();
+  /* Get any special option for the compressor */
+  QString getOptionSupp();
+  void initialise();
+  /* return the option for adding files to an archive */
+  QString getConcateneur();
+  /* Define the archive's name */
+  void setArchiveName(QString);
+  /** Set the acess path when opening an archive */
+  void setFullPath( QString path);
+  /** return the directory's path of the opened file */
+  QString getAccessPath();
+  /** Define the default path when opening a file
+      0: Last dir
+      1: home dir
+      2: shell's one */
+  void setFullPath(QString path, int optionOpening);
+  /** returns the exact compressor type */
+  int getKindOfCompressor();
+  /** Define the default path when opening a file
+    * 0: Last dir
+    * 1: home dir
+          * 2: shell's one */
+  void setOptionOpening(int optionOuverture);
+  /** return the directory of the current archive */
+  QString getCurrentArchiveDirectory();
+  /** We store somewhere an oldpath variable,
+    * used to know what is the last open dir */
+  void setForInitPreviousPath( QString path );
   /** Return true if the compressor that'll be used is installed on disk */
   bool isCurrentCompressorAvaible();
   /** check which compressors are available */
--- trunk/kdenonbeta/karchiver/karchiveur.cpp #584337:584338
@@ -1370,7 +1370,7 @@
   archiveoperation = new  CArchiveOperationProcessInputFiles( archiveobj,  progress, \
preferedArchiveType, includewholepath,  ADD_AND_REPLACE_FILES );  \
connect(archiveoperation, SIGNAL(operationEnded(int, QString)), this, \
SLOT(slotMessageArchiveOperation(int , QString )));  enableMenus(false);
-  archiveoperation->processPastedFiles(strliste, viewbydirectories);  
+  archiveoperation->processPastedFiles(strliste, viewbydirectories);
 }
 
 /** The user try to copy a karchiveur's file to


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

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