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

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:28:17 UTC 2016


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

The following commit has been merged in the master branch:
commit 72411fc5044da5a3764385d9f77f2885de98231a
Author: Aleix Pol <aleixpol at kde.org>
Date:   Wed Mar 4 23:20:28 2015 +0100

    Simplify weird code
    
    Don't assume destination is local, also don't use setPath, which is quite
    broken as it still keeps the scheme.
    This way, destination can be any valid URL.
    Don't add a trailing slash if we're going to remove it afterwards anyway.
    Remove some back-and-forth conversions between QUrl and QString.
---
 plugins/share/shareplugin.cpp | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp
index 75ea0f9..2c1566b 100644
--- a/plugins/share/shareplugin.cpp
+++ b/plugins/share/shareplugin.cpp
@@ -52,22 +52,16 @@ 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");
     const QString downloadPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
-    QUrl dir = QUrl::fromLocalFile(config->group("receive").readEntry("path", downloadPath));
+    QString dir = config->group("receive").readEntry("path", downloadPath);
 
-    if (!dir.toLocalFile().endsWith('/')) {
-        dir.setPath(dir.toLocalFile() + '/');
+    if (dir.contains("%1")) {
+        dir = dir.arg(device()->name());
     }
 
-    QString url = dir.toLocalFile();
+//     qCDebug(KDECONNECT_PLUGIN_SHARE) << dir;
+    QDir().mkpath(dir);
 
-    if (url.contains("%1")) {
-        url = url.arg(device()->name());
-    }
-
-    qCDebug(KDECONNECT_PLUGIN_SHARE) << url;
-    QDir().mkpath(url);
-
-    return url;
+    return QUrl(dir);
 }
 
 bool SharePlugin::receivePackage(const NetworkPackage& np)
@@ -96,10 +90,9 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
 
     if (np.hasPayload()) {
         //qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file";
-        QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
-        QUrl destination = destinationDir();
-        destination = destination.adjusted(QUrl::StripTrailingSlash);
-        destination.setPath(destination.toLocalFile() + '/' + filename);
+        const QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
+        const QString dir = destinationDir().adjusted(QUrl::StripTrailingSlash).toString();
+        const QUrl destination(dir + '/' + filename);
         FileTransferJob* job = np.createPayloadTransferJob(destination);
         job->setDeviceName(device()->name());
         connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list