On Sat, May 29, 2010 at 5:50 PM, Sebastian Trüg <[email protected]> wrote:

> Very nice. But since you are already on it: why not connect to
> serviceUnregistered instead of serviceOwnerChanged?
>
>
Yea. Why didn't I? It's the most obvious thing. Weird.

Can I commit it directly to kdesupport/soprano or will you have to do that?

- Vishesh Handa


> Cheers,
> Sebastian
>
> On 05/29/2010 12:37 PM, Vishesh Handa wrote:
> > The use of old method emits a small warning which had been bugging me.
> >
> > - Vishesh Handa
> >
> >
> >
> > _______________________________________________
> > Nepomuk mailing list
> > [email protected]
> > https://mail.kde.org/mailman/listinfo/nepomuk
>
Index: server/dbus/dbusexportiterator.cpp
===================================================================
--- server/dbus/dbusexportiterator.cpp	(revision 1131719)
+++ server/dbus/dbusexportiterator.cpp	(working copy)
@@ -30,6 +30,7 @@
 #include "queryresultiterator.h"
 
 #include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusServiceWatcher>
 
 
 class Soprano::Server::DBusExportIterator::Private
@@ -38,9 +39,13 @@ public:
     Private( DBusExportIterator* parent )
         : deleteOnClose( false ),
           q( parent ) {
+            
+        serviceWatcher.setConnection( QDBusConnection::sessionBus() );
+        connect( &serviceWatcher, SIGNAL(serviceUnregistered( QString ) ) ,
+                 q, SLOT( slotServiceUnregistered( QString ) ) );
     }
 
-    void slotServiceOwnerChanged( const QString& name, const QString&, const QString& );
+    void slotServiceUnregistered( const QString& name );
 
     StatementIterator statementIterator;
     NodeIterator nodeIterator;
@@ -51,12 +56,14 @@ public:
     QString dbusObjectPath;
     QString dbusClient;
 
+    QDBusServiceWatcher serviceWatcher;
+
 private:
     DBusExportIterator* q;
 };
 
 
-void Soprano::Server::DBusExportIterator::Private::slotServiceOwnerChanged( const QString& name, const QString&, const QString& )
+void Soprano::Server::DBusExportIterator::Private::slotServiceUnregistered( const QString& name )
 {
     if ( name == dbusClient ) {
         if ( statementIterator.isValid() ) {
@@ -151,9 +158,7 @@ bool Soprano::Server::DBusExportIterator
     }
 
     if( QDBusConnection::sessionBus().registerObject( dbusObjectPath, this ) ) {
-        connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(const QString&, const QString&, const QString&)),
-                 this, SLOT(slotServiceOwnerChanged(const QString&, const QString&, const QString&)) );
-
+        d->serviceWatcher.addWatchedService( dbusClient );
         d->dbusObjectPath = dbusObjectPath;
         d->dbusClient = dbusClient;
         return true;
@@ -169,8 +174,7 @@ bool Soprano::Server::DBusExportIterator
 
 void Soprano::Server::DBusExportIterator::unregisterIterator()
 {
-    disconnect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(const QString&, const QString&, const QString&)),
-                this, SLOT(slotServiceOwnerChanged(const QString&, const QString&, const QString&)) );
+    d->serviceWatcher.removeWatchedService( d->dbusClient );
     d->dbusObjectPath = QString();
     d->dbusClient = QString();
     QDBusConnection::sessionBus().unregisterObject( d->dbusObjectPath );
Index: server/dbus/dbusexportiterator.h
===================================================================
--- server/dbus/dbusexportiterator.h	(revision 1131719)
+++ server/dbus/dbusexportiterator.h	(working copy)
@@ -157,7 +157,7 @@ namespace Soprano {
             class Private;
             Private* const d;
 
-            Q_PRIVATE_SLOT( d, void slotServiceOwnerChanged( const QString& name, const QString&, const QString& ) )
+            Q_PRIVATE_SLOT( d, void slotServiceUnregistered( const QString& name ) )
         };
     }
 }
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk

Reply via email to