[SCM] ktp-filetransfer-handler packaging branch, master, updated. debian/15.12.1-2-226-g825cd93

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:11:27 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-filetransfer-handler.git;a=commitdiff;h=89cff55

The following commit has been merged in the master branch:
commit 89cff55d05973b0cf78a45108bca9f4d2150777c
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Wed Aug 10 16:34:10 2011 +0100

    Fix comment
---
 src/CMakeLists.txt           |  1 +
 src/filetransfer-handler.cpp | 14 ++------------
 src/filetransfer-handler.h   |  9 +--------
 src/main.cpp                 | 13 ++++++++-----
 4 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9e84a8b..834b4fc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,6 @@
 set (telepathy_kde_filetransfer_handler_SRCS
      main.cpp
+     control.cpp
      filetransfer-handler.cpp
      telepathy-base-job.cpp
      handle-incoming-file-transfer-channel-job.cpp
diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index 6ed20bb..043227f 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -35,12 +35,10 @@
 #include <QApplication>
 
 
-FileTransferHandler::FileTransferHandler(bool persist, QObject *parent)
+FileTransferHandler::FileTransferHandler(QObject *parent)
     : QObject(parent),
       Tp::AbstractClientHandler(Tp::ChannelClassSpecList() << Tp::ChannelClassSpec::incomingFileTransfer()
-                                                           << Tp::ChannelClassSpec::outgoingFileTransfer()),
-      m_persist(persist),
-      m_jobCount(0)
+                                                           << Tp::ChannelClassSpec::outgoingFileTransfer())
 {
 }
 
@@ -141,11 +139,3 @@ void FileTransferHandler::handleResult(KJob* job)
 
     QTimer::singleShot(2000, this, SLOT(onTimeout()));
 }
-
-void FileTransferHandler::onTimeout()
-{
-    if (!m_persist && m_jobCount.fetchAndAddOrdered(-1) <= 1) {
-        kDebug() << "Timeout. Exiting";
-        QApplication::quit();
-    }
-}
diff --git a/src/filetransfer-handler.h b/src/filetransfer-handler.h
index 6fd6c4b..c6aabb9 100644
--- a/src/filetransfer-handler.h
+++ b/src/filetransfer-handler.h
@@ -33,7 +33,7 @@ class FileTransferHandler : public QObject, public Tp::AbstractClientHandler
     Q_DISABLE_COPY(FileTransferHandler);
 
 public:
-    FileTransferHandler(bool persist, QObject* parent = 0);
+    FileTransferHandler(QObject* parent = 0);
     virtual ~FileTransferHandler();
 
     virtual bool bypassApproval() const;
@@ -45,16 +45,9 @@ public:
                         const QDateTime &userActionTime,
                         const Tp::AbstractClientHandler::HandlerInfo &handlerInfo);
 
-public Q_SLOTS:
-    void onTimeout();
-
 private Q_SLOTS:
     void onInfoMessage(KJob* job, const QString &plain, const QString &rich);
     void handleResult(KJob* job);
-
-private:
-    bool m_persist;
-    QAtomicInt m_jobCount;
 };
 
 #endif // TELEPATHY_KDE_FILETRANSFER_HANDLER_H
diff --git a/src/main.cpp b/src/main.cpp
index 869b1d4..ede2d4b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -15,6 +15,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "control.h"
 #include "filetransfer-handler.h"
 
 #include <TelepathyQt4/Debug>
@@ -34,7 +35,7 @@ int main(int argc, char* argv[])
     aboutData.addAuthor(ki18n("Daniele E. Domenichelli"), ki18n("Developer"), "daniele.domenichelli at gmail.com");
     aboutData.setProductName("telepathy/filetransfer");
 
-    // Add --debug as commandline option
+    // Add --debug as and --persist commandline options
     KCmdLineOptions options;
     options.add("debug", ki18n("Show Telepathy debugging information"));
     options.add("persist", ki18n("Persistant mode (does not exit on timeout)"));
@@ -44,6 +45,10 @@ int main(int argc, char* argv[])
     KApplication app;
     app.setQuitOnLastWindowClosed(false);
 
+    // Create static Control object before starting anything that could be
+    // multithreaded to avoid problems.
+    new Control(KCmdLineArgs::parsedArgs()->isSet("persist"), &app);
+
     Tp::registerTypes();
     //Enable telepathy-Qt4 debug
     Tp::enableDebug(KCmdLineArgs::parsedArgs()->isSet("debug"));
@@ -66,10 +71,8 @@ int main(int argc, char* argv[])
                                                                    channelFactory,
                                                                    contactFactory);
 
-    Tp::SharedPtr<FileTransferHandler> fth = Tp::SharedPtr<FileTransferHandler>(
-            new FileTransferHandler(KCmdLineArgs::parsedArgs()->isSet("persist")));
-    registrar->registerClient(Tp::AbstractClientPtr(fth),
-                              QLatin1String("KDE.FileTransfer"));
+    Tp::SharedPtr<FileTransferHandler> fth = Tp::SharedPtr<FileTransferHandler>(new FileTransferHandler());
+    registrar->registerClient(Tp::AbstractClientPtr(fth), QLatin1String("KDE.FileTransfer"));
 
     QTimer::singleShot(2000, fth.data(), SLOT(onTimeout()));
 

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list