[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:47 UTC 2016


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

The following commit has been merged in the master branch:
commit d51909aae421f2880273de02478f3981fe4404e8
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Fri Oct 7 16:13:51 2011 +0100

    Assume that the number of received channels is always 1
    
    Added a Q_ASSERT to enforce this
---
 src/filetransfer-handler.cpp | 106 +++++++++++++++++++++----------------------
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index 185f668..ec3037e 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -61,64 +61,64 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
     Q_UNUSED(userActionTime);
     Q_UNUSED(handlerInfo);
 
-    Q_FOREACH(const Tp::ChannelPtr &channel, channels) {
-        kDebug() << "Handling new file transfer";
-
-        KJob* job = NULL;
-        if (Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::dynamicCast(channel)) {
-            if (KTelepathy::TelepathyHandlerApplication::newJob() >= 0) {
-                context->setFinished();
-            } else {
-                context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KDE.FileTransfer.Exiting"),
-                                              i18n("File transfer handler is exiting. Cannot start job"));
-                return;
-            }
-
-            kDebug() << "Incoming File Transfer:";
-            kDebug() << channel->immutableProperties();
-
-            KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
-            KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
-
-            QString downloadDirectory = filetransferConfig.readPathEntry(QLatin1String("downloadDirectory"),
-                    QDir::homePath() + QLatin1String("/") + i18nc("This is the download directory in user's home", "Downloads"));
-            kDebug() << "Download directory:" << downloadDirectory;
-            // TODO Check if directory exists
-
-            job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, this);
-        } else if (Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::dynamicCast(channel)) {
-            if (outgoingFileTransferChannel->uri().isEmpty()) {
-                context->setFinishedWithError(QLatin1String(TELEPATHY_QT4_ERROR_INCONSISTENT),
-                                              i18n("Cannot handle outgoing file transfer without URI"));
-            }
-
-            if (KTelepathy::TelepathyHandlerApplication::newJob() >= 0) {
-                context->setFinished();
-            } else {
-                context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KDE.FileTransfer.Exiting"),
-                                              i18n("File transfer handler is exiting. Cannot start job"));
-                return;
-            }
-
-            kDebug() << "Outgoing File Transfer:";
-            kDebug() << channel->immutableProperties();
-
-            job = new HandleOutgoingFileTransferChannelJob(outgoingFileTransferChannel, this);
+    Q_ASSERT(channels.size() == 1);
+
+    kDebug() << "Handling new file transfer";
+
+    KJob* job = NULL;
+    if (Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::dynamicCast(channels.first())) {
+        if (KTelepathy::TelepathyHandlerApplication::newJob() >= 0) {
+            context->setFinished();
         } else {
+            context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KDE.FileTransfer.Exiting"),
+                                          i18n("File transfer handler is exiting. Cannot start job"));
+            return;
+        }
+
+        kDebug() << "Incoming File Transfer:";
+        kDebug() << incomingFileTransferChannel->immutableProperties();
+
+        KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+        KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
+
+        QString downloadDirectory = filetransferConfig.readPathEntry(QLatin1String("downloadDirectory"),
+                QDir::homePath() + QLatin1String("/") + i18nc("This is the download directory in user's home", "Downloads"));
+        kDebug() << "Download directory:" << downloadDirectory;
+        // TODO Check if directory exists
+
+        job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, this);
+    } else if (Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::dynamicCast(channels.first())) {
+        if (outgoingFileTransferChannel->uri().isEmpty()) {
             context->setFinishedWithError(QLatin1String(TELEPATHY_QT4_ERROR_INCONSISTENT),
-                                          i18n("Unknown channel type"));
-            kDebug() << "If you are reading this, then telepathy is broken";
+                                          i18n("Cannot handle outgoing file transfer without URI"));
         }
 
-        if (job) {
-            connect(job,
-                    SIGNAL(infoMessage(KJob*, QString, QString)),
-                    SLOT(onInfoMessage(KJob*, QString, QString)));
-            connect(job,
-                    SIGNAL(result(KJob*)),
-                    SLOT  (handleResult(KJob*)));
-            job->start();
+        if (KTelepathy::TelepathyHandlerApplication::newJob() >= 0) {
+            context->setFinished();
+        } else {
+            context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KDE.FileTransfer.Exiting"),
+                                          i18n("File transfer handler is exiting. Cannot start job"));
+            return;
         }
+
+        kDebug() << "Outgoing File Transfer:";
+        kDebug() << outgoingFileTransferChannel->immutableProperties();
+
+        job = new HandleOutgoingFileTransferChannelJob(outgoingFileTransferChannel, this);
+    } else {
+        context->setFinishedWithError(QLatin1String(TELEPATHY_QT4_ERROR_INCONSISTENT),
+                                      i18n("Unknown channel type"));
+        kDebug() << "If you are reading this, then telepathy is broken";
+    }
+
+    if (job) {
+        connect(job,
+                SIGNAL(infoMessage(KJob*, QString, QString)),
+                SLOT(onInfoMessage(KJob*, QString, QString)));
+        connect(job,
+                SIGNAL(result(KJob*)),
+                SLOT  (handleResult(KJob*)));
+        job->start();
     }
 }
 

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list