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


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

The following commit has been merged in the master branch:
commit a475a4b7268c9a4010a5d2ec43c7905e08ef0174
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Mon Nov 17 16:54:14 2014 +0100

    Switch to categorized debug messages
---
 src/CMakeLists.txt                                |  1 +
 src/filetransfer-handler.cpp                      | 15 ++---
 src/handle-incoming-file-transfer-channel-job.cpp | 71 ++++++++++++-----------
 src/handle-outgoing-file-transfer-channel-job.cpp | 57 +++++++++---------
 src/ktp-fth-debug.cpp                             | 21 +++++++
 src/ktp-fth-debug.h                               | 26 +++++++++
 src/main.cpp                                      |  2 +-
 src/telepathy-base-job.cpp                        |  5 +-
 8 files changed, 125 insertions(+), 73 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f38dde2..80d1758 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,6 +6,7 @@ set(ktp_filetransfer_handler_SRCS
     telepathy-base-job.cpp
     handle-incoming-file-transfer-channel-job.cpp
     handle-outgoing-file-transfer-channel-job.cpp
+    ktp-fth-debug.cpp
 )
 
 configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index d25807e..3fd092e 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -19,6 +19,7 @@
 
 #include "handle-incoming-file-transfer-channel-job.h"
 #include "handle-outgoing-file-transfer-channel-job.h"
+#include "ktp-fth-debug.h"
 
 #include <KTp/telepathy-handler-application.h>
 
@@ -77,7 +78,7 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
             Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::qObjectCast(channel);
             Q_ASSERT(incomingFileTransferChannel);
 
-            qDebug() << incomingFileTransferChannel->immutableProperties();
+            qCDebug(KTP_FTH_MODULE) << incomingFileTransferChannel->immutableProperties();
 
             KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
             KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
@@ -88,7 +89,7 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
                 downloadDirectory = filetransferConfig.readPathEntry(QLatin1String("downloadDirectory"),
                     QDir::homePath() + QLatin1String("/") + i18nc("This is the download directory in user's home", "Downloads"));
             }
-            qDebug() << "Download directory:" << downloadDirectory << "	 Always Ask:" << alwaysAsk;
+            qCDebug(KTP_FTH_MODULE) << "Download directory:" << downloadDirectory << "	 Always Ask:" << alwaysAsk;
             // TODO Check if directory exists
 
             job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, alwaysAsk, this);
@@ -96,10 +97,10 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
             Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::qObjectCast(channel);
             Q_ASSERT(outgoingFileTransferChannel);
 
-            qDebug() << outgoingFileTransferChannel->immutableProperties();
+            qCDebug(KTP_FTH_MODULE) << outgoingFileTransferChannel->immutableProperties();
 
             if (outgoingFileTransferChannel->uri().isEmpty()) {
-                qWarning() << "Cannot handle outgoing file transfer without URI";
+                qCWarning(KTP_FTH_MODULE) << "Cannot handle outgoing file transfer without URI";
                 KTp::TelepathyHandlerApplication::jobFinished();
                 continue;
             }
@@ -125,14 +126,14 @@ void FileTransferHandler::onInfoMessage(KJob* job, const QString &plain, const Q
 {
     Q_UNUSED(job);
     Q_UNUSED(rich);
-    qDebug() << plain;
+    qCDebug(KTP_FTH_MODULE) << plain;
 }
 
 void FileTransferHandler::handleResult(KJob* job)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     if (job->error()) {
-        qWarning() << job->errorString();
+        qCWarning(KTP_FTH_MODULE) << job->errorString();
         // TODO do something;
     }
 
diff --git a/src/handle-incoming-file-transfer-channel-job.cpp b/src/handle-incoming-file-transfer-channel-job.cpp
index 2b7560d..1e97d0d 100644
--- a/src/handle-incoming-file-transfer-channel-job.cpp
+++ b/src/handle-incoming-file-transfer-channel-job.cpp
@@ -19,6 +19,7 @@
 
 #include "handle-incoming-file-transfer-channel-job.h"
 #include "telepathy-base-job_p.h"
+#include "ktp-fth-debug.h"
 
 #include <QTimer>
 #include <QUrl>
@@ -79,7 +80,7 @@ HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::I
                                                                            QObject* parent)
     : TelepathyBaseJob(*new HandleIncomingFileTransferChannelJobPrivate(), parent)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_D(HandleIncomingFileTransferChannelJob);
 
     d->channel = channel;
