[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:03 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=a06cf67
The following commit has been merged in the master branch:
commit a06cf677f417c9543b9f18e213f10b59be5d9c06
Author: Albert Vaca <albertvaka at gmail.com>
Date: Tue Oct 1 02:44:49 2013 +0200
Added button to open incoming file transfer's folder in browser
---
kded/filetransferjob.cpp | 4 ++--
kded/plugins/filetransfer/filetransferplugin.cpp | 11 +++++++++--
kded/plugins/filetransfer/filetransferplugin.h | 4 +++-
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/kded/filetransferjob.cpp b/kded/filetransferjob.cpp
index ce597ee..bc40366 100644
--- a/kded/filetransferjob.cpp
+++ b/kded/filetransferjob.cpp
@@ -28,6 +28,7 @@
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const KUrl& destination): KJob()
{
Q_ASSERT(destination.isLocalFile());
+ //TODO: Make a precondition before calling this function that destination file exists
QFile(destination.path()).open(QIODevice::WriteOnly | QIODevice::Truncate); //HACK: KIO is so dumb it can't create the file if it doesn't exist
mDestination = KIO::open(destination, QIODevice::WriteOnly);
connect(mDestination, SIGNAL(open(KIO::Job*)), this, SLOT(open(KIO::Job*)));
@@ -86,9 +87,8 @@ void FileTransferJob::readyRead()
}
if (mSize > -1 && mWritten >= mSize) { //At the end or expected size reached
- qDebug() << "No more data to read";
- disconnect(mOrigin.data(), SIGNAL(readyRead()),this, SLOT(readyRead()));
mOrigin->close();
+ //sourceFinished();
} else if (mOrigin->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
}
diff --git a/kded/plugins/filetransfer/filetransferplugin.cpp b/kded/plugins/filetransfer/filetransferplugin.cpp
index bbf5caf..13b56cb 100644
--- a/kded/plugins/filetransfer/filetransferplugin.cpp
+++ b/kded/plugins/filetransfer/filetransferplugin.cpp
@@ -65,12 +65,14 @@ bool FileTransferPlugin::receivePackage(const NetworkPackage& np)
}
*/
+
if (np.type() != PACKAGE_TYPE_FILETRANSFER) return false;
qDebug() << "File transfer";
if (np.hasPayload()) {
- qDebug() << "receiving file";
+ //qDebug() << "receiving file";
QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
+ //TODO: Ask before overwritting or rename file if it already exists
FileTransferJob* job = np.createPayloadTransferJob(mDestinationDir + filename);
connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));
job->start();
@@ -111,7 +113,12 @@ void FileTransferPlugin::finished(KJob* job)
notification->setComponentData(KComponentData("kdeconnect", "kdeconnect"));
notification->setTitle(i18n("Transfer finished"));
notification->setText(transferJob->destination().fileName());
- //TODO: Add action "open destination folder"
+ notification->setActions(QStringList(i18n("Open destination folder")));
+ connect(notification, SIGNAL(action1Activated()), this, SLOT(openDestinationFolder()));
notification->sendEvent();
+}
+void FileTransferPlugin::openDestinationFolder()
+{
+ QDesktopServices::openUrl(mDestinationDir);
}
diff --git a/kded/plugins/filetransfer/filetransferplugin.h b/kded/plugins/filetransfer/filetransferplugin.h
index f9fa786..1b49f7a 100644
--- a/kded/plugins/filetransfer/filetransferplugin.h
+++ b/kded/plugins/filetransfer/filetransferplugin.h
@@ -39,9 +39,11 @@ public Q_SLOTS:
virtual void connected() { }
void finished(KJob*);
+private Q_SLOTS:
+ void openDestinationFolder();
+
private:
QString mDestinationDir;
};
-
#endif
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list