Bug 88532 - after deleting single message: undo not working
Summary: after deleting single message: undo not working
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.7
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 79712 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-31 14:29 UTC by Wilbert Berendsen
Modified: 2007-09-14 12:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Berendsen 2004-08-31 14:29:40 UTC
Version:           1.7 (using KDE 3.3.0, compiled sources)
Compiler:          gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.8-gentoo

To reproduce:

1. start Kontact/KMail
2. delete one message from a folder (Del)
3. press undo (Ctrl-Z): BUG: a dialog pops up "There is nothing to undo"

When 2 messages are selected and deleted (actually: moved to trash), KMail only restores one of them on undo. When 3 are selected and deleted, KMail restores two, etc.
Comment 1 Wilbert Berendsen 2004-09-01 17:57:49 UTC
The same holds true for moving messages:

When 5 are moved and then Ctrl-Z is pressed, only 4 of them are moved back.
Comment 2 earlgrey 2004-09-03 07:56:58 UTC
Does completeMove(OK) in slotMsgAddedToDestFolder [kmcommands.cpp] close the folder, resulting in unGetMsg( mDestFolder->count() - 1 ) failing ?
something like this would work, but there are probably better ways.

Index: kmcommands.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmcommands.cpp,v
retrieving revision 1.164
diff -u -p -b -B -r1.164 kmcommands.cpp
--- kmcommands.cpp  29 Aug 2004 11:41:39 -0000  1.164
+++ kmcommands.cpp  3 Sep 2004 05:52:32 -0000
@@ -1813,6 +1813,9 @@ KMCommand::Result KMMoveCommand::execute
     if ( !mDestFolder ) {
       completeMove( OK );
     }
+    if ( mDestFolder && !rc && (mDestFolder->folderType() != KMFolderTypeImap) ) {
+      completeMove( OK );
+    }
   }

   return OK;
@@ -1851,7 +1854,7 @@ void KMMoveCommand::slotMsgAddedToDestFo
     if (mDestFolder && mDestFolder->folderType() != KMFolderTypeImap) {
       mDestFolder->sync();
     }
-    completeMove( OK );
+    //completeMove( OK );
   } else {
     mProgressItem->incCompletedItems();
     mProgressItem->updateProgress();


Comment 3 Till Adam 2004-09-11 18:05:35 UTC
CVS commit by tilladam: 

Folder refcounting correctness fixes.

CCMAIL: 88532-done@bugs.kde.org

@earl grey: thanks, that was the right idea


  M +5 -0      kmcommands.cpp   1.169


--- kdepim/kmail/kmcommands.cpp  #1.168:1.169
@@ -1639,7 +1639,9 @@ KMCommand::Result KMCopyCommand::execute
       } else {
         int rc, index;
+        mDestFolder->open();
         rc = mDestFolder->addMsg(newMsg, &index);
         if (rc == 0 && index != -1)
           mDestFolder->unGetMsg( mDestFolder->count() - 1 );
+        mDestFolder->close();
       }
     }
@@ -1764,4 +1766,5 @@ KMCommand::Result KMMoveCommand::execute
       } else {
         // We are moving to a local folder.
+        mDestFolder->open();
         rc = mDestFolder->moveMsg(msg, &index);
         if (rc == 0 && index != -1) {
@@ -1773,8 +1776,10 @@ KMCommand::Result KMMoveCommand::execute
             kmkernel->undoStack()->addMsgToAction( undoId, mb->getMsgSerNum() );
           }
+          mDestFolder->close();
         } else if (rc != 0) {
           // Something  went wrong. Stop processing here, it is likely that the
           // other moves would fail as well.
           completeMove( Failed );
+          mDestFolder->close();
           return Failed;
         }


Comment 4 Tom Albers 2004-09-15 10:00:06 UTC
*** Bug 79712 has been marked as a duplicate of this bug. ***