@@ -90,20 +91,20 @@ HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::I
 
 HandleIncomingFileTransferChannelJob::~HandleIncomingFileTransferChannelJob()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     KIO::getJobTracker()->unregisterJob(this);
 }
 
 void HandleIncomingFileTransferChannelJob::start()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_D(HandleIncomingFileTransferChannelJob);
     d->start();
 }
 
 bool HandleIncomingFileTransferChannelJob::doKill()
 {
-    qDebug() << "Incoming file transfer killed.";
+    qCDebug(KTP_FTH_MODULE) << "Incoming file transfer killed.";
     Q_D(HandleIncomingFileTransferChannelJob);
     return d->kill();
 }
@@ -114,17 +115,17 @@ HandleIncomingFileTransferChannelJobPrivate::HandleIncomingFileTransferChannelJo
       offset(0),
       isResuming(false)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
 }
 
 HandleIncomingFileTransferChannelJobPrivate::~HandleIncomingFileTransferChannelJobPrivate()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
 }
 
 void HandleIncomingFileTransferChannelJobPrivate::init()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (channel.isNull()) {
@@ -164,12 +165,12 @@ void HandleIncomingFileTransferChannelJobPrivate::init()
 
 void HandleIncomingFileTransferChannelJobPrivate::start()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     Q_ASSERT(!q->error());
     if (q->error()) {
-        qWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
+        qCWarning(KTP_FTH_MODULE) << "Job was started in error state. Something wrong happened." << q->errorString();
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -227,11 +228,11 @@ void HandleIncomingFileTransferChannelJobPrivate::checkFileExists()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(int result)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (!renameDialog) {
-        qWarning() << "Rename dialog was deleted during event loop.";
+        qCWarning(KTP_FTH_MODULE) << "Rename dialog was deleted during event loop.";
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -257,7 +258,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(in
     }
         break;
     default:
-        qWarning() << "Unknown Error";
+        qCWarning(KTP_FTH_MODULE) << "Unknown Error";
         q->setError(KTp::KTpError);
         q->setErrorText(i18n("Unknown Error"));
         renameDialog.data()->deleteLater();
@@ -271,7 +272,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(in
 
 void HandleIncomingFileTransferChannelJobPrivate::checkPartFile()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     QFileInfo fileInfo(partUrl.toLocalFile());
@@ -304,11 +305,11 @@ void HandleIncomingFileTransferChannelJobPrivate::checkPartFile()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onResumeDialogFinished(int result)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (!renameDialog) {
-        qWarning() << "Rename dialog was deleted during event loop.";
+        qCWarning(KTP_FTH_MODULE) << "Rename dialog was deleted during event loop.";
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -338,7 +339,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onResumeDialogFinished(in
 
 void HandleIncomingFileTransferChannelJobPrivate::receiveFile()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     // Open the .part file in append mode
@@ -357,7 +358,7 @@ void HandleIncomingFileTransferChannelJobPrivate::receiveFile()
 
 bool HandleIncomingFileTransferChannelJobPrivate::kill()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (channel->state() != Tp::FileTransferStateCancelled) {
@@ -374,13 +375,13 @@ bool HandleIncomingFileTransferChannelJobPrivate::kill()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onSetUriOperationFinished(Tp::PendingOperation* op)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (op->isError()) {
         // We do not want to exit if setUri failed, but we try to send the file
         // anyway. Anyway we print a message for debugging purposes.
-        qWarning() << "Unable to set the URI -" << op->errorName() << ":" << op->errorMessage();
+        qCWarning(KTP_FTH_MODULE) << "Unable to set the URI -" << op->errorName() << ":" << op->errorMessage();
     }
 
     KIO::getJobTracker()->registerJob(q);
@@ -393,7 +394,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onSetUriOperationFinished
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__acceptFile()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     Q_EMIT q->description(q, i18n("Incoming file transfer"),
@@ -408,13 +409,13 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__acceptFile()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qulonglong offset)
 {
-    qDebug() << "__k__onInitialOffsetDefined" << offset;
+    qCDebug(KTP_FTH_MODULE) << "__k__onInitialOffsetDefined" << offset;
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     // Some protocols do not support resuming file transfers, therefore we need
     // to use to this method to set the real offset
     if (isResuming && offset == 0) {
-        qDebug() << "Impossible to resume file. Restarting.";
+        qCDebug(KTP_FTH_MODULE) << "Impossible to resume file. Restarting.";
         Q_EMIT q->infoMessage(q, i18n("Impossible to resume file transfer. Restarting."));
     }
 
@@ -427,15 +428,15 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qu
 void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStateChanged(Tp::FileTransferState state,
                                                                                          Tp::FileTransferStateChangeReason stateReason)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    qDebug() << "Incoming file transfer channel state changed to" << state << "with reason" << stateReason;
+    qCDebug(KTP_FTH_MODULE) << "Incoming file transfer channel state changed to" << state << "with reason" << stateReason;
 
     switch (state) {
     case Tp::FileTransferStateNone:
         // This is bad
-        qWarning() << "An unknown error occurred.";
+        qCWarning(KTP_FTH_MODULE) << "An unknown error occurred.";
         q->setError(KTp::TelepathyErrorError);
         q->setErrorText(i18n("An unknown error occurred"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -449,7 +450,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
         file->rename(url.toLocalFile());
         file->flush();
         file->close();
-        qDebug() << "Incoming file transfer completed, saved at" << file->fileName();
+        qCDebug(KTP_FTH_MODULE) << "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;
@@ -475,10 +476,10 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelTransferredBytesChanged(qulonglong count)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    qDebug().nospace() << "Receiving " << channel->fileName() << " - "
+    qCDebug(KTP_FTH_MODULE).nospace() << "Receiving " << channel->fileName() << " - "
                        << "transferred bytes" << " = " << offset + count << " ("
                        << ((int)(((double)(offset + count) / channel->size()) * 100)) << "% done)";
     q->setProcessedAmountAndCalculateSpeed(offset + count);
@@ -488,11 +489,11 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onAcceptFileFinished(Tp::
 {
     // This method is called when the "acceptFile" operation is finished,
     // therefore the file was not received yet.
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (op->isError()) {
-        qWarning() << "Unable to accept file -" << op->errorName() << ":" << op->errorMessage();
+        qCWarning(KTP_FTH_MODULE) << "Unable to accept file -" << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::AcceptFileError);
         q->setErrorText(i18n("Unable to accept file"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -501,25 +502,25 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onAcceptFileFinished(Tp::
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onCancelOperationFinished(Tp::PendingOperation* op)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (op->isError()) {
-        qWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
+        qCWarning(KTP_FTH_MODULE) << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::CancelFileTransferError);
         q->setErrorText(i18n("Cannot cancel incoming file transfer"));
     }
 
-    qDebug() << "File transfer cancelled";
+    qCDebug(KTP_FTH_MODULE) << "File transfer cancelled";
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
 }
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onInvalidated()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    qWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+    qCWarning(KTP_FTH_MODULE) << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
     Q_EMIT q->infoMessage(q, i18n("File transfer invalidated. %1", channel->invalidationMessage()));
 
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
diff --git a/src/handle-outgoing-file-transfer-channel-job.cpp b/src/handle-outgoing-file-transfer-channel-job.cpp
index 3557223..c34f9a7 100644
--- a/src/handle-outgoing-file-transfer-channel-job.cpp
+++ b/src/handle-outgoing-file-transfer-channel-job.cpp
@@ -19,6 +19,7 @@
 
 #include "handle-outgoing-file-transfer-channel-job.h"
 #include "telepathy-base-job_p.h"
+#include "ktp-fth-debug.h"
 
 #include <QTimer>
 #include <QDebug>
@@ -63,7 +64,7 @@ HandleOutgoingFileTransferChannelJob::HandleOutgoingFileTransferChannelJob(Tp::O
                                                                            QObject* parent)
     : TelepathyBaseJob(*new HandleOutgoingFileTransferChannelJobPrivate(), parent)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_D(HandleOutgoingFileTransferChannelJob);
 
     d->channel = channel;
@@ -73,12 +74,12 @@ HandleOutgoingFileTransferChannelJob::HandleOutgoingFileTransferChannelJob(Tp::O
 HandleOutgoingFileTransferChannelJob::~HandleOutgoingFileTransferChannelJob()
 {
     KIO::getJobTracker()->unregisterJob(this);
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
 }
 
 void HandleOutgoingFileTransferChannelJob::start()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     KIO::getJobTracker()->registerJob(this);
     // KWidgetJobTracker has an internal timer of 500 ms, if we don't wait here
     // when the job description is emitted it won't be ready
@@ -87,7 +88,7 @@ void HandleOutgoingFileTransferChannelJob::start()
 
 bool HandleOutgoingFileTransferChannelJob::doKill()
 {
-    qDebug() << "Outgoing file transfer killed.";
+    qCDebug(KTP_FTH_MODULE) << "Outgoing file transfer killed.";
     Q_D(HandleOutgoingFileTransferChannelJob);
     return d->kill();
 }
@@ -96,17 +97,17 @@ HandleOutgoingFileTransferChannelJobPrivate::HandleOutgoingFileTransferChannelJo
     : file(0),
       offset(0)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
 }
 
 HandleOutgoingFileTransferChannelJobPrivate::~HandleOutgoingFileTransferChannelJobPrivate()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
 }
 
 void HandleOutgoingFileTransferChannelJobPrivate::init()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (channel.isNull()) {
@@ -128,7 +129,7 @@ void HandleOutgoingFileTransferChannelJobPrivate::init()
 
     uri = QUrl(channel->uri());
     if (uri.isEmpty()) {
-        qWarning() << "URI property missing";
+        qCWarning(KTP_FTH_MODULE) << "URI property missing";
         q->setError(KTp::UriPropertyMissing);
         q->setErrorText(i18n("URI property is missing"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -136,7 +137,7 @@ void HandleOutgoingFileTransferChannelJobPrivate::init()
     }
     if (!uri.isLocalFile()) {
         // TODO handle this!
-        qWarning() << "Not a local file";
+        qCWarning(KTP_FTH_MODULE) << "Not a local file";
         q->setError(KTp::NotALocalFile);
         q->setErrorText(i18n("This is not a local file"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -163,12 +164,12 @@ void HandleOutgoingFileTransferChannelJobPrivate::init()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__start()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     Q_ASSERT(!q->error());
     if (q->error()) {
-        qWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
+        qCWarning(KTP_FTH_MODULE) << "Job was started in error state. Something wrong happened." << q->errorString();
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -184,7 +185,7 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__start()
 
 bool HandleOutgoingFileTransferChannelJobPrivate::kill()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (channel->state() != Tp::FileTransferStateCancelled) {
@@ -201,7 +202,7 @@ bool HandleOutgoingFileTransferChannelJobPrivate::kill()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qulonglong offset)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     this->offset = offset;
@@ -211,21 +212,21 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qu
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelStateChanged(Tp::FileTransferState state,
                                                                                          Tp::FileTransferStateChangeReason stateReason)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    qDebug() << "Outgoing file transfer channel state changed to" << state << "with reason" << stateReason;
+    qCDebug(KTP_FTH_MODULE) << "Outgoing file transfer channel state changed to" << state << "with reason" << stateReason;
 
     switch (state) {
     case Tp::FileTransferStateNone:
         // This is bad
-        qWarning() << "An unknown error occurred.";
+        qCWarning(KTP_FTH_MODULE) << "An unknown error occurred.";
         q->setError(KTp::TelepathyErrorError);
         q->setErrorText(i18n("An unknown error occurred"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         break;
     case Tp::FileTransferStateCompleted:
-        qDebug() << "Outgoing file transfer completed";
+        qCDebug(KTP_FTH_MODULE) << "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;
@@ -246,11 +247,11 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
 
 void HandleOutgoingFileTransferChannelJobPrivate::provideFile()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     file = new QFile(uri.toLocalFile(), q->parent());
-    qDebug() << "Providing file" << file->fileName();
+    qCDebug(KTP_FTH_MODULE) << "Providing file" << file->fileName();
 
     Tp::PendingOperation* provideFileOperation = channel->provideFile(file);
     q->connect(provideFileOperation,
@@ -260,10 +261,10 @@ void HandleOutgoingFileTransferChannelJobPrivate::provideFile()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelTransferredBytesChanged(qulonglong count)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    qDebug().nospace() << "Sending " << channel->fileName() << " - "
+    qCDebug(KTP_FTH_MODULE).nospace() << "Sending " << channel->fileName() << " - "
                        << "Transferred bytes = " << offset + count << " ("
                        << ((int)(((double)(offset + count) / channel->size()) * 100)) << "% done)";
     q->setProcessedAmountAndCalculateSpeed(offset + count);
@@ -273,11 +274,11 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onProvideFileFinished(Tp:
 {
     // This method is called when the "provideFile" operation is finished,
     // therefore the file was not sent yet.
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (op->isError()) {
-        qWarning() << "Unable to provide file - " << op->errorName() << ":" << op->errorMessage();
+        qCWarning(KTP_FTH_MODULE) << "Unable to provide file - " << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::ProvideFileError);
         q->setErrorText(i18n("Cannot provide file"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -286,25 +287,25 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onProvideFileFinished(Tp:
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onCancelOperationFinished(Tp::PendingOperation* op)
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (op->isError()) {
-        qWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
+        qCWarning(KTP_FTH_MODULE) << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::CancelFileTransferError);
         q->setErrorText(i18n("Cannot cancel outgoing file transfer"));
     }
 
-    qDebug() << "File transfer cancelled";
+    qCDebug(KTP_FTH_MODULE) << "File transfer cancelled";
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
 }
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onInvalidated()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    qWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+    qCWarning(KTP_FTH_MODULE) << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
     Q_EMIT q->infoMessage(q, i18n("File transfer invalidated. %1", channel->invalidationMessage()));
 
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
diff --git a/src/ktp-fth-debug.cpp b/src/ktp-fth-debug.cpp
new file mode 100644
index 0000000..e148309
--- /dev/null
+++ b/src/ktp-fth-debug.cpp
@@ -0,0 +1,21 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "ktp-fth-debug.h"
+Q_LOGGING_CATEGORY(KTP_FTH_MODULE, "ktp-fth-module")
\ No newline at end of file
diff --git a/src/ktp-fth-debug.h b/src/ktp-fth-debug.h
new file mode 100644
index 0000000..7c0faf7
--- /dev/null
+++ b/src/ktp-fth-debug.h
@@ -0,0 +1,26 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTP_FTH_DEBUG_H
+#define KTP_FTH_DEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(KTP_FTH_MODULE)
+
+#endif
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 31082c8..a697d6a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -95,7 +95,7 @@ int main(int argc, char* argv[])
 
     Tp::SharedPtr<FileTransferHandler> fth = Tp::SharedPtr<FileTransferHandler>(new FileTransferHandler(&app));
     if (!registrar->registerClient(Tp::AbstractClientPtr(fth), QLatin1String("KTp.FileTransferHandler"))) {
-        qDebug() << "File Transfer Handler already running. Exiting";
+        qWarning() << "File Transfer Handler already running. Exiting";
         return 1;
     }
 
diff --git a/src/telepathy-base-job.cpp b/src/telepathy-base-job.cpp
index d55f00b..fa5db2c 100644
--- a/src/telepathy-base-job.cpp
+++ b/src/telepathy-base-job.cpp
@@ -19,6 +19,7 @@
  */
 
 #include "telepathy-base-job_p.h"
+#include "ktp-fth-debug.h"
 
 #include <TelepathyQt/PendingOperation>
 
@@ -62,7 +63,7 @@ TelepathyBaseJob::~TelepathyBaseJob()
 
 void TelepathyBaseJob::setProcessedAmountAndCalculateSpeed(qulonglong amount)
 {
-    qDebug() << amount;
+    qCDebug(KTP_FTH_MODULE) << amount;
     Q_D(TelepathyBaseJob);
 
     //If the transfer is starting
@@ -108,7 +109,7 @@ void TelepathyBaseJobPrivate::__k__tpOperationFinished(Tp::PendingOperation* op)
 
 void TelepathyBaseJobPrivate::__k__doEmitResult()
 {
-    qDebug();
+    qCDebug(KTP_FTH_MODULE);
     Q_Q(TelepathyBaseJob);
 
     // Before streaming out: are there any telepathy errors?

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list