[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:26 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=15f87cc
The following commit has been merged in the master branch:
commit 15f87cc46dcffbfb3ff7104aaa537bf288ddc931
Author: Aleix Pol <aleixpol at kde.org>
Date: Wed Apr 1 23:32:35 2015 +0200
Port to KIO::suggestName
Removes the duplicated code.
REVIEW: 123215
---
plugins/share/shareplugin.cpp | 42 ++----------------------------------------
1 file changed, 2 insertions(+), 40 deletions(-)
diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp
index 5a19b30..65d07f0 100644
--- a/plugins/share/shareplugin.cpp
+++ b/plugins/share/shareplugin.cpp
@@ -40,41 +40,6 @@ K_PLUGIN_FACTORY_WITH_JSON( KdeConnectPluginFactory, "kdeconnect_share.json", re
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SHARE, "kdeconnect.plugin.share");
-static void autoincFilename(QUrl &filename)
-{
- // Extract the filename from the path
- QString name= filename.fileName();
-
- // If the name contains a number then increment it
- QRegExp numSearch( "(^|[^\d])(\d+)" ); // we want to match as far left as possible, and when the number is at the start of the name
-
- // Does it have a number?
- int start = numSearch.lastIndexIn( name );
- if (start != -1) {
- // It has a number, increment it
- start = numSearch.pos( 2 ); // we are only interested in the second group
- QString numAsStr = numSearch.cap(2);
- QString number = QString::number( numAsStr.toInt() + 1 );
- number = number.rightJustified( numAsStr.length(), '0' );
- name.replace( start, numAsStr.length(), number );
- }
- else {
- // no number
- start = name.lastIndexOf('.');
- if (start != -1) {
- // has a . somewhere, e.g. it has an extension
- name.insert(start, '1');
- }
- else {
- // no extension, just tack it on to the end
- name += '1';
- }
- }
-
- //Rebuild the path
- filename.setPath( filename.adjusted(QUrl::RemoveFilename).toLocalFile() + name );
-}
-
SharePlugin::SharePlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
@@ -124,11 +89,8 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
if (np.hasPayload()) {
//qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file";
const QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
- const QString dir = destinationDir().adjusted(QUrl::StripTrailingSlash).toString();
- QUrl destination(dir + '/' + filename);
- while (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) {
- autoincFilename(destination);
- }
+ const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash);
+ const QUrl destination(dir.toString() + '/' + KIO::suggestName(dir, filename));
FileTransferJob* job = np.createPayloadTransferJob(destination);
job->setDeviceName(device()->name());
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list