Bug 86281 - Kmail tray not updating properly
Summary: Kmail tray not updating properly
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 87510 96933 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-07-30 07:21 UTC by David M. Butler
Modified: 2007-09-14 12:17 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Correctly update kmail systray by calling foldersChanged (320 bytes, patch)
2005-03-15 16:48 UTC, Wilco
Details
Patch to fix the systray icon updating correctly (1.26 KB, patch)
2005-04-18 21:05 UTC, Rich Birch
Details
A fix without side effects (650 bytes, patch)
2005-04-20 00:53 UTC, Rich Birch
Details
Modified version of last patch (773 bytes, patch)
2005-04-23 10:37 UTC, Rich Birch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David M. Butler 2004-07-30 07:21:16 UTC
Version:            (using KDE KDE 3.2.92)
Installed from:    Gentoo Packages
Compiler:          GCC 3.3.3 
OS:                Linux

I have kmail set up with two different IMAP accounts.  When mail comes in for my second account, it behaves as normal (the tray updates to the number of unread messages instantly).  It doesn't seem to update properly for my primary account though.  The icon remains unchanged until I click on it.  As soon as I do that (when there are unread messages) it updates and the kmail window opens with the unread messages already waiting.  It appears as though kmail is correctly checking and updating my inbox, but not the tray icon.  

I've checked all the settings, and they seem to be exactly the same between the two accounts, aside from the login information.  Both are being checked on a regular interval, etc.

Expected behavior: Tray icon should update for all IMAP accounts, or allow the user to specify which inbox to report.
Comment 1 David M. Butler 2004-07-30 07:22:56 UTC
As I apparently missed the field for it, this is kmail version 1.6.82.

Comment 2 Karsten Künne 2004-08-16 23:37:20 UTC
It's still the same behavior in KDE 3.3RC2. I leave kmail running all the time and it updates it's new message count correctly but the systray icon is only updated if I either click on the first unread message or click on the icon to minimize kmail and then click again to restore it.

In case it helps this was working correctly in KDE 3.2.3, it's broken in 3.3RC2.
Comment 3 Joerg de la Haye 2004-08-27 13:48:24 UTC
I can confirm this, look at my comment at Bug 87510.
Comment 4 Karsten Künne 2004-09-07 18:26:23 UTC
An update to the bug. I use KDE 3.3 now with two imap accounts and I noticed the following. If I select the inbox of one of the accounts the tray icon shows the number of unread messages in the OTHER account's inbox (and updates it accordingly). If I select the other account's inbox it correctly shows and updates the number of unread messages in the FIRST account's inbox. Now, if I select some other folder (for instance the inbox from "Local Folders" which is empty) it shows and updates the number of unread messages from BOTH accounts correctly! I hope this gives a clue to the developers. It looks as if the calculation of unread messages for the tray icon doesn't include the currently open folder or something like that.
Comment 5 Szokovacs Robert 2004-09-10 13:12:48 UTC
I think I'm seeing the same bug, but with one IMAP account. My experience is that if I have an IMAP folder open (I have several), the new mails arriving into that folder are excluded from the number shown on the tray icon.
Comment 6 Allan Beaufour 2004-09-20 14:59:21 UTC
I have exactly the same problem... KDE 3.3, SuSE RPMS, 2 (s)IMAP accounts.
Comment 7 Wilco 2004-10-23 15:35:26 UTC
Same problem here. More general, a folder is not updated in the tray when that folder has the focus in kmail.
Comment 8 Gintautas Miliauskas 2004-11-07 23:45:23 UTC
Funny, I see an opposite (in a way) problem, but it is a bit unrelated.  The tray icon shows the number of unread mails in one particular folder for a second when the icon is clicked, before the main window is restored (i.e., icon shows 51 (correctly), I click the icon, the icon shows 2 while the the window is being restored, the icon shows 51 again).
Comment 9 S. Burmeister 2004-11-08 00:30:54 UTC
I can confirm comment 8. In my case the tray icon shows the number of unread messages in the inbox only and not all unread messages. This happens only for a second after I clicked the systray icon.
Comment 10 Ryan Olf 2004-11-13 03:32:39 UTC
*** This bug has been confirmed by popular vote. ***
Comment 11 Till Adam 2004-11-13 10:49:34 UTC
*** Bug 87510 has been marked as a duplicate of this bug. ***
Comment 12 Wilco 2005-03-15 16:48:36 UTC
Created attachment 10132 [details]
Correctly update kmail systray by calling foldersChanged
Comment 13 Wilco 2005-03-15 16:52:48 UTC
I added a patch which will call "foldersChanged()" to update the tray icon.
When new mail arrives at a folder which has focus (see my previous comment) it's not updated in the tray. When opening KMail the tray icon is updated just fine so we need to fake "foldersChanged" too just as is done in "showKMail()"
Comment 14 Till Adam 2005-03-28 11:59:54 UTC
Wilco, I assume your patch fixes things for you? Can anyone else try the patch and confirm, please? 
Comment 15 Wilco 2005-03-28 12:06:47 UTC
Well I was a little premature submitting the patch. The tray icon now flashes spastically sometimes or sometimes crashes. I think the problem is not inside the tray code.
Comment 16 Joerg de la Haye 2005-03-29 16:14:43 UTC
Problem still exists in KDE 3.4 (KMail 1.8). As said before, it worked without any problems before KDE 3.3.
Comment 17 Rich Birch 2005-04-18 21:05:00 UTC
Created attachment 10701 [details]
Patch to fix the systray icon updating correctly

