Bug 108523

Summary: "empty trash" sometimes stays inactive
Product: [Applications] kmail Reporter: Maciej J . Woloszyk <matofesi>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: update "empty trash" menu to reflect trash status

Description Maciej J . Woloszyk 2005-07-04 08:27:28 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Gentoo Packages

I use message filtering with kmail and I have some filters that put messages received with POP3 directly into trash. When I receive mail and open trash I can see some messages and then use context menu to empty trash - everything is fine to this point. After emptying trash "empty trash" in context menu deactivates as there should be no messages in trash to remove. But then I receive messages from another account - this is some information eccount and all of its messages are filtered into trash. After that when I try to empty trash again (trash folder is the one that is opened for all the time) the "empty trash" in context menu is inactive - kmail didn't noticed that some messages have been put into trash using filters.
Comment 1 Maciej J . Woloszyk 2005-10-09 17:40:46 UTC
I've just found out exactly when the "empty trash" stays disabled with some mail in trash. The problem occurs when the trash is empty and you select the trash - "empty trash" is disabled. If then you receive some mail that is filterd directly to trash, trash contains some mail but "empty trash" is still disabled - it looks like filtering should notify rest of kmail that it put some mails into trash.

And BTW I currently use KDE 3.5 beta 1.
Comment 2 Maciej J . Woloszyk 2006-04-10 09:50:48 UTC
And to make sure the report doesn't got forgotten - the same behaviour is still present in KDE 3.5.2. To confirm it you just need to create a filter in kmail that moves some incoming mail into trash and mark it as read (I'm not sure if the last part is necessary), then select trash folder, make sure it's empty, select another folder then trash again ("empty trash" in context menu shoud be inactive) and then download some mail that would be filtered directly to trash - even though trash contains some mail the "empty trash" stays inactive auntil you select another folder and then trash again.
Comment 3 Maciej J . Woloszyk 2006-04-10 15:25:44 UTC
Created attachment 15543 [details]
update "empty trash" menu to reflect trash status

Ok. I did some ugly hacking and I think I can show the rough idea of what I
would like to be done "the proper way" (probably somewhere in asynchroneous
kmail mechanisms after messages really got deleted). For now the patch works
fine for me - it calls updateFolderMenu() after fetching mail making sure
everyting is updated even after filtering. To make things work properly it also
disables mEmptyFolderAction in slotEmptyFolder. Now I can have messages
filtered directly to trash that is selected and I the "Empty trash" menu
changes it's state depending on the trash status (and it also works for "Move
all to trash").
Comment 4 Maciej J . Woloszyk 2006-06-05 17:16:36 UTC
Just installed KDE 3.5.3 - bug is still there :(
Comment 5 Maciej J . Woloszyk 2006-08-07 08:36:58 UTC
Just installed KDE 3.5.4 - bug is still there :( 
Comment 6 Maciej J . Woloszyk 2006-10-16 09:42:27 UTC
Just to let anyone (?) reading (??) this - 3.5.5 installed with bug still there.
Comment 7 Allen Winter 2006-10-16 22:56:53 UTC
SVN commit 596184 by winterz:

Fix Bug 108523: "empty trash" sometimes stays inactive.
Patch provided by Maciej J . Woloszyk.  Thanks Maciej!
Patch approved by Ingo.

BUGS: 108523


 M  +8 -0      kmmainwidget.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmmainwidget.cpp #596183:596184
@@ -846,6 +846,10 @@
     }
   }
 
+  // update folder menus in case some mail got filtered to trash/current folder
+  // and we can enable "empty trash/move all to trash" action etc.
+  updateFolderMenu();
+
   if ( !showNotification )
     return;
 
@@ -1013,6 +1017,10 @@
     BroadcastStatus::instance()->setStatusMsg(i18n("Moved all messages to the trash"));
 
   updateMessageActions();
+
+  // Disable empty trash/move all to trash action - we've just deleted/moved all folder
+  // contents.
+  mEmptyFolderAction->setEnabled( false );
 }