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

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/kio/kio
From:       David Faure <faure () kde ! org>
Date:       2006-03-24 13:29:01
Message-ID: 1143206941.275065.1363.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 522108 by dfaure:

Handle ERR_IDENTICAL_FILES now that kio_file (and its wrappers :) ) emit it. Patch \
                tested by Coolo.
BUG: 123796


 M  +15 -7     job.cpp  


--- branches/KDE/3.5/kdelibs/kio/kio/job.cpp #522107:522108
@@ -2786,7 +2786,7 @@
     {
         m_conflictError = job->error();
         if ( (m_conflictError == ERR_DIR_ALREADY_EXIST)
-             || (m_conflictError == ERR_FILE_ALREADY_EXIST) )
+             || (m_conflictError == ERR_FILE_ALREADY_EXIST) ) // can't happen?
         {
             KURL oldURL = ((SimpleJob*)job)->url();
             // Should we skip automatically ?
@@ -3050,7 +3050,8 @@
             m_conflictError = job->error(); // save for later
             // Existing dest ?
             if ( ( m_conflictError == ERR_FILE_ALREADY_EXIST )
-                 || ( m_conflictError == ERR_DIR_ALREADY_EXIST ) )
+                 || ( m_conflictError == ERR_DIR_ALREADY_EXIST )
+                 || ( m_conflictError == ERR_IDENTICAL_FILES ) )
             {
                 subjobs.remove( job );
                 assert ( subjobs.isEmpty() );
@@ -3132,7 +3133,8 @@
         m_reportTimer->stop();
 
     if ( ( m_conflictError == ERR_FILE_ALREADY_EXIST )
-      || ( m_conflictError == ERR_DIR_ALREADY_EXIST ) )
+         || ( m_conflictError == ERR_DIR_ALREADY_EXIST )
+         || ( m_conflictError == ERR_IDENTICAL_FILES ) )
     {
         // Its modification time:
         time_t destmtime = (time_t)-1;
@@ -3161,6 +3163,7 @@
         // Offer overwrite only if the existing thing is a file
         // If src==dest, use "overwrite-itself"
         RenameDlg_Mode mode;
+        bool isDir = true;
 
         if( m_conflictError == ERR_DIR_ALREADY_EXIST )
             mode = (RenameDlg_Mode) 0;
@@ -3172,6 +3175,7 @@
                 mode = M_OVERWRITE_ITSELF;
             else
                 mode = M_OVERWRITE;
+            isDir = false;
         }
 
 	if ( m_bSingleFileCopy )
@@ -3179,7 +3183,7 @@
 	else
             mode = (RenameDlg_Mode) ( mode | M_MULTI | M_SKIP );
 
-        res = Observer::self()->open_RenameDlg( this, m_conflictError == \
ERR_FILE_ALREADY_EXIST ? +        res = Observer::self()->open_RenameDlg( this, \
                !isDir ?
                                 i18n("File Already Exists") : i18n("Already Exists \
as Folder"),  (*it).uSource.url(),
                                 (*it).uDest.url(),
@@ -3602,7 +3606,9 @@
         // In that case it's the _same_ dir, we don't want to copy+del (data loss!)
         if ( m_currentSrcURL.isLocalFile() && m_currentSrcURL.url(-1) != \
dest.url(-1) &&  m_currentSrcURL.url(-1).lower() == dest.url(-1).lower() &&
-             ( err == ERR_FILE_ALREADY_EXIST || err == ERR_DIR_ALREADY_EXIST ) )
+             ( err == ERR_FILE_ALREADY_EXIST ||
+               err == ERR_DIR_ALREADY_EXIST ||
+               err == ERR_IDENTICAL_FILES ) )
         {
             kdDebug(7007) << "Couldn't rename directly, dest already exists. \
Detected special case of lower/uppercase renaming in same dir, try with 2 rename \
calls" << endl;  QCString _src( QFile::encodeName(m_currentSrcURL.path()) );
@@ -3643,7 +3649,9 @@
         Q_ASSERT( m_currentSrcURL == *m_currentStatSrc );
 
         // Existing dest?
-        if ( ( err == ERR_DIR_ALREADY_EXIST || err == ERR_FILE_ALREADY_EXIST )
+        if ( ( err == ERR_DIR_ALREADY_EXIST ||
+               err == ERR_FILE_ALREADY_EXIST ||
+               err == ERR_IDENTICAL_FILES )
              && isInteractive() )
         {
             if (m_reportTimer)
@@ -3693,7 +3701,7 @@
 
                 RenameDlg_Result r = Observer::self()->open_RenameDlg(
                     this,
-                    err == ERR_FILE_ALREADY_EXIST ? i18n("File Already Exists") : \
i18n("Already Exists as Folder"), +                    err != ERR_DIR_ALREADY_EXIST ? \
i18n("File Already Exists") : i18n("Already Exists as Folder"),  \
m_currentSrcURL.url(),  dest.url(),
                     mode, newPath,


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

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