Bug 294991

Summary: open/close (show/hide) contactlist from presence applet
Product: [Unmaintained] telepathy Reporter: kavol <kavol>
Component: presence-appletAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: ddomenichelli, fraph24, heri+kde, kde, kde, lamarque, marcus.moeller, matej, mklapetek, nicklkde, post, rad.n, szo
Priority: NOR    
Version: git-latest   
Target Milestone: 0.6.0   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 0.6.0
Sentry Crash Report:

Description kavol 2012-02-28 12:15:35 UTC
Version:           0.3 (using KDE 4.8.0) 
OS:                Linux

I'd like to see a behaviour similar to psi or other IM programs - when the program's icon is docked in the tray, you can left-click it to open main window/contactlist, and left-click it again to hide it.

Currently, the "open contactlist" function is implemented via the right-click context menu, but
1) it cannot be configured as a default for left-click (in fact, left-click does nothing right now)
2) there is no "hide contactlist" option

Reproducible: Always

Steps to Reproduce:
1. add ktp-presence-applet to system tray
2. left-click the presence applet icon
3. left-click the presence applet icon
4. right-click the presence applet icon
5. choose Seznam kontaktů ("contact list"?) from the popup menu
6. right-click the presence applet icon
7. choose Skrýt seznam kontaktů ("hide contact list"?) from the popup menu

Actual Results:  
2. no action
3. no action
5. ktp-contactlist window appears
7. can't be done, no such option exists, ktp-contaclist window can't be hidden this way

Expected Results:  
2. ktp-contactlist window appears
3. ktp-contactlist window disappears
5. ktp-contactlist window appears
7. ktp-contactlist window disappears

* note also that if the contaclist is opened this way, it'd be nice if the window would NOT show in the window list on the panel, as it is already represented by the tray icon (although that is just a view of the user logic, and in reality the icon belongs to another program)

in this case, results in step 2 could look like:

2a) if the contactlist window is on another desktop then switch to that desktop
2b) if the contactlist window is hidden then bring it to top
2c) if the contactlist window is visible - both 2a) and 2b) was untrue - then make it disappear

* also note that this behaviour should be configurable - however, I see the abovementioned scenario as a sane default ;-)
Comment 1 kavol 2012-02-28 13:45:17 UTC
note that it is the same with standalone presence applet on the panel, not just with the systray icon
Comment 2 kavol 2012-02-28 14:01:05 UTC
(In reply to comment #0)
> 1) it cannot be configured as a default for left-click (in fact, left-click
> does nothing right now)

ahem, actually, it can, sorry

- I was looking in a wrong place (systemsettings)
Comment 3 David Edmundson 2012-02-28 17:31:50 UTC
We can maybe make it an option to show/hide, but I'm not sure your suggestion is a "sane default", I imagine it would appears as "clicking it does something completely random each time".
Comment 4 Radek Novacek 2012-02-29 08:31:36 UTC
David,

a lot of instant messaging applications have the same behaviour. Many users that are migrating from Kopete to ktp are used to it. I believe it would be more like "expected" then "random" behaviour.

It would be even better if the keyboard shortcut for the widget would work the same - press it to show contact list (or move it on top, to another desktop) and press it again when the window is active to hide it.
Comment 5 Ahmad Samir 2012-02-29 17:17:11 UTC
(In reply to comment #4)
> David,
> 
> a lot of instant messaging applications have the same behaviour. 

(If I may add, along with various other applications that have a system tray icon, BitTorrent clients (e.g. ktorrent, qbittorrent, transmission), IRC clients (e.g. Konversation, Quassel), media players (e.g. smplayer, gnome-mplayer, vlc), so such behaviour is well known/understood by users).
Comment 6 David Edmundson 2012-03-15 15:10:49 UTC
*** Bug 295785 has been marked as a duplicate of this bug. ***
Comment 7 Daniele E. Domenichelli 2012-03-19 17:41:21 UTC
To close the window you can just call the quit() method in the org.kde.ktp-contactlist service /MainApplication object org.kde.KApplication interface if the service exists on dbus, otherwise start it, and it's actually quite easy to do. The problem is that hiding/showing is different from starting closing an application, it's slower (models are reloaded, etc), you don't get the animations (so the user won't realise that the window is closed) and i'm not sure if the status of the window is restored exactly as it was before closing. I'm not really sure if this is a good idea, but I'm not against it, if this isn't the default behaviour and someone wants to do it...

