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

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


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

The following commit has been merged in the master branch:
commit 1f9176ad9212935a37df9270bf4ffd6d18be0cbe
Author: Aleix Pol <aleixpol at kde.org>
Date:   Sun Mar 2 00:50:11 2014 +0100

    Simplify path handling in the share plugin
    
    Prefer ::toLocalFile() to ::path(). ::path() won't work on Windows properly.
    Let KUrl handle the trailing slash adjusting, no need to do the string
    handling ourselves.
    Take advantage of the fact that it can be a url, at the moment it was just
    doing silly type conversions.
    
    REVIEW: 116484
---
 kded/plugins/share/shareplugin.cpp | 16 ++++++++--------
 kded/plugins/share/shareplugin.h   |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kded/plugins/share/shareplugin.cpp b/kded/plugins/share/shareplugin.cpp
index 480faef..0f78534 100644
--- a/kded/plugins/share/shareplugin.cpp
+++ b/kded/plugins/share/shareplugin.cpp
@@ -44,17 +44,14 @@ SharePlugin::SharePlugin(QObject* parent, const QVariantList& args)
 
 }
 
-QString SharePlugin::destinationDir()
+KUrl SharePlugin::destinationDir() const
 {
-    QString defaultPath = KGlobalSettings::downloadPath();
-
     //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");
-    QString dir = config->group("receive").readEntry("path", defaultPath);
-
-    if (!dir.endsWith('/')) dir.append('/');
+    KUrl dir = config->group("receive").readEntry("path", KGlobalSettings::downloadPath());
+    dir.adjustPath(KUrl::AddTrailingSlash);
 
-    QDir().mkpath(KUrl(dir).path()); //Using KUrl to remove file:/// protocol, wich seems to confuse QDir.mkpath
+    QDir().mkpath(dir.toLocalFile());
 
     kDebug(kdeconnect_kded()) << dir;
 
@@ -89,7 +86,10 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
         //kDebug(kdeconnect_kded()) << "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(destinationDir() + filename);
+
+        KUrl destination = destinationDir();
+        destination.addPath(filename);
+        FileTransferJob* job = np.createPayloadTransferJob(destination);
         connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));
         job->start();
     } else if (np.has("text")) {
diff --git a/kded/plugins/share/shareplugin.h b/kded/plugins/share/shareplugin.h
index 119658f..13de2d7 100644
--- a/kded/plugins/share/shareplugin.h
+++ b/kded/plugins/share/shareplugin.h
@@ -45,7 +45,7 @@ private Q_SLOTS:
     void openDestinationFolder();
 
 private:
-    QString destinationDir();
+    KUrl destinationDir() const;
 
 };
 #endif

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list