[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:43 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-filetransfer-handler.git;a=commitdiff;h=b5c526c
The following commit has been merged in the master branch:
commit b5c526c8a61f82f78ba49648be1347b41cdea7ae
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date: Wed Sep 28 19:35:33 2011 +0100
Move initialization in a private init method
---
src/handle-incoming-file-transfer-channel-job.cpp | 76 ++++++++------
src/handle-outgoing-file-transfer-channel-job.cpp | 119 ++++++++++++----------
2 files changed, 109 insertions(+), 86 deletions(-)
diff --git a/src/handle-incoming-file-transfer-channel-job.cpp b/src/handle-incoming-file-transfer-channel-job.cpp
index 630dfb6..ee5c1fb 100644
--- a/src/handle-incoming-file-transfer-channel-job.cpp
+++ b/src/handle-incoming-file-transfer-channel-job.cpp
@@ -49,6 +49,7 @@ class HandleIncomingFileTransferChannelJobPrivate : public KTelepathy::Telepathy
qulonglong offset;
QFile* file;
+ void init();
void start();
void __k__onSetUriOperationFinished(Tp::PendingOperation* op);
@@ -69,37 +70,7 @@ HandleIncomingFileTransferChannelJob::HandleIncomingFileTransferChannelJob(Tp::I
d->channel = channel;
d->downloadDirectory = downloadDirectory;
-
- if (channel.isNull())
- {
- kError() << "Channel cannot be NULL";
- setError(KTelepathy::NullChannel);
- setErrorText(i18n("Invalid channel"));
- return;
- }
-
- 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";
- setError(KTelepathy::FeatureNotReady);
- setErrorText(i18n("Channel is not ready"));
- return;
- }
-
- KIO::getJobTracker()->registerJob(this);
- setCapabilities(KJob::Killable);
- setTotalAmount(KJob::Bytes, channel->size());
-
- connect(channel.data(),
- SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
- SLOT(__k__onInvalidated()));
- connect(channel.data(),
- SIGNAL(stateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)),
- SLOT(__k__onFileTransferChannelStateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)));
- connect(channel.data(),
- SIGNAL(transferredBytesChanged(qulonglong)),
- SLOT(__k__onFileTransferChannelTransferredBytesChanged(qulonglong)));
+ d->init();
}
HandleIncomingFileTransferChannelJob::~HandleIncomingFileTransferChannelJob()
@@ -138,6 +109,45 @@ HandleIncomingFileTransferChannelJobPrivate::~HandleIncomingFileTransferChannelJ
kDebug();
}
+void HandleIncomingFileTransferChannelJobPrivate::init()
+{
+ kDebug();
+ Q_Q(HandleIncomingFileTransferChannelJob);
+
+ if (channel.isNull())
+ {
+ kError() << "Channel cannot be NULL";
+ q->setError(KTelepathy::NullChannel);
+ q->setErrorText(i18n("Invalid channel"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+
+ 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";
+ q->setError(KTelepathy::FeatureNotReady);
+ q->setErrorText(i18n("Channel is not ready"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+
+ KIO::getJobTracker()->registerJob(q);
+ q->setCapabilities(KJob::Killable);
+ q->setTotalAmount(KJob::Bytes, channel->size());
+
+ q->connect(channel.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
+ SLOT(__k__onInvalidated()));
+ q->connect(channel.data(),
+ SIGNAL(stateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)),
+ SLOT(__k__onFileTransferChannelStateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)));
+ q->connect(channel.data(),
+ SIGNAL(transferredBytesChanged(qulonglong)),
+ SLOT(__k__onFileTransferChannelTransferredBytesChanged(qulonglong)));
+}
+
void HandleIncomingFileTransferChannelJobPrivate::start()
{
kDebug();
@@ -324,8 +334,8 @@ void HandleIncomingFileTransferChannelJobPrivate::__k__onInvalidated()
kDebug();
Q_Q(HandleIncomingFileTransferChannelJob);
- kWarning() << "File transfer invalidated!";
- Q_EMIT q->infoMessage(q, i18n("File transfer invalidated."));
+ kWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+ Q_EMIT q->infoMessage(q, i18n("File transfer invalidated. %1").arg(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 928c15e..e487489 100644
--- a/src/handle-outgoing-file-transfer-channel-job.cpp
+++ b/src/handle-outgoing-file-transfer-channel-job.cpp
@@ -43,7 +43,9 @@ class HandleOutgoingFileTransferChannelJobPrivate : public KTelepathy::Telepathy
Tp::OutgoingFileTransferChannelPtr channel;
QFile* file;
+ KUrl uri;
+ void init();
void start();
void provideFile();
@@ -62,37 +64,7 @@ HandleOutgoingFileTransferChannelJob::HandleOutgoingFileTransferChannelJob(Tp::O
Q_D(HandleOutgoingFileTransferChannelJob);
d->channel = channel;
-
- if (channel.isNull())
- {
- kError() << "Channel cannot be NULL";
- setError(KTelepathy::NullChannel);
- setErrorText(i18n("Invalid channel"));
- return;
- }
-
- 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";
- setError(KTelepathy::FeatureNotReady);
- setErrorText(i18n("Channel is not ready"));
- return;
- }
-
- KIO::getJobTracker()->registerJob(this);
- setCapabilities(KJob::Killable);
- setTotalAmount(KJob::Bytes, channel->size());
-
- connect(channel.data(),
- SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
- SLOT(__k__onInvalidated()));
- connect(channel.data(),
- SIGNAL(stateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)),
- SLOT(__k__onFileTransferChannelStateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)));
- connect(channel.data(),
- SIGNAL(transferredBytesChanged(qulonglong)),
- SLOT(__k__onFileTransferChannelTransferredBytesChanged(qulonglong)));
+ d->init();
}
HandleOutgoingFileTransferChannelJob::~HandleOutgoingFileTransferChannelJob()
@@ -131,6 +103,64 @@ HandleOutgoingFileTransferChannelJobPrivate::~HandleOutgoingFileTransferChannelJ
kDebug();
}
+void HandleOutgoingFileTransferChannelJobPrivate::init()
+{
+ kDebug();
+ Q_Q(HandleOutgoingFileTransferChannelJob);
+
+ if (channel.isNull())
+ {
+ kError() << "Channel cannot be NULL";
+ q->setError(KTelepathy::NullChannel);
+ q->setErrorText(i18n("Invalid channel"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+
+ 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";
+ q->setError(KTelepathy::FeatureNotReady);
+ q->setErrorText(i18n("Channel is not ready"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+
+ uri = KUrl(channel->uri());
+ if (uri.isEmpty())
+ {
+ qWarning() << "URI property missing";
+ q->setError(KTelepathy::UriPropertyMissing);
+ q->setErrorText(i18n("URI property is missing"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+ if (!uri.isLocalFile())
+ {
+ // TODO handle this!
+ qWarning() << "Not a local file";
+ q->setError(KTelepathy::NotALocalFile);
+ q->setErrorText(i18n("This is not a local file"));
+ QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
+ return;
+ }
+
+ KIO::getJobTracker()->registerJob(q);
+ q->setCapabilities(KJob::Killable);
+ q->setTotalAmount(KJob::Bytes, channel->size());
+
+ q->connect(channel.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
+ SLOT(__k__onInvalidated()));
+ q->connect(channel.data(),
+ SIGNAL(stateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)),
+ SLOT(__k__onFileTransferChannelStateChanged(Tp::FileTransferState, Tp::FileTransferStateChangeReason)));
+ q->connect(channel.data(),
+ SIGNAL(transferredBytesChanged(qulonglong)),
+ SLOT(__k__onFileTransferChannelTransferredBytesChanged(qulonglong)));
+}
+
void HandleOutgoingFileTransferChannelJobPrivate::start()
{
kDebug();
@@ -194,31 +224,14 @@ void HandleOutgoingFileTransferChannelJobPrivate::provideFile()
{
kDebug();
Q_Q(HandleOutgoingFileTransferChannelJob);
- KUrl uri(channel->uri());
- if (uri.isEmpty())
- {
- qWarning() << "URI property missing";
- q->setError(KTelepathy::UriPropertyMissing);
- q->setErrorText(i18n("URI property is missing"));
- QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
- return;
- }
- if (!uri.isLocalFile())
- {
- // TODO handle this!
- qWarning() << "Not a local file";
- q->setError(KTelepathy::NotALocalFile);
- q->setErrorText(i18n("This is not a local file"));
- QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
- return;
- }
file = new QFile(uri.toLocalFile(), q->parent());
kDebug() << "Providing file" << file->fileName();
Tp::PendingOperation* provideFileOperation = channel->provideFile(file);
- q->connect(provideFileOperation, SIGNAL(finished(Tp::PendingOperation*)),
- q, SLOT(__k__onProvideFileFinished(Tp::PendingOperation*)));
+ q->connect(provideFileOperation,
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(__k__onProvideFileFinished(Tp::PendingOperation*)));
}
void HandleOutgoingFileTransferChannelJobPrivate::__k__onFileTransferChannelTransferredBytesChanged(qulonglong count)
@@ -269,8 +282,8 @@ void HandleOutgoingFileTransferChannelJobPrivate::__k__onInvalidated()
kDebug();
Q_Q(HandleOutgoingFileTransferChannelJob);
- kWarning() << "File transfer invalidated!";
- Q_EMIT q->infoMessage(q, i18n("File transfer invalidated."));
+ kWarning() << "File transfer invalidated!" << channel->invalidationMessage() << "reason" << channel->invalidationReason();
+ Q_EMIT q->infoMessage(q, i18n("File transfer invalidated. %1").arg(channel->invalidationMessage()));
QTimer::singleShot(0, q, SLOT(__k__doEmitResult()));
}
--
ktp-filetransfer-handler packaging
More information about the pkg-kde-commits
mailing list