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.
The same holds true for moving messages: When 5 are moved and then Ctrl-Z is pressed, only 4 of them are moved back.
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();
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; }
*** Bug 79712 has been marked as a duplicate of this bug. ***