From 6549da84be5558d80f78b208b624e08024a62c08 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 6 Jun 2014 00:02:27 +0200 Subject: [PATCH] Incoming shared files can now be placed in device-dependent dirs. --- kded/plugins/share/share_config.cpp | 2 +- kded/plugins/share/share_config.ui | 11 +++++++++-- kded/plugins/share/shareplugin.cpp | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/kded/plugins/share/share_config.cpp b/kded/plugins/share/share_config.cpp index 55d2f511f..d04bf0788 100644 --- a/kded/plugins/share/share_config.cpp +++ b/kded/plugins/share/share_config.cpp @@ -70,7 +70,7 @@ void ShareConfig::load() void ShareConfig::save() { - m_cfg->group("receive").writeEntry("path", m_ui->kurlrequester->url()); + m_cfg->group("receive").writeEntry("path", m_ui->kurlrequester->text()); KCModule::save(); diff --git a/kded/plugins/share/share_config.ui b/kded/plugins/share/share_config.ui index 5f355e44c..d6f618fb7 100644 --- a/kded/plugins/share/share_config.ui +++ b/kded/plugins/share/share_config.ui @@ -9,8 +9,8 @@ 0 0 - 411 - 165 + 569 + 140 @@ -47,6 +47,13 @@ + + + + %1 in the path will be replaced with the specific device name. + + + diff --git a/kded/plugins/share/shareplugin.cpp b/kded/plugins/share/shareplugin.cpp index 00ccac937..5520a39f0 100644 --- a/kded/plugins/share/shareplugin.cpp +++ b/kded/plugins/share/shareplugin.cpp @@ -52,11 +52,13 @@ KUrl SharePlugin::destinationDir() const KUrl dir = config->group("receive").readEntry("path", KGlobalSettings::downloadPath()); dir.adjustPath(KUrl::AddTrailingSlash); - QDir().mkpath(dir.toLocalFile()); + QString url = dir.toLocalFile(); + if (url.contains("%1")) url = url.arg(device()->name()); - kDebug(kdeconnect_kded()) << dir; + kDebug(kdeconnect_kded()) << url; + QDir().mkpath(url); - return dir; + return url; } bool SharePlugin::receivePackage(const NetworkPackage& np)