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


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

The following commit has been merged in the master branch:
commit 24e1d4448599508f3e4538731473fe9068773bcf
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Thu Nov 13 18:32:11 2014 +0100

    Finish the frameworks port
    
    REVIEW: 121112
---
 CMakeLists.txt                                    |  4 +-
 src/CMakeLists.txt                                |  8 +-
 src/filetransfer-handler.cpp                      | 19 +++--
 src/handle-incoming-file-transfer-channel-job.cpp | 89 +++++++++++------------
 src/handle-outgoing-file-transfer-channel-job.cpp | 66 ++++++++---------
 src/main.cpp                                      | 63 ++++++++++------
 src/telepathy-base-job.cpp                        |  6 +-
 7 files changed, 138 insertions(+), 117 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7dabd67..747264f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,8 +7,8 @@ set(KTP_FILETRANSFER_HANDLER_VERSION "0.8.80")
 find_package(ECM 1.3.0 REQUIRED NO_MODULE)
 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH})
 
-find_package (KF5 REQUIRED COMPONENTS KDELibs4Support)
-find_package (Qt5 REQUIRED COMPONENTS Core)
+find_package (KF5 REQUIRED COMPONENTS CoreAddons I18n KIO Config)
+find_package (Qt5 REQUIRED COMPONENTS Core DBus Widgets)
 find_package (KTp REQUIRED)
 
 include(KDEInstallDirs)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e2c5e3d..f38dde2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,7 +14,13 @@ add_executable(ktp-filetransfer-handler ${ktp_filetransfer_handler_SRCS})
 
 target_link_libraries(ktp-filetransfer-handler
             KTp::CommonInternals
-            KF5::KDELibs4Support
+            KF5::CoreAddons
+            KF5::I18n
+            KF5::KIOWidgets
+            KF5::ConfigCore
+            Qt5::Core
+            Qt5::DBus
+            Qt5::Widgets
 )
 
 configure_file(org.freedesktop.Telepathy.Client.KTp.FileTransferHandler.service.in
diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index a5fa677..d25807e 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -30,7 +30,8 @@
 #include <KConfigGroup>
 #include <KLocalizedString>
 #include <KJob>
-#include <KDebug>
+
+#include <QDebug>
 
 
 FileTransferHandler::FileTransferHandler(QObject *parent)
@@ -76,7 +77,7 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
             Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::qObjectCast(channel);
             Q_ASSERT(incomingFileTransferChannel);
 
-            kDebug() << incomingFileTransferChannel->immutableProperties();
+            qDebug() << incomingFileTransferChannel->immutableProperties();
 
             KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
             KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
@@ -87,7 +88,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"));
             }
-            kDebug() << "Download directory:" << downloadDirectory << "	 Always Ask:" << alwaysAsk;
+            qDebug() << "Download directory:" << downloadDirectory << "	 Always Ask:" << alwaysAsk;
             // TODO Check if directory exists
 
             job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, alwaysAsk, this);
@@ -95,10 +96,10 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
             Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::qObjectCast(channel);
             Q_ASSERT(outgoingFileTransferChannel);
 
-            kDebug() << outgoingFileTransferChannel->immutableProperties();
+            qDebug() << outgoingFileTransferChannel->immutableProperties();
 
             if (outgoingFileTransferChannel->uri().isEmpty()) {
-                kWarning() << "Cannot handle outgoing file transfer without URI";
+                qWarning() << "Cannot handle outgoing file transfer without URI";
                 KTp::TelepathyHandlerApplication::jobFinished();
                 continue;
             }