I think this patch should fix this issue now. Basically
imapFolder->processNewMail() is not currently being called if the folder is
being viewed (selected). The patch fixes this behaviour and my tray icon now
updates correctly.

Let's have some testers please, and hopefully this bug can be closed.
Comment 18 Rich Birch 2005-04-18 21:32:37 UTC
The patch seems to cause the unread numbers to not be updated when a message becomes read. I hope to have a new patch soon. Bare with me :)
Comment 19 Rich Birch 2005-04-20 00:53:17 UTC
Created attachment 10713 [details]
A fix without side effects

The root of the problem seemed to be that a 'numUnreadMsgsChanged' was not
being emitted because of the code not calling processNewMail() for the folder
that's currently being viewed. The new patch adds an emit in the code that gets
executed for the currently viewed folder.

Again, testers welcome :) (This time I'm more certain there are no side
effects)
Comment 20 Rich Birch 2005-04-23 10:37:12 UTC
Created attachment 10763 [details]
Modified version of last patch

Fixes tray icon's unread message count not updating properly
Comment 21 Rich Birch 2005-04-23 10:41:17 UTC
Above patch committed last night. Having to manually close bug coz my cvs skills are obviously not totally mastered yet :)
Comment 22 Joerg de la Haye 2005-06-15 13:26:31 UTC
The bug isn't fixed for me, is this patch already included in KDE 3.4.1?

I'm using KMail 1.8.1 with KDE 3.4.1, and the problem still exists. As Wilco said in Comment #7, it only occurs if the focus is on the folder where new mail arrives. If the focus is on another folder, e.g. "sent mails", the tray is updated correctly. Sound notification works even if the inbox folder has the focus.
Comment 23 Wilco 2005-06-15 14:24:13 UTC
Well Joerg,
I noticed the patch from Rich Birch isn't included in the new Kmail so you could manually try to patch it, if you're compiling from source.
Comment 24 Heinrich Wendel 2005-06-15 17:43:37 UTC
please backport this patch to 3.4.2
Comment 25 Carsten Burghardt 2005-06-17 15:41:50 UTC
*** Bug 96933 has been marked as a duplicate of this bug. ***
Comment 26 Heinrich Wendel 2005-06-18 00:30:26 UTC
ok another problem here with attachement #10763, the tray is updated correctly but sometimes the folders don't show any new message count until i fetch new messages again. attachement #10713 works fine though
Comment 27 Wilco 2005-08-04 10:34:15 UTC
I can confirm attachment #10763 [details] works fine for me. Too bad it hasn't been included in 3.4.2 already