Bug 122946

Summary: Export won't overwrite existing files; doesn't prompt
Product: [Applications] kwalletmanager Reporter: Tristan Miller <psychonaut>
Component: generalAssignee: George Staikos <staikos>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Tristan Miller 2006-03-02 00:59:32 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    SuSE RPMs

If you attempt to XML-export a wallet with File->Export… and then select or type a filename which already exists, KWalletmanager will not overwrite the file, but does not give any warning or error message.  KWalletmanager should instead open a dialog window asking if the user wishes to overwrite the file.
Comment 1 Tobias Knieper 2006-07-25 11:48:47 UTC
I can confirm using KDE 3.5.3 from debian packages. This does also happen when using "Save as.." instead of export.
Comment 2 George Staikos 2006-07-26 23:06:50 UTC
SVN commit 566720 by staikos:

prompt and allow overwrite
can someone forward port this to trunk?
BUG: 122946


 M  +10 -1     kwalleteditor.cpp  


--- branches/KDE/3.5/kdeutils/kwallet/kwalleteditor.cpp #566719:566720
@@ -1104,7 +1104,16 @@
 	KURL url = KFileDialog::getSaveURL(QString::null, "*.xml", this);
 
 	if (!url.isEmpty()) {
-		KIO::NetAccess::file_copy(tf.name(), url, 0600, false, false, this);
+		bool ok = true;
+		if (KIO::NetAccess::exists(url, false, this)) {
+			int rc = KMessageBox::warningContinueCancel(this, i18n("The file '%1' already exists. Would you like to overwrite this file?").arg(url.prettyURL()), i18n("Overwrite"));
+			if (rc == KMessageBox::Cancel) {
+				ok = false;
+			}
+		}
+		if (ok) {
+			KIO::NetAccess::file_copy(tf.name(), url, 0600, true, false, this);
+		}
 	}
 }