[KMSystemTray] Expose unread email count via Unity launcher API
ClosedPublic

Authored by broulik on Jan 12 2018, 9:45 AM.

Details

Summary

This will show the number of unread emails in the Task Manager.

Test Plan

It watches for the service come and go, so it will survive Plasma restarts
Number is updated fine when I mark an email as read or get new ones
Works even when KMail has no window open but resides in system tray but you have it pinned to your task bar (see screenshot)



With a saner amount of unread email

Diff Detail

Repository
R206 KMail
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Jan 12 2018, 9:45 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptJan 12 2018, 9:45 AM
broulik requested review of this revision.Jan 12 2018, 9:45 AM
broulik updated this revision to Diff 25212.Jan 12 2018, 9:56 AM

Fix object path

mlaurent requested changes to this revision.Jan 12 2018, 10:18 AM
mlaurent added a subscriber: mlaurent.

I removed systemtray number as it was impossible to see number when icon was too small.
So you will readd same problem.
and it's a specific code for ubuntu, it will not work on opensuse and co.

src/kmsystemtray.h
81

nullptr

This revision now requires changes to proceed.Jan 12 2018, 10:18 AM

I removed systemtray number as it was impossible to see number when icon was too small.

There was no limit in the number it showed in system tray and it painted the icon manually breaking with themes and what not; this patch does not make any assumption on the representation. It will just say "I have this number 12345" and then the view (e.g. Task Manager in Plasma) can make sure it doesn't get super tiny, which Plasma mostly does. It limits the number to 9999 and if the panel is too tiny won't show it at all.

and it's a specific code for ubuntu, it will not work on opensuse and co.

It's just DBus signals. Plasma also provides this service for two years now and it will work on any distro running Plasma, note how the screenshots show Plasmashell, not Unity.

src/kmsystemtray.h
81

I didn't because I initialize it in the constructor, but can do.

I saw that it's just dbus signal but it will not initialize if we don't have "com.canonical.Unity" as service no ?
I don't think that opensuse, arch etc have it no ?
if it works on all distro no problem for me.

I like the idea as it's plasma which manages number it's good but it will not fix general problem for all distro if we need to have this service no ?
I don't want to told to user that "it's fixed we have number in taskbar but you need to install an other distro"

I saw that it's just dbus signal but it will not initialize if we don't have "com.canonical.Unity" as service no ?
I don't think that opensuse, arch etc have it no ?
if it works on all distro no problem for me.

https://cgit.kde.org/plasma-desktop.git/tree/applets/taskmanager/plugin/smartlaunchers/smartlauncherbackend.cpp#n54

This is Plasma's task manager implementation. When you have plasmashell running, it will register the service, no matter what distro you're using, it does not depend on libunity or anything like that.

mlaurent accepted this revision.Jan 12 2018, 11:16 AM

Oh you named it as "unity" but doesn't depend against it... ok wierd but ok.

if it works on all distro no problem.

> +2 (but initialize QDBusServiceWatcher *mUnityServiceWatcher to nullptr in header before commiting)

This revision is now accepted and ready to land.Jan 12 2018, 11:16 AM

Oh you named it as "unity" but doesn't depend against it..

Because it's using the Unity API ;) in Plasma it's "smart launchers" but I don't find that much of an improvement

This revision was automatically updated to reflect the committed changes.