I've done the kdelibs/nepomuk/ResourceManager class. I'd appreciate it if
someone could verify it, as I encountered some errors. The procedure I used
for testing was -
$ nepomukserver
$ qdbus org.kde.NepomukStorage /servicecontrol shutdown
$ qdbus org.kde.NepomukServer /nepomukserver quit

On shutting down the NepomukStorage I got a couple of errors like -
*"nepomukservicestub(8670)"
Error in thread 3077588736 : "org.freedesktop.DBus.Error.ServiceUnknown -
The name org.kde.nepomuk.services.nepomukstorage was not provided by any
.service files"*. And on shutting down the *NepomukServer* the *
nepomukservicestub* would *always* crash. But these errors are consistent as
they appear both before and after the patch. :-)

Otherwise, the patch works fine. I'll do the rest during the weekend.

- Vishesh Handa

On Fri, Mar 26, 2010 at 11:56 PM, Aaron J. Seigo <[email protected]> wrote:

> On March 26, 2010, Sebastian Trüg wrote:
> > (for the future please use the new nepomuk mailing list hosted at kde:
> > https://mail.kde.org/mailman/listinfo/nepomuk)
>
> oops, sorry :)
>
> > I am aware of the necessary changes. And I would be happy, too if "one
> > of the nepomukians will be willing". ;)
> > In the end it will probably be me... I suppose I need tutoring when it
> > comes to delegation of work... any takers? :P
>
> the good news is that it's really simple work, made simpler if you know why
> the service is being watched in the first place (so you can decide whether
> to
> stick with a serviceOwnerChanged signal, though from QDBusServiceWatcher,
> or
> to move to serviceRegistered and/or serviceUnregistered signals).
>
> so if someone is looking for an easy thing to do (or to get started with)
> that
> will have a real impact on performance, this is your chance :)
>
> --
> Aaron J. Seigo
> humru othro a kohnu se
> GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
>
> KDE core developer sponsored by Qt Development Frameworks
> _______________________________________________
> Nepomuk mailing list
> [email protected]
> https://mail.kde.org/mailman/listinfo/nepomuk
>
Index: resourcemanager_p.h
===================================================================
--- resourcemanager_p.h	(revision 1111072)
+++ resourcemanager_p.h	(working copy)
@@ -120,7 +120,7 @@
         QList<ResourceData*> allResourceDataWithProperty( const QUrl& _uri, const Variant& v );
 
         void _k_storageServiceInitialized( bool );
-        void _k_dbusServiceOwnerChanged( const QString& name, const QString& oldOwner, const QString& newOwner );
+        void _k_dbusServiceUnregistered( const QString& serviceName );
 
     private:
         QUrl m_mainContext;
Index: resourcemanager.cpp
===================================================================
--- resourcemanager.cpp	(revision 1111072)
+++ resourcemanager.cpp	(working copy)
@@ -45,6 +45,7 @@
 #include <QtCore/QUuid>
 #include <QtDBus/QDBusConnection>
 #include <QtDBus/QDBusConnectionInterface>
+#include <QtDBus/QDBusServiceWatcher>
 
 using namespace Soprano;
 
@@ -241,10 +242,9 @@
 }
 
 
-void Nepomuk::ResourceManagerPrivate::_k_dbusServiceOwnerChanged( const QString& name, const QString&, const QString& newOwner )
+void Nepomuk::ResourceManagerPrivate::_k_dbusServiceUnregistered( const QString& serviceName )
 {
-    if( name == QLatin1String("org.kde.NepomukStorage") &&
-        newOwner.isEmpty() ) {
+    if( serviceName == QLatin1String("org.kde.NepomukStorage") ) {
         kDebug() << "Nepomuk Storage service went down.";
         emit m_manager->nepomukSystemStopped();
     }
@@ -270,10 +270,14 @@
                                            this,
                                            SLOT(_k_storageServiceInitialized(bool)) );
 
-    // connect to the ownerChanged signal to be able to connect the nepomukSystemStopped
+    // connect to the serviceUnregistered signal to be able to connect the nepomukSystemStopped
     // signal once the storage service goes away
-    connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString, QString, QString)),
-             this, SLOT(_k_dbusServiceOwnerChanged(QString, QString, QString)) );
+    QDBusServiceWatcher *watcher = new QDBusServiceWatcher( QLatin1String("org.kde.NepomukStorage"),
+                                                            QDBusConnection::sessionBus(),
+                                                            QDBusServiceWatcher::WatchForUnregistration,
+                                                            this );
+    connect( watcher, SIGNAL(serviceUnregistered(QString)),
+             this, SLOT(_k_dbusServiceUnregistered(QString)) );
 
     init();
 }
Index: resourcemanager.h
===================================================================
--- resourcemanager.h	(revision 1111072)
+++ resourcemanager.h	(working copy)
@@ -259,7 +259,7 @@
         ResourceManagerPrivate* const d;
 
         Q_PRIVATE_SLOT( d, void _k_storageServiceInitialized(bool) )
-        Q_PRIVATE_SLOT( d, void _k_dbusServiceOwnerChanged(QString, QString, QString) )
+        Q_PRIVATE_SLOT( d, void _k_dbusServiceUnregistered(QString) )
     };
 }
 
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk

Reply via email to