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

List:       kde-commits
Subject:    branches/work/~bukovac/dbustest
From:       Roman Bukovac <r.bukovac () freenet ! de>
Date:       2008-04-08 14:35:55
Message-ID: 1207665355.127486.2863.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 794754 by bukovac:



 M  +14 -1     client/client.cpp  
 M  +5 -1      server/main.cpp  


--- branches/work/~bukovac/dbustest/client/client.cpp #794753:794754
@@ -18,9 +18,22 @@
 
 	roman::DBusServer dserv( "roman.DBusServer", "/DBusServer", QDBusConnection::sessionBus() );
 
+	if (dserv.isValid())
+		qDebug() << "Interface is valid";
+	else
+		qDebug() << "Interface is not valid";
+
 	dserv.write("test");
 	QDBusReply<QString> reply = dserv.read();
-	qDebug() << reply;
 
+	if(!reply.isValid())
+	{
+		QDBusError error = reply.error();
+		qDebug() << "DBus Error:" << error.type() << ":" << error.message();
+		return 3;
+	}
+	else
+		qDebug() << reply.value();
+
 	return 0;
 }
--- branches/work/~bukovac/dbustest/server/main.cpp #794753:794754
@@ -1,5 +1,6 @@
 #include <QtCore/QCoreApplication>
 #include <QtDBus/QDBusConnection>
+#include <QtCore/QDebug>
 #include "dbusserver.h"
 #include "dbusserveradaptor.h"
 
@@ -16,7 +17,10 @@
      // connect to D-Bus and register as an object:
      QDBusConnection::sessionBus().registerObject("/DBusServer", &dsa);
 
-     //qDebug("Running...");
+     if (QDBusConnection::sessionBus().registerService("roman.DBusServer"))
+        qDebug() << "Service registered";
+     else qDebug() << "Service registration failed";
 
+
      app.exec();
  }
[prev in list] [next in list] [prev in thread] [next in thread] 

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