[kdepim] [Bug 323636] New: Save As overwrites file when choosing rename

Albert Astals Cid aacid at kde.org
Sat Aug 17 14:57:13 BST 2013


https://bugs.kde.org/show_bug.cgi?id=323636

            Bug ID: 323636
           Summary: Save As overwrites file when choosing rename
    Classification: Unclassified
           Product: kdepim
           Version: unspecified
          Platform: unspecified
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: messageviewer
          Assignee: kdepim-bugs at kde.org
          Reporter: aacid at kde.org
                CC: montel at kde.org

How to reproduce:
 * Get a mail with an attachment named Q
 * Right click on the attachment and choose save as
 * Go to a folder where you have a file named Q
 * Press Save
 * Get a dialog "there's already a file named Q"
 * Now you're going to loose your file named Q
 * Press "rename"
 * The file you had named Q is overwritten

It could be fixed by doing this

diff --git a/messageviewer/utils/util.cpp b/messageviewer/utils/util.cpp
index 18717d4..c0448e6 100644
--- a/messageviewer/utils/util.cpp
+++ b/messageviewer/utils/util.cpp
@@ -272,7 +272,7 @@ bool Util::saveContents( QWidget *parent, const
QList<KMime::Content*> &contents
       if( !(result == PimCommon::RenameFileDialog::RENAMEFILE_OVERWRITEALL ||
               result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL ))
       {
-          if ( KIO::NetAccess::exists( curUrl,
KIO::NetAccess::DestinationSide, parent ) ) {
+          while ( KIO::NetAccess::exists( curUrl,
KIO::NetAccess::DestinationSide, parent ) ) {
               if ( contents.count() == 1 ) {
                   PimCommon::RenameFileDialog *dlg = new
PimCommon::RenameFileDialog(curUrl,false, parent);
                   result =
static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dlg->exec());


But probably should be fixed inside RenameFileDialog itself since there are
more users like kaddressbook/ that also seem to assume that the file they get
out of RenameFileDialog is good to go.

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list