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

List:       kde-commits
Subject:    branches/KDE/4.6/kdeplasma-addons/applets/lancelot
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2010-12-25 9:56:48
Message-ID: 20101225095648.DD06D3E1F1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1209158 by ivan:

[Backport] Don't rely on d-bus to start the service anymore.
Should fix BUG:252031 and a few of other environment variable-related
issues



 M  +3 -7      application/CMakeLists.txt  
 A             application/lancelot.desktop  
 D             application/org.kde.lancelot.service.in  
 M  +28 -1     launcher/LancelotApplet.cpp  


--- branches/KDE/4.6/kdeplasma-addons/applets/lancelot/application/CMakeLists.txt \
#1209157:1209158 @@ -87,18 +87,14 @@
 
 set_target_properties(lancelot-menu PROPERTIES OUTPUT_NAME lancelot)
 
-## DBUS service
-
-configure_file(org.kde.lancelot.service.in
-   ${CMAKE_CURRENT_BINARY_DIR}/org.kde.lancelot.service)
-
 ########### install applicaiton ###############
 
 # To regenerate .xml file:
 # qdbuscpp2xml -M -s LancelotApplication.h -o org.kde.lancelot.xml.new
-# And make the needed changes
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.lancelot.service DESTINATION \
${DBUS_SERVICES_INSTALL_DIR}) # ${CMAKE_INSTALL_PREFIX}/share/dbus-1/services )  
 install(TARGETS lancelot-menu ${INSTALL_TARGETS_DEFAULT_ARGS} )
 
 install(FILES lancelot.notifyrc DESTINATION ${DATA_INSTALL_DIR}/lancelot)
+
+install(FILES lancelot.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+
--- branches/KDE/4.6/kdeplasma-addons/applets/lancelot/launcher/LancelotApplet.cpp \
#1209157:1209158 @@ -22,11 +22,13 @@
 
 #include <QDBusInterface>
 #include <QDBusReply>
+#include <QDBusConnection>
 #include <QGraphicsLinearLayout>
 
 #include <KDebug>
 #include <KIcon>
 #include <KGlobalSettings>
+#include <KToolInvocation>
 
 #include <Plasma/Corona>
 
@@ -40,6 +42,8 @@
 #define SIZE_CMAX 64
 #define SPACING 8
 
+#define LANCELOT_SERVICE_PATH "org.kde.lancelot"
+
 class LancelotApplet::Private {
 public:
     Private(LancelotApplet * parent)
@@ -50,12 +54,35 @@
         q->setLayout(layout);
         layout->setContentsMargins(0, 0, 0, 0);
         layout->setSpacing(0);
+
+        if (!lancelotRunning()) {
+            QString error;
+            int ret = KToolInvocation::startServiceByDesktopPath("lancelot.desktop", \
QStringList(), &error); +
+            if (ret > 0) {
+                kDebug() << "Couldn't start lacelot: " << error << endl;
+            }
+
+            if (!lancelotRunning()) {
+                kDebug() << "Lancelot service is still not registered";
+            } else {
+                kDebug() << "Lancelot service has been registered";
+            }
+
+
+        }
+
         lancelot = new org::kde::lancelot::App(
-            "org.kde.lancelot", "/Lancelot",
+            LANCELOT_SERVICE_PATH, "/Lancelot",
             QDBusConnection::sessionBus()
         );
     }
 
+    bool lancelotRunning() const
+    {
+        return QDBusConnection::sessionBus().interface()->isServiceRegistered(LANCELOT_SERVICE_PATH);
 +    }
+
     ~Private()
     {
         deleteButtons();


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

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