Bug 302993

Summary: Make Presence plasmoid icons plasma themeable
Product: [Unmaintained] telepathy Reporter: FabiB <plusfabi>
Component: presence-appletAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: ddomenichelli, hrvoje.senjan, kde, mklapetek
Priority: NOR    
Version: 0.4.0   
Target Milestone: Future   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 0.5.2
Sentry Crash Report:
Attachments: telepathy tray icons
telepathy tray icons
plasma-"Air"-like icon for "desktoptheme/THEMENAME/icons/"

Description FabiB 2012-07-04 03:35:38 UTC
Back at work on a new Plasma theme i noticed one thing. I can not change the icon of the ktelepathy tray icon. so at the moment my top bar looks like this: http://i.imgur.com/RjMn8.png thats a bad thing, because we should be able to change the icons with our plasma theme. for all statuses there have to be 6 icons.

The code should be in kopete because i can create a online and offline icon for kopete  and they will be used (but only online and offline). This would be greate :)

Reproducible: Always

Steps to Reproduce:
1.change your plasma theme
2.look at the ktelepathy icon
Actual Results:  
its the same all the time do not integrate in a plasma design

Expected Results:  
should be changeable for plasma-themers
Comment 1 FabiB 2012-07-04 16:18:30 UTC
Created attachment 72322 [details]
telepathy tray icons

for the standard design it would be good to have air-like icons so i made one for all statuses. http://i.imgur.com/ox5Jk.png (left-to-right: online - busy -away - not available - invisible - offline) they should look the same way like all other air icons.
The objectIDs of the elements are
ktp-online
ktp-busy
ktp-away
ktp-n-a
ktp-invisible
ktp-offline

i hope this will help a little (rights and so stuff.. do as you wish :)
Comment 2 Daniele E. Domenichelli 2012-07-08 20:32:52 UTC
Do you have an icon "user-online" in your theme?
Comment 3 FabiB 2012-07-08 20:48:04 UTC
yes the first one on the left is the 'online' (ktp-online) it is not a normal png theme theme. its for a plasma,theme like they are in the most other kde apps, like kmix. not for /usr/share/icons
Comment 4 Daniele E. Domenichelli 2012-07-09 10:02:48 UTC
The icons we use all over kde telepathy for representing the user statuses are:
user-away-extended
user-away
user-busy
user-invisible
user-offline
user-online

Try renaming your icons in your theme and eventually reopen this bug...
Comment 5 FabiB 2012-07-09 14:12:03 UTC
(In reply to comment #4)
> The icons we use all over kde telepathy for representing the user statuses [...]
I know ant thats OK for the contactlist and chatwindow. but this bugreport is not for chance an icon but to support theme based icons so that plasma-theme-designers can change the icon of the tray icon based on the plasma-theme https://kde-look.org/index.php?xcontentmode=76 there are quite a lote apps that support this.

> Try renaming your icons in your theme and eventually reopen this bug...
that will not help. for example if user1 has set 'air' as plasma theme, the icons will be ok, now user2 sets 'caledonia' as theme, wich has his own statusnotifiericons in the plasma theme - ktp will not match. plasma-theme icons are not icon themes for KDE.

i really dont know how I can explain it more ^^'
Comment 6 Daniele E. Domenichelli 2012-07-09 17:28:29 UTC
Sorry, I still don't see the problem...
Comment 7 FabiB 2012-07-09 17:53:06 UTC
Ok from my direktion I create a Plasma theme .. call it "moo". now i want to style the tray icon of klipper so i go to ~/.kde/share/apps/desktoptheme/moo/icons/klipper.svgz and create a layer with the ID "klipper". the same works for kmix,bluedevil,akonadytray,networkmanager , strigitray [...]
after i create all this icons and the backgrounds for my theme "moo" i go the the desktoptheme changer in the systemsettings and chance the theme from air to moo.

with ktp and other applications that dont support tis i have to chance icons in /usr/share/icons that can not be done by the plasma theme and will not only change the tray icons

on the web i found this: http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKStatusNotifierItem.html#a9a48df4020cf548a0250a2ed4f388965
because of mysql loader ( https://kde-apps.org/content/show.php/MySQLoader?content=107750 ) does it the "wrong" way too but has fixed this up in 0.3.6

Maybe he can help in the way to explain xD
Comment 8 Martin Klapetek 2012-07-09 18:16:55 UTC
I agree we need it, I just don't really understand (yet) how it works and what parts go where (eg. what we need to do in order to support it properly).

As for the names - let's keep the presence names the same as in Oxygen theme, so:

ktp-online
ktp-away-extended
ktp-away
ktp-busy
ktp-invisible
ktp-offline

(just change the ktp-n-a)
Comment 9 FabiB 2012-07-09 22:37:09 UTC
Created attachment 72412 [details]
telepathy tray icons

ktp-n-a is now ktp-away-extended
Comment 10 Daniele E. Domenichelli 2012-07-10 11:31:24 UTC
Ok, now I understand... :D
I'm reopening the bug
Comment 11 FabiB 2012-08-19 20:25:00 UTC
you know there is a secound icon that blinks up by new incomming messages. is it possible that you merge this feature in the normal status icon so that we can set just a "new message"-icon for it when there is a new incomming message?
Comment 12 Hrvoje Senjan 2012-10-31 15:00:20 UTC
Presence applet would need to be ported to KStatusNotifierItem:
https://techbase.kde.org/Development/Tutorials/PortToKStatusNotifierItem
Comment 13 Martin Klapetek 2012-10-31 23:41:21 UTC
Was discussed on irc, but for the record - KSNI is unrelevant for our plasmoid; we can't use that. Reminding that the problem is themeable presence icons from Plasma theme.

Might be worth checking Plasma::Theme::findInCache(..) as I assume the icons are in the theme cache, so looking for the icons there makes sense.

First of all we need standardized icon names. There are ktp-* suggested above, but I think we could go more generic. I'd suggest either use the same names as oxygen (these won't clash fwiu) or use the oxygen scheme with -monochrome or -plasma at the end, eg. user-online-monochrome.png or user-online-plasma.png; I don't care for either.
Comment 14 Martin Klapetek 2012-11-01 00:08:12 UTC
I'm putting this task up for Google Code-In, so here are clear instructions on what to do.

Our presence plasmoid uses Plasma::IconWidget for displaying the icons. This IconWidget uses standard icons theme, not those icons provided by a Plasma theme.

1) Research how icons in Plasma themes works 
   1.1) How to load them (look at batter applet, ask at #plasma or bug your mentor)
   1.2) How to find out if the theme provides such icon (hint in comment #13)

2) Make KTp::Presence::icon() method take a struct of "Default, Alternative, Plasma" instead of "bool useImIcons" (make Alternative the same as when useImIcons=true)