@@ -124,18 +125,16 @@ void FileTransferHandler::onInfoMessage(KJob* job, const QString &plain, const Q
 {
     Q_UNUSED(job);
     Q_UNUSED(rich);
-    kDebug() << plain;
+    qDebug() << plain;
 }
 
 void FileTransferHandler::handleResult(KJob* job)
 {
-    kDebug();
+    qDebug();
     if (job->error()) {
-        kWarning() << job->errorString();
+        qWarning() << job->errorString();
         // TODO do something;
     }
 
     KTp::TelepathyHandlerApplication::jobFinished();
 }
-
-#include "filetransfer-handler.moc"
diff --git a/src/handle-incoming-file-transfer-channel-job.cpp b/src/handle-incoming-file-transfer-channel-job.cpp
index efdd052..2b7560d 100644
--- a/src/handle-incoming-file-transfer-channel-job.cpp
+++ b/src/handle-incoming-file-transfer-channel-job.cpp
@@ -20,13 +20,13 @@
 #include "handle-incoming-file-transfer-channel-job.h"
 #include "telepathy-base-job_p.h"
 
-#include <QtCore/QTimer>
-#include <QtCore/QWeakPointer>
+#include <QTimer>
+#include <QUrl>
+#include <QPointer>
+#include <QDebug>
+#include <QFileDialog>
 
 #include <KLocalizedString>
-#include <KDebug>
-#include <KUrl>
-#include <KFileDialog>
 #include <kio/renamedialog.h>
 #include <kio/global.h>
 #include <kjobtrackerinterface.h>
@@ -52,7 +52,7 @@ public:
     QUrl url, partUrl;
     qulonglong offset;
     bool isResuming;
-    QWeakPointer<KIO::RenameDialog> renameDialog;
+    QPointer<KIO::RenameDialog> renameDialog;
 
     void init();
     void start();
@@ -79,7 +79,7 @@ HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::I
                                                                            QObject* parent)
     : TelepathyBaseJob(*new HandleIncomingFileTransferChannelJobPrivate(), parent)
 {
-    kDebug();
+    qDebug();
     Q_D(HandleIncomingFileTransferChannelJob);
 
     d->channel = channel;
@@ -90,20 +90,20 @@ HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::I
 
 HandleIncomingFileTransferChannelJob::~HandleIncomingFileTransferChannelJob()
 {
-    kDebug();
+    qDebug();
     KIO::getJobTracker()->unregisterJob(this);
 }
 
 void HandleIncomingFileTransferChannelJob::start()
 {
-    kDebug();
+    qDebug();
     Q_D(HandleIncomingFileTransferChannelJob);
     d->start();
 }
 
 bool HandleIncomingFileTransferChannelJob::doKill()
 {
-    kDebug() << "Incoming file transfer killed.";
+    qDebug() << "Incoming file transfer killed.";
     Q_D(HandleIncomingFileTransferChannelJob);
     return d->kill();
 }
@@ -114,21 +114,21 @@ HandleIncomingFileTransferChannelJobPrivate::HandleIncomingFileTransferChannelJo
       offset(0),
       isResuming(false)
 {
-    kDebug();
+    qDebug();
 }
 
 HandleIncomingFileTransferChannelJobPrivate::~HandleIncomingFileTransferChannelJobPrivate()
 {
-    kDebug();
+    qDebug();
 }
 
 void HandleIncomingFileTransferChannelJobPrivate::init()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (channel.isNull()) {
-        kError() << "Channel cannot be NULL";
+        qCritical() << "Channel cannot be NULL";
         q->setError(KTp::NullChannel);
         q->setErrorText(i18n("Invalid channel"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -137,7 +137,7 @@ void HandleIncomingFileTransferChannelJobPrivate::init()
 
     Tp::Features features = Tp::Features() << Tp::FileTransferChannel::FeatureCore;
     if (!channel->isReady(Tp::Features() << Tp::FileTransferChannel::FeatureCore)) {
-        kError() << "Channel must be ready with Tp::FileTransferChannel::FeatureCore";
+        qCritical() << "Channel must be ready with Tp::FileTransferChannel::FeatureCore";
         q->setError(KTp::FeatureNotReady);
         q->setErrorText(i18n("Channel is not ready"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -164,19 +164,18 @@ void HandleIncomingFileTransferChannelJobPrivate::init()
 
 void HandleIncomingFileTransferChannelJobPrivate::start()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     Q_ASSERT(!q->error());
     if (q->error()) {
-        kWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
+        qWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
 
     if (askForDownloadDirectory) {
-        url = KFileDialog::getSaveUrl(KUrl(QLatin1String("kfiledialog:///FileTransferLastDirectory/") + channel->fileName()),
-                                      QString(), 0, QString(), KFileDialog::ConfirmOverwrite);
+        url = QFileDialog::getSaveFileUrl(0, QString(), QUrl(QLatin1String("kfiledialog:///FileTransferLastDirectory/") + channel->fileName()));
 
         partUrl.setPath(url.path() + QLatin1String(".part"));
         partUrl.setScheme(QLatin1String("file"));
@@ -228,11 +227,11 @@ void HandleIncomingFileTransferChannelJobPrivate::checkFileExists()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(int result)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (!renameDialog) {
-        kWarning() << "Rename dialog was deleted during event loop.";
+        qWarning() << "Rename dialog was deleted during event loop.";
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -258,7 +257,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(in
     }
         break;
     default:
-        kWarning() << "Unknown Error";
+        qWarning() << "Unknown Error";
         q->setError(KTp::KTpError);
         q->setErrorText(i18n("Unknown Error"));
         renameDialog.data()->deleteLater();
@@ -272,7 +271,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onRenameDialogFinished(in
 
 void HandleIncomingFileTransferChannelJobPrivate::checkPartFile()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     QFileInfo fileInfo(partUrl.toLocalFile());
@@ -305,11 +304,11 @@ void HandleIncomingFileTransferChannelJobPrivate::checkPartFile()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onResumeDialogFinished(int result)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (!renameDialog) {
-        kWarning() << "Rename dialog was deleted during event loop.";
+        qWarning() << "Rename dialog was deleted during event loop.";
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -339,7 +338,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onResumeDialogFinished(in
 
 void HandleIncomingFileTransferChannelJobPrivate::receiveFile()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     // Open the .part file in append mode
@@ -358,7 +357,7 @@ void HandleIncomingFileTransferChannelJobPrivate::receiveFile()
 
 bool HandleIncomingFileTransferChannelJobPrivate::kill()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (channel->state() != Tp::FileTransferStateCancelled) {
@@ -375,13 +374,13 @@ bool HandleIncomingFileTransferChannelJobPrivate::kill()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onSetUriOperationFinished(Tp::PendingOperation* op)
 {
-    kDebug();
+    qDebug();
     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.
-        kWarning() << "Unable to set the URI -" << op->errorName() << ":" << op->errorMessage();
+        qWarning() << "Unable to set the URI -" << op->errorName() << ":" << op->errorMessage();
     }
 
     KIO::getJobTracker()->registerJob(q);
@@ -394,7 +393,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onSetUriOperationFinished
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__acceptFile()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     Q_EMIT q->description(q, i18n("Incoming file transfer"),
@@ -409,13 +408,13 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__acceptFile()
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qulonglong offset)
 {
-    kDebug() << "__k__onInitialOffsetDefined" << offset;
+    qDebug() << "__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) {
-        kDebug() << "Impossible to resume file. Restarting.";
+        qDebug() << "Impossible to resume file. Restarting.";
         Q_EMIT q->infoMessage(q, i18n("Impossible to resume file transfer. Restarting."));
     }
 
@@ -428,15 +427,15 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qu
 void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStateChanged(Tp::FileTransferState state,
                                                                                          Tp::FileTransferStateChangeReason stateReason)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    kDebug() << "Incoming file transfer channel state changed to" << state << "with reason" << stateReason;
+    qDebug() << "Incoming file transfer channel state changed to" << state << "with reason" << stateReason;
 
     switch (state) {
     case Tp::FileTransferStateNone:
         // This is bad
-        kWarning() << "An unknown error occurred.";
+        qWarning() << "An unknown error occurred.";
         q->setError(KTp::TelepathyErrorError);
         q->setErrorText(i18n("An unknown error occurred"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -450,7 +449,7 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
         file->rename(url.toLocalFile());
         file->flush();
         file->close();
-        kDebug() << "Incoming file transfer completed, saved at" << file->fileName();
+        qDebug() << "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;
@@ -476,10 +475,10 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onFileTransferChannelTransferredBytesChanged(qulonglong count)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    kDebug().nospace() << "Receiving " << channel->fileName() << " - "
+    qDebug().nospace() << "Receiving " << channel->fileName() << " - "
                        << "transferred bytes" << " = " << offset + count << " ("
                        << ((int)(((double)(offset + count) / channel->size()) * 100)) << "% done)";
     q->setProcessedAmountAndCalculateSpeed(offset + count);
@@ -489,11 +488,11 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onAcceptFileFinished(Tp::
 {
     // This method is called when the "acceptFile" operation is finished,
     // therefore the file was not received yet.
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (op->isError()) {
-        kWarning() << "Unable to accept file -" << op->errorName() << ":" << op->errorMessage();
+        qWarning() << "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()));
@@ -502,25 +501,25 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onAcceptFileFinished(Tp::
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onCancelOperationFinished(Tp::PendingOperation* op)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
     if (op->isError()) {
-        kWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
+        qWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::CancelFileTransferError);
         q->setErrorText(i18n("Cannot cancel incoming file transfer"));
     }
 
-    kDebug() << "File transfer cancelled";
+    qDebug() << "File transfer cancelled";
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
 }
 
 void HandleIncomingFileTransferChannelJobPrivate::__k__onInvalidated()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleIncomingFileTransferChannelJob);
 
-    kWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+    qWarning() << "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 af9b679..3557223 100644
--- a/src/handle-outgoing-file-transfer-channel-job.cpp
+++ b/src/handle-outgoing-file-transfer-channel-job.cpp
@@ -20,11 +20,11 @@
 #include "handle-outgoing-file-transfer-channel-job.h"
 #include "telepathy-base-job_p.h"
 
-#include <QtCore/QTimer>
+#include <QTimer>
+#include <QDebug>
+#include <QUrl>
 
 #include <KLocalizedString>
-#include <KDebug>
-#include <KUrl>
 #include <kio/global.h>
 #include <kjobtrackerinterface.h>
 
@@ -43,7 +43,7 @@ public:
 
     Tp::OutgoingFileTransferChannelPtr channel;
     QFile* file;
-    KUrl uri;
+    QUrl uri;
     qulonglong offset;
 
     void init();
@@ -63,7 +63,7 @@ HandleOutgoingFileTransferChannelJob::HandleOutgoingFileTransferChannelJob(Tp::O
                                                                            QObject* parent)
     : TelepathyBaseJob(*new HandleOutgoingFileTransferChannelJobPrivate(), parent)
 {
-    kDebug();
+    qDebug();
     Q_D(HandleOutgoingFileTransferChannelJob);
 
     d->channel = channel;
@@ -73,12 +73,12 @@ HandleOutgoingFileTransferChannelJob::HandleOutgoingFileTransferChannelJob(Tp::O
 HandleOutgoingFileTransferChannelJob::~HandleOutgoingFileTransferChannelJob()
 {
     KIO::getJobTracker()->unregisterJob(this);
-    kDebug();
+    qDebug();
 }
 
 void HandleOutgoingFileTransferChannelJob::start()
 {
-    kDebug();
+    qDebug();
     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 +87,7 @@ void HandleOutgoingFileTransferChannelJob::start()
 
 bool HandleOutgoingFileTransferChannelJob::doKill()
 {
-    kDebug() << "Outgoing file transfer killed.";
+    qDebug() << "Outgoing file transfer killed.";
     Q_D(HandleOutgoingFileTransferChannelJob);
     return d->kill();
 }
@@ -96,21 +96,21 @@ HandleOutgoingFileTransferChannelJobPrivate::HandleOutgoingFileTransferChannelJo
     : file(0),
       offset(0)
 {
-    kDebug();
+    qDebug();
 }
 
 HandleOutgoingFileTransferChannelJobPrivate::~HandleOutgoingFileTransferChannelJobPrivate()
 {
-    kDebug();
+    qDebug();
 }
 
 void HandleOutgoingFileTransferChannelJobPrivate::init()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (channel.isNull()) {
-        kError() << "Channel cannot be NULL";
+        qCritical() << "Channel cannot be NULL";
         q->setError(KTp::NullChannel);
         q->setErrorText(i18n("Invalid channel"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
@@ -119,14 +119,14 @@ void HandleOutgoingFileTransferChannelJobPrivate::init()
 
     Tp::Features features = Tp::Features() << Tp::FileTransferChannel::FeatureCore;
     if (!channel->isReady(Tp::Features() << Tp::FileTransferChannel::FeatureCore)) {
-        kError() << "Channel must be ready with Tp::FileTransferChannel::FeatureCore";
+        qCritical() << "Channel must be ready with Tp::FileTransferChannel::FeatureCore";
         q->setError(KTp::FeatureNotReady);
         q->setErrorText(i18n("Channel is not ready"));
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
 
-    uri = KUrl(channel->uri());
+    uri = QUrl(channel->uri());
     if (uri.isEmpty()) {
         qWarning() << "URI property missing";
         q->setError(KTp::UriPropertyMissing);
@@ -163,12 +163,12 @@ void HandleOutgoingFileTransferChannelJobPrivate::init()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__start()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     Q_ASSERT(!q->error());
     if (q->error()) {
-        kWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
+        qWarning() << "Job was started in error state. Something wrong happened." << q->errorString();
         QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
         return;
     }
@@ -184,7 +184,7 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__start()
 
 bool HandleOutgoingFileTransferChannelJobPrivate::kill()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (channel->state() != Tp::FileTransferStateCancelled) {
@@ -201,7 +201,7 @@ bool HandleOutgoingFileTransferChannelJobPrivate::kill()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qulonglong offset)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     this->offset = offset;
@@ -211,21 +211,21 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onInitialOffsetDefined(qu
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelStateChanged(Tp::FileTransferState state,
                                                                                          Tp::FileTransferStateChangeReason stateReason)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    kDebug() << "Outgoing file transfer channel state changed to" << state << "with reason" << stateReason;
+    qDebug() << "Outgoing file transfer channel state changed to" << state << "with reason" << stateReason;
 
     switch (state) {
     case Tp::FileTransferStateNone:
         // This is bad
-        kWarning() << "An unknown error occurred.";
+        qWarning() << "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:
-        kDebug() << "Outgoing file transfer completed";
+        qDebug() << "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 +246,11 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelStat
 
 void HandleOutgoingFileTransferChannelJobPrivate::provideFile()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     file = new QFile(uri.toLocalFile(), q->parent());
-    kDebug() << "Providing file" << file->fileName();
+    qDebug() << "Providing file" << file->fileName();
 
     Tp::PendingOperation* provideFileOperation = channel->provideFile(file);
     q->connect(provideFileOperation,
@@ -260,10 +260,10 @@ void HandleOutgoingFileTransferChannelJobPrivate::provideFile()
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelTransferredBytesChanged(qulonglong count)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    kDebug().nospace() << "Sending " << channel->fileName() << " - "
+    qDebug().nospace() << "Sending " << channel->fileName() << " - "
                        << "Transferred bytes = " << offset + count << " ("
                        << ((int)(((double)(offset + count) / channel->size()) * 100)) << "% done)";
     q->setProcessedAmountAndCalculateSpeed(offset + count);
@@ -273,11 +273,11 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onProvideFileFinished(Tp:
 {
     // This method is called when the "provideFile" operation is finished,
     // therefore the file was not sent yet.
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (op->isError()) {
-        kWarning() << "Unable to provide file - " << op->errorName() << ":" << op->errorMessage();
+        qWarning() << "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 +286,25 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onProvideFileFinished(Tp:
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onCancelOperationFinished(Tp::PendingOperation* op)
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
     if (op->isError()) {
-        kWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
+        qWarning() << "Unable to cancel file transfer - " << op->errorName() << ":" << op->errorMessage();
         q->setError(KTp::CancelFileTransferError);
         q->setErrorText(i18n("Cannot cancel outgoing file transfer"));
     }
 
-    kDebug() << "File transfer cancelled";
+    qDebug() << "File transfer cancelled";
     QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
 }
 
 void HandleOutgoingFileTransferChannelJobPrivate::__k__onInvalidated()
 {
-    kDebug();
+    qDebug();
     Q_Q(HandleOutgoingFileTransferChannelJob);
 
-    kWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+    qWarning() << "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/main.cpp b/src/main.cpp
index 03d50f0..31082c8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -20,44 +20,61 @@
 
 #include <KTp/telepathy-handler-application.h>
 
-#include <K4AboutData>
-#include <KCmdLineArgs>
-#include <KDebug>
+#include <KAboutData>
+#include <KLocalizedString>
+
+#include <QDebug>
+#include <QIcon>
+
 #include <TelepathyQt/ClientRegistrar>
 #include <TelepathyQt/FileTransferChannel>
 
 
 int main(int argc, char* argv[])
 {
-    K4AboutData aboutData("ktp-filetransfer-handler",
-                         "ktp-filetransfer-handler",
-                         ki18n("Telepathy File Transfer Handler"),
+    KAboutData aboutData("ktp-filetransfer-handler",
+                         i18n("Telepathy File Transfer Handler"),
                          KTP_FILETRANSFER_HANDLER_VERSION,
-                         ki18n("Handles your Telepathy file transfers"),
-                         K4AboutData::License_GPL_V2,
-                         ki18n("Copyright (C) 2010, 2011, 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>"));
-    aboutData.addAuthor(ki18n("Daniele E. Domenichelli"),
-                        ki18n("Developer"),
+                         i18n("Handles your Telepathy file transfers"),
+                         KAboutLicense::GPL_V2,
+                         i18n("Copyright (C) 2010, 2011, 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>"));
+    aboutData.addAuthor(i18n("Daniele E. Domenichelli"),
+                        i18n("Developer"),
                         "daniele.domenichelli at gmail.com",
                         "http://blogs.fsfe.org/drdanz/",
                         "drdanz");
-    aboutData.addCredit(ki18n("Alin M Elena"), ki18n("Contributor"), "alinm.elena at gmail.com");
-    aboutData.addCredit(ki18n("Dario Freddi"), ki18n("Contributor"), "dario.freddi at collabora.com");
-    aboutData.addCredit(ki18n("David Edmundson"), ki18n("Contributor"), "kde at davidedmundson.co.uk");
-    aboutData.addCredit(ki18n("George Kiagiadakis"), ki18n("Contributor"), "george.kiagiadakis at collabora.com");
-    aboutData.addCredit(ki18n("Martin Klapetek"), ki18n("Contributor"), "martin.klapetek at gmail.com");
-    aboutData.addCredit(ki18n("Andrea Scarpino"), ki18n("Contributor"), "andrea at archlinux.org");
-    aboutData.addCredit(ki18n("Dan Vrátil"), ki18n("Contributor"), "dvratil at redhat.com");
+    aboutData.addCredit(i18n("Alin M Elena"), i18n("Contributor"), "alinm.elena at gmail.com");
+    aboutData.addCredit(i18n("Dario Freddi"), i18n("Contributor"), "dario.freddi at collabora.com");
+    aboutData.addCredit(i18n("David Edmundson"), i18n("Contributor"), "kde at davidedmundson.co.uk");
+    aboutData.addCredit(i18n("George Kiagiadakis"), i18n("Contributor"), "george.kiagiadakis at collabora.com");
+    aboutData.addCredit(i18n("Martin Klapetek"), i18n("Contributor"), "martin.klapetek at gmail.com");
+    aboutData.addCredit(i18n("Andrea Scarpino"), i18n("Contributor"), "andrea at archlinux.org");
+    aboutData.addCredit(i18n("Dan Vrátil"), i18n("Contributor"), "dvratil at redhat.com");
 
 
     aboutData.setProductName("telepathy/filetransfer");
-    aboutData.setTranslator(ki18nc("NAME OF TRANSLATORS", "Your names"),
-                            ki18nc("EMAIL OF TRANSLATORS", "Your emails"));
-    aboutData.setProgramIconName(QLatin1String("telepathy-kde"));
     aboutData.setHomepage("http://community.kde.org/KTp");
 
-    KCmdLineArgs::init(argc, argv, &aboutData);
+    KAboutData::setApplicationData(aboutData);
+
+    // This is a very very very ugly hack that attempts to solve the following problem:
+    // D-Bus service activated applications inherit the environment of dbus-daemon.
+    // Normally, in KDE, startkde sets these environment variables. However, the session's
+    // dbus-daemon is started before this happens, which means that dbus-daemon does NOT
+    // have these variables in its environment and therefore all service-activated UIs
+    // think that they are not running in KDE. This causes Qt not to load the KDE platform
+    // plugin, which leaves the UI in a sorry state, using a completely wrong theme,
+    // wrong colors, etc...
+    // See also:
+    // - https://bugs.kde.org/show_bug.cgi?id=269861
+    // - https://bugs.kde.org/show_bug.cgi?id=267770
+    // - https://git.reviewboard.kde.org/r/102194/
+    // Here we are just going to assume that kde-telepathy is always used in KDE and
+    // not anywhere else. This is probably the best that we can do.
+    setenv("KDE_FULL_SESSION", "true", 0);
+    setenv("KDE_SESSION_VERSION", "5", 0);
     KTp::TelepathyHandlerApplication app(argc, argv);
+    app.setWindowIcon(QIcon::fromTheme(QStringLiteral("telepathy-kde")));
 
     Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus());
 
@@ -78,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"))) {
-        kDebug() << "File Transfer Handler already running. Exiting";
+        qDebug() << "File Transfer Handler already running. Exiting";
         return 1;
     }
 
diff --git a/src/telepathy-base-job.cpp b/src/telepathy-base-job.cpp
index f1ac0e6..d55f00b 100644
--- a/src/telepathy-base-job.cpp
+++ b/src/telepathy-base-job.cpp
@@ -23,7 +23,7 @@
 #include <TelepathyQt/PendingOperation>
 
 #include <KLocalizedString>
-#include <KDebug>
+#include <QDebug>
 
 using namespace KTp;
 
@@ -62,7 +62,7 @@ TelepathyBaseJob::~TelepathyBaseJob()
 
 void TelepathyBaseJob::setProcessedAmountAndCalculateSpeed(qulonglong amount)
 {
-    kDebug() << amount;
+    qDebug() << amount;
     Q_D(TelepathyBaseJob);
 
     //If the transfer is starting
@@ -108,7 +108,7 @@ void TelepathyBaseJobPrivate::__k__tpOperationFinished(Tp::PendingOperation* op)
 
 void TelepathyBaseJobPrivate::__k__doEmitResult()
 {
-    kDebug();
+    qDebug();
     Q_Q(TelepathyBaseJob);
 
     // Before streaming out: are there any telepathy errors?

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list