Bug 377521

Summary: regression: system tray icon no longer shows number of new mails
Product: [Applications] kmail2 Reporter: Martin Koller <kollix>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: dav1dblunk3tt, eric.brunet, groszdanielpub, jjm, kde.bugs, kde, kdudka, montel, rdieter, thilo
Priority: NOR    
Version: Git (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=377485
Latest Commit: Version Fixed In:
Attachments: patch to reenable numbers
patch to reenable numbers, v17.08.3
patch to reenable numbers, v17.12.0
patch to reenable numbers, v18.04.3
patch to reenable numbers, v18.12
patch to reenable numbers, v19.04
patch to reenable numbers, v21.08.3

Description Martin Koller 2017-03-12 12:32:45 UTC
I hope this change is not intentional.
Previous versions did show the number, current 5.4.3 no longer does.
I just see a mail icon with a star on it but no count of new mails.
This was pretty helpful
(and compared to akregator, I usually have less than 5 new unread mails, so a readable number can be displayed without problem)
Comment 1 Laurent Montel 2017-03-12 13:20:29 UTC
hi
it's intentional and I will not re-add it.
Same answer that I gave in akregator
Regards
Comment 2 Martin Koller 2017-03-12 14:55:56 UTC
As I wrote, I can understand why you removed it in akregator, since there is usually a large number of unread articles.

However, this is not true for mails (at least how I use it).

If you see the problem with not being able to read a large number, what about the following idea:
Display the number if its less than 100, else do not display it.

Would you agree with such a patch ?
Comment 3 Laurent Montel 2017-03-12 15:04:28 UTC
nope.
After that a user will report me a bug because we can't see number in some case.

Regards
Comment 4 Martin Koller 2017-03-12 15:20:57 UTC
Then what about an option whether to include the number display or not ?
The option makes it obvious if the user wants it or not.
Comment 5 Laurent Montel 2017-03-12 18:55:35 UTC
nope 
I worked to reduce config so I removed it.
Sorry but I will not readd it.

Regards
Comment 6 Éric Brunet 2017-05-02 11:50:08 UTC
Please, would you reconsider your decision ? I have just upgraded my fedora 23 into a fedora 25, and had the bad surprise to see that the number of unread emails was gone in the system tray icon.

Having this number of emails displayed was a useful feature. I thought it was a configuration bug and I spent a long time trying to re-enable it, and then I have seen this bug. (I thought of a configuration bug because the icon when there are no unread mail is the simple breeze envelope outline, while the icon when there are unread mails is a solid white envelope with shading and a yellow star. I understand the yellow star, but why does the envelope changes ?)

People choose kde over gnome for its flexibility and configurability. Your users are not afraid of an extra config option!

Thanks anyway for all the work.
Comment 7 Éric Brunet 2017-05-22 07:24:40 UTC
Created attachment 105670 [details]
patch to reenable numbers

patch against kmail 16.12.3 to re-enable showing number of unread emails in systray
Comment 8 Éric Brunet 2017-05-22 07:31:37 UTC
This is the patch I have been using for two weeks to re-enable nulbers in systray. It works fine. It is against kmail 16.12.3, which is the version shipped by fedora 25.

It is not a simple revert of the feature removal: the displayed was small and ugly. The reason is that kmail sends a pixmap of size 32x32 which is scaled down by systray to 22x22 (in standard theme). I am not sure how to ask the theme what the correct icon size should be. I think the problem is also present in the unpatched kmail.

Please? You could put me in the loop and I would answer bug reports about this?
Comment 9 Éric Brunet 2017-12-22 21:50:46 UTC
Created attachment 109488 [details]
patch to reenable numbers, v17.08.3

This is an updated version of my patch to re-enable numbers in the tray icon for kmail. It is for kmail version 5.6.3 shipped with kde 17.08.3, as found in fedora 27.

I have also a version for the kmail that shipped with fedora 26 that I forgot to post here. Contact me if anyone needs it.
Comment 10 Kamil Dudka 2018-01-03 13:09:33 UTC
Comment on attachment 109488 [details]
patch to reenable numbers, v17.08.3

Works perfectly.  Thanks for sharing!
Comment 11 Éric Brunet 2018-01-07 11:09:41 UTC
Created attachment 109722 [details]
patch to reenable numbers, v17.12.0

Hi Kamil, I am happy this is useful to someone. I'll post updated patches in a more timely way.

Here is the patch to re-enable numbers for kmail 5.7.0, as found in kde 17.12.0,
as shipped by the latest fedora 27 updates
Comment 12 Éric Brunet 2018-01-27 10:21:12 UTC
The patch for 17.12.0 also applies to 17.12.1 witho no modification, the version that appeared this week in fedora 27.
Comment 13 Jonathan Marten 2018-01-28 14:39:38 UTC
*** Bug 389407 has been marked as a duplicate of this bug. ***
Comment 14 Jonathan Marten 2018-01-28 14:40:56 UTC
*** Bug 279279 has been marked as a duplicate of this bug. ***
Comment 15 davidblunkett 2018-01-28 15:24:12 UTC
I see that this "bug" is an intentional change:

Please change it back, it is a useful and valuable feature and the loss is a significant lowering in usability.

Just make it an option - having read the threads back I can see no good reason note to fix this (only reason given is, "I'm not fixing it, so there").

I note there is also a patch available - please make this mainstream ASAP.
Comment 16 Kamil Dudka 2018-01-29 07:51:13 UTC
The only reason was incompetence of a single person who happened to have commit access to the upstream kmail repository.  For me it is not a big deal to fix it locally when there is a working patch available.  Unfortunately, it might be a showstopper for non-technical users of kmail.
Comment 17 Christoph Feck 2018-01-30 00:13:40 UTC
According to https://phabricator.kde.org/D9841 Plasma developers contributed a 'unread email count' to the KMail launcher icon when pinned to taskbar. This isn't a complete replacement, but the systray number display had several issues, including, but not limited to, color readability and HiDPI scaling.
Comment 18 Kamil Dudka 2018-01-30 07:42:34 UTC
(In reply to Christoph Feck from comment #17)
> but the systray number display had
> several issues, including, but not limited to, color readability and HiDPI
> scaling.

See comment #10.  Attachment #109488 [details] works perfectly for me.  If somebody has
issues with that feature, nobody forces him/her to have it enabled.  AFAIK it
has always been optional.
Comment 19 Éric Brunet 2018-01-30 17:44:12 UTC
It would be great to re-enable for everybody the number of unread mails on the icon. This is such an obvious feature! When I look at my phone, I have the number of missed calls, the number of SMS and the number of emails on the icons of the respective apps.

I am not sure what as the problem with High dpi displays, but I did run into a difficulty when writing the patch: kmail needs to know the size of the icon. It obtains a size with 

             const int overlaySize = IconSize(KIconLoader::Panel);

but it is not the correct size. I don't know what is the correct way of querying plasma to obtain the size of the icons in the SystemTray. But I am sure it is possible and that the High dpi case can be fixed. If needed, I am willing to help, and I am also willing to answer bug reports for this feature.
Comment 20 Christophe Marin 2018-01-30 19:03:37 UTC
(In reply to Kamil Dudka from comment #16)
> The only reason was incompetence of a single person who happened to have
> commit access to the upstream kmail repository. 

The KDE Code of Conduct also applies to Redhat employees: https://www.kde.org/code-of-conduct/
Comment 21 Éric Brunet 2018-02-22 09:14:14 UTC
The patch for 17.12.0 also applies to 17.12.2 which has just been shiped by fedora.
Comment 22 davidblunkett 2018-03-01 16:41:02 UTC
I see a problem
I see a patch
I see "resolved wontfix"

What is the status here? Is this patch accepted or is this remaining unfixed?
Comment 23 Éric Brunet 2018-09-13 21:16:50 UTC
Created attachment 114942 [details]
patch to reenable numbers, v18.04.3

This is an updated version of my patch to re-enable numbers in the tray icon for kmail. It is for kmail version 5.8.3 shipped with kde 18.04.3, as found in fedora 28.

As I have already said, if this is rolled back into kmail, I am willing to answer bug reports regarding this feature. I think it should be rolled back; kmail must be the only graphical mail reader without this feature...
Comment 24 davidblunkett 2018-09-24 07:12:50 UTC
> As I have already said, if this is rolled back into kmail, I am willing to
> answer bug reports regarding this feature. I think it should be rolled back;
> kmail must be the only graphical mail reader without this feature...

Thanks - I'd very much like to see this back-ported
Comment 25 Kamil Dudka 2019-03-21 14:08:11 UTC
Comment on attachment 114942 [details]
patch to reenable numbers, v18.04.3

I am not able to compile kmail-18.12.3 with this patch against up2date qt.  The build fails with this error:

/var/tmp/paludis/kde-apps-kmail-18.12.3/work/kmail-18.12.3/src/kmsystemtray.cpp: In member function 'void KMail::KMSystemTray::updateCount(int)':
/var/tmp/paludis/kde-apps-kmail-18.12.3/work/kmail-18.12.3/src/kmsystemtray.cpp:175:31: error: 'class QFontMetrics' has no member named 'width'; did you mean 'maxWidth'?
         const int width = qfm.width(count < 100 ? QStringLiteral("99")
                               ^~~~~
                               maxWidth

I was able to google up a page saying that QFontMetrics::width() is obsolete:

    https://doc.qt.io/qt-5/qfontmetrics-obsolete.html

... but the page does not suggest any replacement for that method.

Any idea how to make it build again?
Comment 26 Éric Brunet 2019-03-21 15:23:26 UTC
Created attachment 118961 [details]
patch to reenable numbers, v18.12

Sorry, I was slow with updating this patch.

The method horizontalAdvance seems to replace nicely the method width. Probably that they changed it because "width" was so difficult to remember...
Comment 27 Kamil Dudka 2019-03-21 15:48:07 UTC
Comment on attachment 118961 [details]
patch to reenable numbers, v18.12

Works perfectly.  Thanks for the quick fix!
Comment 28 Christoph Feck 2019-03-21 18:45:17 UTC
The name was replaced because it was wrong. It didn't return the width, but the number of pixels the cursor advances.

If you wanted the width, you had to use boundingRect().width().
Comment 29 Éric Brunet 2019-06-24 09:33:43 UTC
Created attachment 121110 [details]
patch to reenable numbers, v19.04

Updated version of the patch to re-enable numbers in systray for kmail.
Comment 30 Kamil Dudka 2020-03-21 08:29:34 UTC
I just discovered that #include <kiconloader.h> needs to be added to src/kmsystemtray.cpp when compiling kmail-19.12.3 with the attached patch.
Comment 31 Jonathan Marten 2020-12-28 21:47:32 UTC
*** Bug 430915 has been marked as a duplicate of this bug. ***
Comment 32 davidblunkett 2021-01-05 20:53:43 UTC
Is the patch shipping? or is this bug still current? I can't see a fix in 5.13...
Comment 33 Kamil Dudka 2022-02-19 21:10:22 UTC
Created attachment 146946 [details]
patch to reenable numbers, v21.08.3
Comment 34 Dmitri Koulikoff 2022-02-20 12:36:07 UTC
I need this patch too to be implemented for all.
Comment 35 Thilo Molitor 2023-08-03 17:11:12 UTC
It's really a shame that this wonderful client lacks such a vital feature :(

I did a patch series against different stable releases of debian, based on the wonderful work of Éric Brunet.
The patches can be found on github over here: https://github.com/tmolitor-stud-tu/debian-patches/tree/master/kmail-systray-number

I'll publish new patches every time I update my system to a newer kmail version.