I'm marking it as a Junior Job, because the implementation should be quite trivial
Comment 8 David Edmundson 2012-03-19 18:12:52 UTC
I'm not sure this is a junior job. The coding may be simple, but getting a patch that I disagree with past me isn't easy at all :)

What you suggested doesn't handle this whole notion of behaving differently if it's on a different virtual desktop, or activity. With what you just said, you'll end up just closing it if it's on a different desktop - and depending on settings you'll just respawn it on a different desktop when you click on it too.

This turns into a right pain, and I'm not even sure we want it. Not every comment on bugzilla is actually sensible, and on this I just can't decide at all. A working demo would maybe sway me, but that would be really disheartening for a JJ person's first patch if it doesn't.
Comment 9 Martin Klapetek 2012-03-19 19:07:03 UTC
I would maybe suggest to actually delay/close it and integrate it with the plasma/qml contact list.

Thoughts?
Comment 10 nickl 2012-07-12 18:54:42 UTC
Why not just making a function that calls either start() (I mean the method that activates the contact list) or quit() (I mean the method that hides the contact list) methods depending on a flag that indicates if the list is active or not? Any button would just check on this flag and change its state, accordingly to what that button is made to do.....
Comment 11 Martin Klapetek 2012-07-13 15:00:04 UTC
I did just this and will post for review over the weekend.
Comment 12 Martin Klapetek 2012-12-25 20:15:23 UTC
*** Bug 312199 has been marked as a duplicate of this bug. ***
Comment 13 Dennis Schridde 2013-01-04 17:19:41 UTC
(In reply to comment #11)
> I did just this and will post for review over the weekend.
Did anything happen with this? When I click the presence icon in the systray while the contact list is open, it still does not close. (Telepathy/KDE 0.5.1)
Comment 14 Martin Klapetek 2013-01-04 18:27:51 UTC
Nope. We went back and forth with it, discussed different ideas etc. and it got nowhere. Right now (all) the plasmoids are being moved, so I'll fix this after the weekend when all is in the new place.
Comment 15 Sander Lepik 2013-03-04 18:29:52 UTC
This is one bug that is stopping me to move over to telepathy. I hope it will be implemented soon. :)
Comment 16 Szokovacs Robert 2013-03-12 16:51:00 UTC
I think the desirable behaviour would be the same as the kopete works: 
1, if the window is hidden, show it
2, if the window is shown and on the same screen, hide it
3, if the window is shown and not on the same screen, switch to the screen containing the window

(alternatively, 3 can be bring the window to the current screen)
Comment 17 Martin Klapetek 2013-03-20 12:33:48 UTC
Git commit 4316858b1d897a00c334d9ed846c8dc3e99b2172 by Martin Klapetek.
Committed on 20/03/2013 at 13:31.
Pushed by mklapetek into branch 'master'.

Add small D-Bus interface to bring the window forward or close

This is now used from the presence plasmoid, if the contact list
is running, it calls the toggleWindowVisibility() and decides
itself if it should bring the window forward or be closed.

REVIEW: 109600

M  +10   -0    main-widget.cpp
M  +4    -0    main-widget.h

http://commits.kde.org/telepathy-contact-list/4316858b1d897a00c334d9ed846c8dc3e99b2172
Comment 18 Martin Klapetek 2013-03-21 10:06:33 UTC
Git commit 5b609fe8d5d14fd4fa17f3475d00deadea59dc98 by Martin Klapetek.
Committed on 21/03/2013 at 11:02.
Pushed by mklapetek into branch 'master'.

Open & close contact list when clicking the presence plasmoid

If the contact list is opened already, it will be given focus and made
an active window. If it's active window, it will close. If it's not
running, it will be started.

REVIEW: 109599
FIXED-IN: 0.6.0

M  +62   -5    presence/src/presence-applet.cpp
M  +8    -1    presence/src/presence-applet.h

http://commits.kde.org/telepathy-contact-applet/5b609fe8d5d14fd4fa17f3475d00deadea59dc98
Comment 19 Matěj Laitl 2013-03-21 10:09:56 UTC
Great, thanks! This was the last ktp regression over Kopete I've faced.