3) Make the presence plasmoid use icons from Plasma theme if available, fallback to Oxygen if not (you might need some helper method to check if the theme icons are available). Using the icon is done by passing either "Default" or "Plasma" as the m_globalPresence->currentPresence().icon(..) parameter.

4) Profit.

Use the icons by Fabidesu in comment #9 for testing (but rename them to follow oxygen naming with -plasma suffix, ie. user-online-plasma, user-away-plasma etc).
Comment 15 Hrvoje Senjan 2012-11-01 00:16:30 UTC
(In reply to comment #13)
> Was discussed on irc, but for the record - KSNI is unrelevant for our
> plasmoid; we can't use that. Reminding that the problem is themeable
> presence icons from Plasma theme.
It was my understanding that for plasma themeable icons one needs to use SetIconByName, which is defined in KSNI.
http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails#Theming_Application_Icons_in_the_Systemtray

http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKStatusNotifierItem.html#a9a48df4020cf548a0250a2ed4f388965

 That is off the table then.

> First of all we need standardized icon names. 
Agreed :-)

> There are ktp-* suggested
> above, but I think we could go more generic. I'd suggest either use the same
> names as oxygen (these won't clash fwiu) or use the oxygen scheme with
> -monochrome or -plasma at the end, eg. user-online-monochrome.png or
> user-online-plasma.png; I don't care for either.
We are looking for ability to use svg's loaded from plasma-theme not regular icon themes (png's)
Comment 16 Martin Klapetek 2012-11-30 16:14:31 UTC
Git commit 7383645f8456ef19716cc274c03aa003d9289271 by Martin Klapetek, on behalf of Peter Amidon.
Committed on 30/11/2012 at 17:13.
Pushed by mklapetek into branch 'master'.

Added plasma-themeability to the presence applet.

The presence applet is now plasma-themeable: if a file
icons/presence-applet.{svg,svgz} exists, and it has the correct icon
in it (user-<state>-plasma, like user-offline-plasma), then it will
use that SVG icon instead of the default.

Reviewed-by: Martin Klapetek

M  +14   -2    src/presenceapplet.cpp

http://commits.kde.org/telepathy-presence-applet/7383645f8456ef19716cc274c03aa003d9289271
Comment 17 Daniele E. Domenichelli 2012-11-30 16:32:19 UTC
Git commit dc1aaa2ac66dfc01ac6486a0259ea11793e86942 by Daniele E. Domenichelli, on behalf of Peter Amidon.
Committed on 30/11/2012 at 17:13.
Pushed by ddomenichelli into branch 'kde-telepathy-0.5'.

Added plasma-themeability to the presence applet.

The presence applet is now plasma-themeable: if a file
icons/presence-applet.{svg,svgz} exists, and it has the correct icon
in it (user-<state>-plasma, like user-offline-plasma), then it will
use that SVG icon instead of the default.

Reviewed-by: Martin Klapetek
(cherry picked from commit 7383645f8456ef19716cc274c03aa003d9289271)

M  +14   -2    src/presenceapplet.cpp

http://commits.kde.org/telepathy-presence-applet/dc1aaa2ac66dfc01ac6486a0259ea11793e86942
Comment 18 Hrvoje Senjan 2012-11-30 20:55:34 UTC
Peter (also Martin and Daniele), thanks a lot! ;-)
Comment 19 FabiB 2012-11-30 20:58:17 UTC
yep :) thank you for this
Comment 20 FabiB 2012-12-21 12:30:27 UTC
Created attachment 75959 [details]
plasma-"Air"-like icon for "desktoptheme/THEMENAME/icons/"

a updated Version of the icon. with new "user-*-plasma" name style and new filename