[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:21:34 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=2e993c1

The following commit has been merged in the master branch:
commit 2e993c1a846c8b5a78de2843a44cce4fa4db593e
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Wed Mar 21 04:24:26 2012 +0100

    Fix adiumxtra-handler to exit after downloading
---
 .../adiumxtra-protocol-handler.cpp                 | 44 ++++++++++++++++------
 .../adiumxtra-protocol-handler.h                   | 16 ++++++--
 adiumxtra-protocol-handler/main.cpp                | 19 ++++++----
 3 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
index 39b31ef..2dcd718 100644
--- a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
+++ b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.cpp
@@ -32,6 +32,7 @@
 #include <KMimeType>
 
 AdiumxtraProtocolHandler::AdiumxtraProtocolHandler()
+    : QObject()
 {
     kDebug();
 }
@@ -41,11 +42,16 @@ AdiumxtraProtocolHandler::~AdiumxtraProtocolHandler()
     kDebug();
 }
 
-BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &path)
+void AdiumxtraProtocolHandler::install()
 {
     kDebug();
 
-    KUrl url(path);
+    if (m_url.isEmpty()) {
+        Q_EMIT finished();
+        return; // BundleInstaller:: xxxxx
+    }
+
+    KUrl url(m_url);
     if(url.protocol() == QLatin1String("adiumxtra")) {
         url.setProtocol(QLatin1String("http"));
     }
@@ -55,8 +61,10 @@ BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &p
         KIO::Job* getJob = KIO::file_copy(url.prettyUrl(), KUrl(tmpFile->fileName()), -1, KIO::Overwrite);
         if (!KIO::NetAccess::synchronousRun(getJob, 0)) {
             kDebug() << "Download failed";
-            return BundleInstaller::BundleCannotOpen;
+            Q_EMIT finished();
+            return; // BundleInstaller::BundleCannotOpen;
         }
+        getJob->deleteLater();
     }
 
     KArchive *archive = 0L;
@@ -81,13 +89,15 @@ BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &p
         notification->sendEvent();
         kDebug() << "Unsupported file type" << currentBundleMimeType;
         kDebug() << tmpFile->fileName();
-        return BundleInstaller::BundleNotValid;
+        Q_EMIT finished();
+        return;// BundleInstaller::BundleNotValid;
     }
 
     if (!archive->open(QIODevice::ReadOnly)) {
         delete archive;
         kDebug() << "Cannot open theme file";
-        return BundleInstaller::BundleCannotOpen;
+        Q_EMIT finished();
+        return;// BundleInstaller::BundleCannotOpen;
     }
 
     ChatStyleInstaller *chatStyleInstaller = new ChatStyleInstaller(archive, tmpFile);
@@ -97,13 +107,15 @@ BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &p
 
         QObject::connect(chatStyleInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)),
                          chatStyleInstaller, SLOT(showResult()));
-        QObject::connect(chatStyleInstaller, SIGNAL(showedResult()), this, SLOT(quit()));
-        QObject::connect(chatStyleInstaller, SIGNAL(ignoredRequest()), this, SLOT(quit()));
+        QObject::connect(chatStyleInstaller, SIGNAL(showedResult()), this, SIGNAL(finished()));
+        QObject::connect(chatStyleInstaller, SIGNAL(showedResult()), chatStyleInstaller, SLOT(deleteLater()));
+        QObject::connect(chatStyleInstaller, SIGNAL(ignoredRequest()), this, SIGNAL(finished()));
+        QObject::connect(chatStyleInstaller, SIGNAL(ignoredRequest()), chatStyleInstaller, SLOT(deleteLater()));
 
         kDebug() << "Starting installation";
         chatStyleInstaller->install();
 
-        return BundleInstaller::BundleValid;
+        return;// BundleInstaller::BundleValid;
     }
 
     EmoticonSetInstaller *emoticonSetInstaller = new EmoticonSetInstaller(archive, tmpFile);
