[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:27:56 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=aead283

The following commit has been merged in the master branch:
commit aead283da14eb460af009ddadfb74b410ca6400b
Author: Àlex Fiestas <afiestas at kde.org>
Date:   Sun Sep 21 22:24:37 2014 +0200

    Port shareplugin to QUrl
    
    Had to instance QUrl using fromLocalFile since our
    kconfig/KGlobalSettings are not setting the scheme (aka returning
    /home/user instead of file:///home/user).
    
    Tested, it works great.
---
 plugins/share/shareplugin.cpp | 22 +++++++++++++++-------
 plugins/share/shareplugin.h   |  2 +-
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp
index 1768f0f..09e2bb0 100644
--- a/plugins/share/shareplugin.cpp
+++ b/plugins/share/shareplugin.cpp
@@ -45,15 +45,21 @@ SharePlugin::SharePlugin(QObject* parent, const QVariantList& args)
 {
 }
 
-KUrl SharePlugin::destinationDir() const
+QUrl SharePlugin::destinationDir() const
 {
     //FIXME: There should be a better way to listen to changes in the config file instead of reading the value each time
     KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnect/plugins/share");
-    KUrl dir = config->group("receive").readEntry("path", KGlobalSettings::downloadPath());
-    dir.adjustPath(KUrl::AddTrailingSlash);
+    QUrl dir = QUrl::fromLocalFile(config->group("receive").readEntry("path", KGlobalSettings::downloadPath()));
+
+    if (!dir.path().endsWith('/')) {
+        dir.setPath(dir.path() + '/');
+    }
 
     QString url = dir.toLocalFile();
-    if (url.contains("%1")) url = url.arg(device()->name());
+
+    if (url.contains("%1")) {
+        url = url.arg(device()->name());
+    }
 
     kDebug(debugArea()) << url;
     QDir().mkpath(url);
@@ -88,8 +94,9 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
     if (np.hasPayload()) {
         //kDebug(debugArea()) << "receiving file";
         QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
-        KUrl destination = destinationDir();
-        destination.addPath(filename);
+        QUrl destination = destinationDir();
+        destination = destination.adjusted(QUrl::StripTrailingSlash);
+        destination.setPath(destination.path() + '/' + filename);
         FileTransferJob* job = np.createPayloadTransferJob(destination);
         job->setDeviceName(device()->name());
         connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));
@@ -146,11 +153,12 @@ void SharePlugin::openDestinationFolder()
 
 void SharePlugin::shareUrl(const QUrl& url)
 {
+    qDebug() << url;
     NetworkPackage package(PACKAGE_TYPE_SHARE);
     if(url.isLocalFile()) {
         QSharedPointer<QIODevice> ioFile(new QFile(url.toLocalFile()));
         package.setPayload(ioFile, ioFile->size());
-        package.set<QString>("filename", KUrl(url).fileName());
+        package.set<QString>("filename", QUrl(url).fileName());
     } else {
         package.set<QString>("url", url.toString());
     }
diff --git a/plugins/share/shareplugin.h b/plugins/share/shareplugin.h
index 72c79d2..de00693 100644
--- a/plugins/share/shareplugin.h
+++ b/plugins/share/shareplugin.h
@@ -51,7 +51,7 @@ private:
     void shareUrl(const QUrl& url);
 
     QString dbusPath() const;
-    KUrl destinationDir() const;
+    QUrl destinationDir() const;
 
 };
 #endif

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list