[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:08:25 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=beba054

The following commit has been merged in the master branch:
commit beba0547f74a69dcb75c049531af9d59ae337cb8
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Mon Aug 25 17:53:04 2014 +0200

    Port TelepathyHandlerApplication to QApplication
    
    KApplication is deprecated with Frameworks, this ports it to
    QApplication
    
    This also moves the setenv initHack into the applications instantiating
    the TelepathyHandlerApplication
    
    REVIEW: 119880
---
 KTp/telepathy-handler-application.cpp | 56 ++++++++++++-----------------------
 KTp/telepathy-handler-application.h   |  6 ++--
 2 files changed, 22 insertions(+), 40 deletions(-)

diff --git a/KTp/telepathy-handler-application.cpp b/KTp/telepathy-handler-application.cpp
index 245ff88..1227121 100644
--- a/KTp/telepathy-handler-application.cpp
+++ b/KTp/telepathy-handler-application.cpp
@@ -44,7 +44,6 @@ public:
     void _k_onInitialTimeout();
     void _k_onTimeout();
 
-    static KComponentData initHack();
     void init(int initialTimeout, int timeout);
 
     TelepathyHandlerApplication *q;
@@ -88,38 +87,6 @@ void TelepathyHandlerApplication::Private::_k_onTimeout()
     }
 }
 
-// this gets called before even entering QApplication::QApplication()
-KComponentData TelepathyHandlerApplication::Private::initHack()
-{
-    // This is a very very very ugly hack that attempts to solve the following problem:
-    // D-Bus service activated applications inherit the environment of dbus-daemon.
-    // Normally, in KDE, startkde sets these environment variables. However, the session's
-    // dbus-daemon is started before this happens, which means that dbus-daemon does NOT
-    // have these variables in its environment and therefore all service-activated UIs
-    // think that they are not running in KDE. This causes Qt not to load the KDE platform
-    // plugin, which leaves the UI in a sorry state, using a completely wrong theme,
-    // wrong colors, etc...
-    // See also:
-    // - https://bugs.kde.org/show_bug.cgi?id=269861
-    // - https://bugs.kde.org/show_bug.cgi?id=267770
-    // - https://git.reviewboard.kde.org/r/102194/
-    // Here we are just going to assume that kde-telepathy is always used in KDE and
-    // not anywhere else. This is probably the best that we can do.
-    setenv("KDE_FULL_SESSION", "true", 0);
-    setenv("KDE_SESSION_VERSION", "4", 0);
-
-    KComponentData cData(KCmdLineArgs::aboutData());
-    KCmdLineOptions handler_options;
-    handler_options.add("persist", ki18n("Persistent mode (do not exit on timeout)"));
-    handler_options.add("debug", ki18n("Show Telepathy debugging information"));
-    KCmdLineArgs::addCmdLineOptions(handler_options, ki18n("KDE Telepathy"), "kde-telepathy", "kde");
-    KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde-telepathy");
-    Private::s_persist = args->isSet("persist");
-    Private::s_debug = args->isSet("debug");
-
-    return cData;
-}
-
 void TelepathyHandlerApplication::Private::init(int initialTimeout, int timeout)
 {
     this->initialTimeout = initialTimeout;
@@ -155,12 +122,27 @@ bool TelepathyHandlerApplication::Private::s_persist = false;
 bool TelepathyHandlerApplication::Private::s_debug = false;
 
 
-TelepathyHandlerApplication::TelepathyHandlerApplication(bool GUIenabled,
+TelepathyHandlerApplication::TelepathyHandlerApplication(int &argc, char *argv[],
                                                          int initialTimeout,
                                                          int timeout)
-    : KApplication(GUIenabled, Private::initHack()),
+    : QApplication(argc, argv),
       d(new Private(this))
 {
+    QCoreApplication::setApplicationName(i18n("KDE Telepathy"));
+
+    QCommandLineOption persistOption(QStringLiteral("persist"), i18n("Persistent mode (do not exit on timeout)"));
+    QCommandLineOption debugOption(QStringLiteral("debug"), i18n("Show Telepathy debugging information"));
+
+    QCommandLineParser cmdParser;
+    cmdParser.addHelpOption();
+    cmdParser.addOption(persistOption);
+    cmdParser.addOption(debugOption);
+    cmdParser.process(qApp->arguments());
+
+    Private::s_persist = cmdParser.isSet(QStringLiteral("persist"));
+    Private::s_debug = cmdParser.isSet(QStringLiteral("debug"));
+
+
     d->init(initialTimeout, timeout);
 }
 
@@ -171,7 +153,7 @@ TelepathyHandlerApplication::~TelepathyHandlerApplication()
 
 int TelepathyHandlerApplication::newJob()
 {
-    TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(KApplication::kApplication());
+    TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(qApp);
     TelepathyHandlerApplication::Private *d = app->d;
 
     int ret = d->jobCount.fetchAndAddOrdered(1);
@@ -195,7 +177,7 @@ int TelepathyHandlerApplication::newJob()
 
 void TelepathyHandlerApplication::jobFinished()
 {
-    TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(KApplication::kApplication());
+    TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(qApp);
     TelepathyHandlerApplication::Private *d = app->d;
 
     if (d->jobCount.fetchAndAddOrdered(-1) <= 1) {
diff --git a/KTp/telepathy-handler-application.h b/KTp/telepathy-handler-application.h
index 504ad52..2baed3f 100644
--- a/KTp/telepathy-handler-application.h
+++ b/KTp/telepathy-handler-application.h
@@ -19,7 +19,7 @@
 #ifndef TELEPATHY_HANDLER_APPLICATION_H
 #define TELEPATHY_HANDLER_APPLICATION_H
 
-#include <KApplication>
+#include <QApplication>
 
 #include <KTp/ktp-export.h>
 
@@ -38,7 +38,7 @@ namespace KTp
  * - Use Tp-Qt4 callback for redirecting debug output into KDebug
  * - Sets the KDE_FULL_SESSION environment variable to workaround dbus activation issues.
  */
-class KTP_EXPORT TelepathyHandlerApplication : public KApplication
+class KTP_EXPORT TelepathyHandlerApplication : public QApplication
 {
     Q_OBJECT
 
@@ -47,7 +47,7 @@ public:
      * \p initialTimeout Initial timeout time (in msec) after which application exits if no jobs are received.
      * \p timeout Timeout time (in msec) after which application exits after the last job is finished.
      */
-    explicit TelepathyHandlerApplication(bool GUIenabled = true,
+    explicit TelepathyHandlerApplication(int &argc, char *argv[],
                                          int initialTimeout = 15000,
                                          int timeout = 2000);
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list