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


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

The following commit has been merged in the master branch:
commit d0d5522362e04a04f663d5417200074c3e20b220
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Wed Sep 28 19:35:26 2011 +0100

    Handle other states in incoming file transfer
    
    Also set better notification messages.
    This commit plus the previous commits make the notifications
    acceptables, therefore I'm closing bug #282710 (better notifications)
    
    BUG: 282710
---
 src/handle-incoming-file-transfer-channel-job.cpp | 39 +++++++++++++++++------
 src/handle-outgoing-file-transfer-channel-job.cpp | 22 ++++++-------
 2 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/src/handle-incoming-file-transfer-channel-job.cpp b/src/handle-incoming-file-transfer-channel-job.cpp
index 5fb82f7..fa3cacb 100644
--- a/src/handle-incoming-file-transfer-channel-job.cpp
+++ b/src/handle-incoming-file-transfer-channel-job.cpp
@@ -56,8 +56,6 @@ class HandleIncomingFileTransferChannelJobPrivate : public KTelepathy::Telepathy
         void __k__onAcceptFileFinished(Tp::PendingOperation* op);
         void __k__onCancelOperationFinished(Tp::PendingOperation* op);
         void __k__onInvalidated();
-
-        bool transferCompleted;
 };
 
 HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::IncomingFileTransferChannelPtr channel,
@@ -242,14 +240,35 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
     kDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    //TODO Handle other states
-    kDebug() << "File transfer channel state changed to" << state << "with reason" << stateReason;
-    transferCompleted = (state == Tp::FileTransferStateCompleted);
-    if (transferCompleted) {
-        kDebug() << "Transfer completed, saved at" << file->fileName();
-        Q_EMIT q->infoMessage(q, i18n("Transfer completed."));
+    kDebug() << "Incoming file transfer channel state changed to" << state << "with reason" << stateReason;
 
-        QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+    switch (state)
+    {
+        case Tp::FileTransferStateNone:
+            // This is bad
+            kWarning() << "An unknown error occurred.";
+            q->setError(KTelepathy::TelepathyErrorError);
+            q->setErrorText(i18n("An unknown error occurred"));
+            QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+        break;
+        case Tp::FileTransferStateCompleted:
+            kDebug() << "Incoming file transfer completed, saved at" << file->fileName();
+            Q_EMIT q->infoMessage(q, i18n("Incoming file transfer")); // [Finished] is added automatically to the notification
+            QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+            break;
+        case Tp::FileTransferStateCancelled:
+            kWarning() << "Incoming file transfer was canceled.";
+            q->setError(KTelepathy::FileTransferCancelled);
+            q->setErrorText(i18n("Incoming file transfer was canceled."));
+            q->kill(KJob::Quietly);
+            break;
+        case Tp::FileTransferStateAccepted:
+            QTimer::singleShot(0, q, SLOT(__k__provideFile()));
+            break;
+        case Tp::FileTransferStatePending:
+        case Tp::FileTransferStateOpen:
+        default:
+            break;
     }
 }
 
@@ -289,7 +308,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onCancelOperationFinished
         kWarning() << "Unable to cancel file transfer - " <<
             op->errorName() << ":" << op->errorMessage();
         q->setError(KTelepathy::CancelFileTransferError);
-        q->setErrorText(i18n("Cannot cancel file transfer"));
+        q->setErrorText(i18n("Cannot cancel incoming file transfer"));
     }
 
     kDebug() << "File transfer cancelled";
diff --git a/src/handle-outgoing-file-transfer-channel-job.cpp b/src/handle-outgoing-file-transfer-channel-job.cpp
index 4ca5ead..9dc7878 100644
--- a/src/handle-outgoing-file-transfer-channel-job.cpp
+++ b/src/handle-outgoing-file-transfer-channel-job.cpp
@@ -154,27 +154,27 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
     kDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    kDebug() << "File transfer channel state changed to" << state << "with reason" << stateReason;
+    kDebug() << "Outgoing file transfer channel state changed to" << state << "with reason" << stateReason;
 
     switch (state)
     {
         case Tp::FileTransferStateNone:
             // This is bad
-            kWarning() << "An error occurred.";
+            kWarning() << "An unknown error occurred.";
             q->setError(KTelepathy::TelepathyErrorError);
-            q->setErrorText(i18n("An error occurred"));
+            q->setErrorText(i18n("An unknown error occurred"));
             QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
 	    break;
         case Tp::FileTransferStateCompleted:
-            kDebug() << "Transfer completed";
-            Q_EMIT q->infoMessage(q, i18n("Transfer completed"));
-            QTimer::singleShot(0, q, SLOT(__k__doEmitResult())); //TODO here?
+            kDebug() << "Outgoing file transfer completed";
+            Q_EMIT q->infoMessage(q, i18n("Outgoing file transfer")); // [Finished] is added automatically to the notification
+            QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
             break;
         case Tp::FileTransferStateCancelled:
-            kWarning() << "Transfer was canceled.";
-            q->setError(KTelepathy::FileTransferCancelled); //TODO
-            q->setErrorText(i18n("Transfer was canceled."));
-            QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+            kWarning() << "Outgoing file transfer was canceled.";
+            q->setError(KTelepathy::FileTransferCancelled);
+            q->setErrorText(i18n("Outgoing file transfer was canceled."));
+            q->kill(KJob::Quietly);
             break;
         case Tp::FileTransferStateAccepted:
             QTimer::singleShot(0, q, SLOT(__k__provideFile()));
@@ -253,7 +253,7 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onCancelOperationFinished
         kWarning() << "Unable to cancel file transfer - " <<
             op->errorName() << ":" << op->errorMessage();
         q->setError(KTelepathy::CancelFileTransferError);
-        q->setErrorText(i18n("Cannot cancel file transfer"));
+        q->setErrorText(i18n("Cannot cancel outgoing file transfer"));
     }
 
     kDebug() << "File transfer cancelled";

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list