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

List:       kfm-devel
Subject:    Confirm when renaming
From:       Michael Reiher <michael.reiher () gmx ! de>
Date:       1999-08-17 21:22:25
[Download RAW message or body]

Hi all,

Today I accidently overwrote a file when renaming anotherone to the same
name. Fortunately it was not an important one. But I thought a warning
dialog would be in place here. I attached a patch. The strings are
completely recycled from existing translations so this shouldn´t be a
problem. 
Any objections if I apply it?

Greets

Michael
 
-- 
Michael Reiher  
     Student at Dresden University of Technology
          Department of Computer Science
               email: michael.reiher@gmx.de
["kfm.diff" (text/plain)]

Index: kfmprops.cpp
===================================================================
RCS file: /home/kde/kdebase/kfm/Attic/kfmprops.cpp,v
retrieving revision 1.68.4.5
diff -u -r1.68.4.5 kfmprops.cpp
--- kfmprops.cpp	1999/03/29 21:05:31	1.68.4.5
+++ kfmprops.cpp	1999/08/17 21:02:21
@@ -378,11 +378,21 @@
 	  // It's a directory, so strip the trailing slash (in case it's a
           // symlink)
 	  path.truncate( path.length() - 1);
-	if ( rename( path, s ) != 0 ) {
+	
+	int ret = 0;
+	if ( QFile::exists( s ) ) {
+            QString tmp = i18n("You try to overwrite");
+            tmp += " :\n";
+            tmp += s;
+            ret = QMessageBox::warning( this, i18n("KFM Warning"), tmp,
+                                      i18n("Continue"), i18n("Cancel") );
+        }
+        if( ret == 0 )
+	  if ( rename( path, s ) != 0 ) {
             QString tmp;
             tmp.sprintf(i18n("Could not rename the file or directory\n%s\n"), strerror(errno));
             QMessageBox::warning( this, klocale->translate( "KFM Error" ), tmp );
-        }
+          }
 	properties->emitPropertiesChanged( n );
     }
 }


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

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