KGpg patch to improve kde compliance & spare code

bj at altern.org bj at altern.org
Sun Nov 16 18:22:01 GMT 2003


I just realized that you can make a nice file overwrite dialog with 
KIO::RenameDlg. KGpg previously used its own dialog to ask for file 
overwrite.  Applying this simple patch in 3 files in KGpg would allow to 
delete KGpg's custom overwrite dialog (kgpgfast.cpp and kgpgfast.h), making 
KGpg more KDE compliant and thus remove about 150 lines of code.

The i18n string "File Already Exists" is already present in KGpg's po file

Is it ok to commit ?



Index: kgpg/kgpglibrary.cpp
===================================================================
RCS file: /home/kde/kdeutils/kgpg/kgpglibrary.cpp,v
retrieving revision 1.19
diff -u -3 -p -r1.19 kgpglibrary.cpp
--- kgpg/kgpglibrary.cpp	23 Sep 2003 19:47:11 -0000	1.19
+++ kgpg/kgpglibrary.cpp	16 Nov 2003 17:14:32 -0000
@@ -80,11 +80,14 @@ void KgpgLibrary::fastencode(KURL &fileT
         QFile fgpg(dest.path());
 
         if (fgpg.exists()) {
-                KgpgOverwrite *over=new KgpgOverwrite(0,"overwrite",dest);
-                if (over->exec()==QDialog::Accepted)
-                        dest.setFileName(over->getfname());
-                else
-                        return;
+			KIO::RenameDlg *over=new KIO::RenameDlg(0,i18n("File Already 
Exists"),QString::null,dest.path(),KIO::M_OVERWRITE);
+		    	if (over->exec()==QDialog::Rejected)
+	    		{
+                	delete over;
+                	return;
+            		}
+	    		dest=over->newDestURL();
+	    		delete over;
         }
 
         KgpgInterface *cryptFileProcess=new KgpgInterface();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031116/9bdd4037/attachment.sig>


More information about the kde-core-devel mailing list