Bug 305614 - contactlist does not detect Presence widget in the panel
Summary: contactlist does not detect Presence widget in the panel
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unmaintained
Component: contactlist (show other bugs)
Version: 0.4.0
Platform: Ubuntu Linux
: NOR minor
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-22 16:21 UTC by Ivan D Vasin
Modified: 2012-10-30 05:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.6.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan D Vasin 2012-08-22 16:21:14 UTC
i have an Instant Messaging Presence widget in my Plasma panel.  when i close the Telepathy Contact List, it shows a warning dialog with this message:

You do not have any other presence controls active (a Presence widget for example).
Do you want to stay online or would you rather go offline?

in case it's relevant, i originally had a Presence widget on the desktop.  i later added one to the panel and removed the one on the desktop.  that's when this issue started occurring.

Reproducible: Always

Steps to Reproduce:
1. add an Instant Messaging Presence widget to a Plasma panel.
2. open the Telepathy Contact List.
3. close the contact list.
Actual Results:  
a warning dialog is shown as described above.

Expected Results:  
the contact list closes quietly, letting the Presence widget continue to serve as a presence control.
Comment 1 David Edmundson 2012-08-22 16:25:07 UTC
This doesn't occur for everyone (not me anyway) so we need some more information in order to reproduce it.

Do you still have this occur after a restart of plasma?

If you run:
qdbus org.kde.Telepathy.PresenceAppletActive 

from a konsole do you get lots of output or do you see the line
"Service 'org.kde.Telepathy.PresenceAppletActive' does not exist"?
Comment 2 Ivan D Vasin 2012-08-22 16:53:18 UTC
``qdbus org.kde.Telepathy.PresenceAppletActive`` tells me that the service doesn't exist.

killing and re-running plasma-desktop seems to work as a workaround.  after doing that, the qdbus command lists various paths, and the contact list closes quietly.
Comment 3 David Edmundson 2012-08-22 17:39:27 UTC
It's not about finding a workaround it's about finding exactly where the bug is.

To reproduce:
 - add two presence widgets
 - remove the first one

Service is not registered.

Fairly minor bug as it's hard to produce accidentally and will fix itself when you next restart, but it does highlight a bug that we will face later.

The reason it breaks is that when the second applet is constructed the call to 
QDBusConnection::sessionBus().registerService("org.kde.Telepathy.PresenceAppletActive");
does nothing as the service is already registered.

There is an alternate way of registering services that queues the services, which means the second one will take over when the first one is deleted. We should switch to this.
http://qt-project.org/doc/qt-4.8/qdbusconnectioninterface.html#registerService

Alternately, we make m_dbusExporter static + ref counted, thus shared between all instances of plasmoids.

I prefer the first solution, as it allows for anything to claim to be a presence provider and the contact list won't show the message/disconnect. Such as if we mixed presence control into the contact list applet for example.

This was discussed with Will Thompson (of main Telepathy fame) once, and we had an idea to have an org.freedesktop.Telepathy.PresenceProvider which would always be registered as a queued service. When the service unregistered MC would kill all connections itself. Providing a universal way to disconnect everything when all UI controls disappeared. AFAIK nothing materialised from this, and I've not chased it up since
Comment 4 David Edmundson 2012-10-30 04:16:46 UTC
Git commit 41ee6f3933fcf6b4cdae1bbaebda18ac86b33df1 by David Edmundson.
Committed on 26/10/2012 at 07:23.
Pushed by davidedmundson into branch 'master'.

Remove DbusExporter class, only register service name.  Ref count usages to know when to remove.

This simplifies code and removes a bug in which if you add two plasmoids, then remove the first one, we no longer appear to be running.
REVIEW: 107046

M  +10   -5    src/presenceapplet.cpp
M  +3    -14   src/presenceapplet.h

http://commits.kde.org/telepathy-presence-applet/41ee6f3933fcf6b4cdae1bbaebda18ac86b33df1