Bug 122946 - Export won't overwrite existing files; doesn't prompt
Summary: Export won't overwrite existing files; doesn't prompt
Status: RESOLVED FIXED
Alias: None
Product: kwalletmanager
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-02 00:59 UTC by Tristan Miller
Modified: 2006-07-26 23:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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);
+		}
 	}
 }