@@ -113,13 +125,15 @@ BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &p
 
         QObject::connect(emoticonSetInstaller, SIGNAL(finished(BundleInstaller::BundleStatus)),
                          emoticonSetInstaller, SLOT(showResult()));
-        QObject::connect(emoticonSetInstaller, SIGNAL(showedResult()), this, SLOT(quit()));
-        QObject::connect(emoticonSetInstaller, SIGNAL(ignoredRequest()), this, SLOT(quit()));
+        QObject::connect(emoticonSetInstaller, SIGNAL(showedResult()), this, SIGNAL(finished()));
+        QObject::connect(emoticonSetInstaller, SIGNAL(showedResult()), chatStyleInstaller, SLOT(deleteLater()));
+        QObject::connect(emoticonSetInstaller, SIGNAL(ignoredRequest()), this, SIGNAL(finished()));
+        QObject::connect(emoticonSetInstaller, SIGNAL(ignoredRequest()), chatStyleInstaller, SLOT(deleteLater()));
 
         kDebug() << "Starting installation";
         emoticonSetInstaller->install();
 
-        return BundleInstaller::BundleValid;
+        return;// BundleInstaller::BundleValid;
     }
 
     KNotification *notification = new KNotification(QLatin1String("packagenotrecognized"),
@@ -135,5 +149,11 @@ BundleInstaller::BundleStatus AdiumxtraProtocolHandler::install(const QString &p
     notification->sendEvent();
     kDebug() << "Sent error";
 
-    return BundleInstaller::BundleUnknownError;
+    Q_EMIT finished();
+    return;// BundleInstaller::BundleUnknownError;
+}
+
+void AdiumxtraProtocolHandler::setUrl(const QString& url)
+{
+    m_url = url;
 }
diff --git a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
index 9b58210..6eb3d9e 100644
--- a/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
+++ b/adiumxtra-protocol-handler/adiumxtra-protocol-handler.h
@@ -21,15 +21,25 @@
 
 #include "bundle-installer.h"
 
-#include <KApplication>
+#include <QtCore/QObject>
 
-class AdiumxtraProtocolHandler : public KApplication
+class AdiumxtraProtocolHandler : public QObject
 {
+    Q_OBJECT
 public:
     AdiumxtraProtocolHandler();
     virtual ~AdiumxtraProtocolHandler();
 
-    BundleInstaller::BundleStatus install(const QString& path);
+    void setUrl(const QString &url);
+
+public Q_SLOTS:
+    void install();
+
+Q_SIGNALS:
+    void finished();
+
+private:
+    QString m_url;
 };
 
 #endif // ADIUMXTRAPROTOCOLHANDLER_H
diff --git a/adiumxtra-protocol-handler/main.cpp b/adiumxtra-protocol-handler/main.cpp
index e1ed40a..4e83a8a 100644
--- a/adiumxtra-protocol-handler/main.cpp
+++ b/adiumxtra-protocol-handler/main.cpp
@@ -21,7 +21,7 @@
 #include <KApplication>
 #include <KAboutData>
 #include <KCmdLineArgs>
-#include <KDebug>
+#include <QTimer>
 
 int main(int argc, char *argv[])
 {
@@ -37,15 +37,18 @@ int main(int argc, char *argv[])
     options.add("!+install-chatstyles", ki18n("Install Adium packages"));
     KCmdLineArgs::addCmdLineOptions(options);
 
-
-    AdiumxtraProtocolHandler app;
-
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-    for(int i = 0; i < args->count(); i++) {
-        kDebug() << "install: " << args->arg(i);
-        app.install(args->arg(i));
+    KApplication app;
+
+    if (args->count() == 0) {
+        return -1;
     }
-    args->clear();
+
+    AdiumxtraProtocolHandler *handler = new AdiumxtraProtocolHandler;
+    handler->setUrl(KCmdLineArgs::parsedArgs()->arg(0));
+
+    app.connect(handler, SIGNAL(finished()), SLOT(quit()));
+    QTimer::singleShot(0, handler, SLOT(install()));
 
     return app.exec();
 }

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list