[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/akonadi/server
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2010-02-28 11:21:03
Message-ID: 1267356063.105278.17899.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1097064 by tokoe:

Port to usage of QDBusServiceWatcher


 M  +15 -11    akonadictl/akonadistarter.cpp  
 M  +1 -1      akonadictl/akonadistarter.h  
 M  +9 -5      src/akonadi.cpp  


--- trunk/kdesupport/akonadi/server/akonadictl/akonadistarter.cpp #1097063:1097064
@@ -21,19 +21,23 @@
 
 #include "../../libs/protocol_p.h"
 
-#include <QCoreApplication>
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
-#include <QDebug>
-#include <QProcess>
-#include <QTimer>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+#include <QtCore/QProcess>
+#include <QtCore/QTimer>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusServiceWatcher>
 
 AkonadiStarter::AkonadiStarter(QObject * parent) :
     QObject( parent ),
     mRegistered( false )
 {
-  connect( QDBusConnection::sessionBus().interface(), \
                SIGNAL(serviceOwnerChanged(QString,QString,QString)),
-           SLOT( serviceOwnerChanged(QString,QString,QString)) );
+  QDBusServiceWatcher *watcher = new QDBusServiceWatcher( QLatin1String( \
AKONADI_DBUS_CONTROL_SERVICE ), +                                                     \
QDBusConnection::sessionBus(), +                                                      \
QDBusServiceWatcher::WatchForOwnerChange, this ); +
+  connect( watcher, SIGNAL( serviceOwnerChanged( const QString&, const QString&, \
const QString& ) ), +           this, SLOT( serviceOwnerChanged( const QString&, \
const QString&, const QString& ) ) );  }
 
 bool AkonadiStarter::start()
@@ -60,11 +64,11 @@
   return true;
 }
 
-void AkonadiStarter::serviceOwnerChanged(const QString & name, const QString & \
oldOwner, const QString & newOwner) +void AkonadiStarter::serviceOwnerChanged( const \
QString&, const QString&, const QString &newOwner )  {
-  Q_UNUSED( oldOwner );
-  if ( name != QLatin1String( AKONADI_DBUS_CONTROL_SERVICE ) || newOwner.isEmpty() )
+  if ( newOwner.isEmpty() )
     return;
+
   mRegistered = true;
   QCoreApplication::instance()->quit();
 }
--- trunk/kdesupport/akonadi/server/akonadictl/akonadistarter.h #1097063:1097064
@@ -29,7 +29,7 @@
     explicit AkonadiStarter( QObject *parent = 0 );
     bool start();
 
-  private slots:
+  private Q_SLOTS:
     void serviceOwnerChanged( const QString &name, const QString &oldOwner, const \
QString &newOwner );  
   private:
--- trunk/kdesupport/akonadi/server/src/akonadi.cpp #1097063:1097064
@@ -42,6 +42,7 @@
 #include <QtCore/QDir>
 #include <QtCore/QSettings>
 #include <QtCore/QTimer>
+#include <QtDBus/QDBusServiceWatcher>
 
 #include <config-akonadi.h>
 #ifdef HAVE_UNISTD_H
@@ -144,9 +145,13 @@
       connectionSettings.setValue( QLatin1String( "DBUS/Address" ), QLatin1String( \
dbusAddress ) );  }
 
-    connect( QDBusConnection::sessionBus().interface(), \
                SIGNAL(serviceOwnerChanged(QString,QString,QString)),
-             SLOT(serviceOwnerChanged(QString,QString,QString)) );
+    QDBusServiceWatcher *watcher = new QDBusServiceWatcher( QLatin1String( \
AKONADI_DBUS_CONTROL_SERVICE ), +                                                     \
QDBusConnection::sessionBus(), +                                                      \
QDBusServiceWatcher::WatchForOwnerChange, this );  
+    connect( watcher, SIGNAL( serviceOwnerChanged( const QString&, const QString&, \
const QString& ) ), +             this, SLOT( serviceOwnerChanged( const QString&, \
const QString&, const QString& ) ) ); +
     // Unhide all the items that are actually hidden.
     // The hidden flag was probably left out after an (abrupt)
     // server quit. We don't attempt to resume preprocessing
@@ -290,10 +295,9 @@
   DbConfig::configuredDatabase()->stopInternalServer();
 }
 
-void AkonadiServer::serviceOwnerChanged(const QString & name, const QString & \
oldOwner, const QString & newOwner) +void AkonadiServer::serviceOwnerChanged( const \
QString&, const QString&, const QString &newOwner )  {
-  Q_UNUSED( oldOwner );
-  if ( name == QLatin1String( AKONADI_DBUS_CONTROL_SERVICE ) && newOwner.isEmpty() ) \
{ +  if ( newOwner.isEmpty() ) {
     akError() << "Control process died, committing suicide!";
     quit();
   }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic