[rkward/frameworks] rkward/misc: Ok, next try: Do not mess with empty intial urls, but do adjust the start dir of the file selector.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Sep 14 16:32:42 UTC 2016


Git commit 2770fe4e12c5d24260b16d6048ab7e8e8529d411 by Thomas Friedrichsmeier.
Committed on 14/09/2016 at 16:30.
Pushed by tfry into branch 'frameworks'.

Ok, next try: Do not mess with empty intial urls, but do adjust the start dir of the file selector.

M  +17   -17   rkward/misc/getfilenamewidget.cpp

http://commits.kde.org/rkward/2770fe4e12c5d24260b16d6048ab7e8e8529d411

diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp
index a1e3cb1..6b7f1d2 100644
--- a/rkward/misc/getfilenamewidget.cpp
+++ b/rkward/misc/getfilenamewidget.cpp
@@ -61,25 +61,25 @@ GetFileNameWidget::GetFileNameWidget (QWidget *parent, FileType mode, bool only_
 	if (only_local) mode_flags |= KFile::LocalOnly;
 	edit->setMode (mode_flags);
 
-	if (!initial.isEmpty ()) {
-		QString append = initial;
-		if (initial.startsWith ('<')) {
-			storage_key = initial.section ('>', 0, 0).mid (1);
-			append = initial.section ('>', 1);
-		}
-		QUrl initial_url = RKSettingsModuleGeneral::lastUsedUrlFor (storage_key);  // storage_key == QString () in the default case is intended
-		if (!append.isEmpty ()) {
-			if (initial_url.isLocalFile ()) {
-				initial_url = QUrl::fromUserInput (append, initial_url.toLocalFile (), QUrl::AssumeLocalFile);
-			} else {
-				initial_url.setPath (initial_url.path () + '/' + append);
-			}
-			initial_url = initial_url.adjusted (QUrl::NormalizePathSegments);
-		}
-		if (initial_url.isLocalFile () || !only_local) {
-			edit->setUrl (initial_url);
+	QString append = initial;
+	if (initial.startsWith ('<')) {
+		storage_key = initial.section ('>', 0, 0).mid (1);
+		append = initial.section ('>', 1);
+	}
+	QUrl initial_url = RKSettingsModuleGeneral::lastUsedUrlFor (storage_key);  // storage_key == QString () in the default case is intended
+	if (!append.isEmpty ()) {
+		if (initial_url.isLocalFile ()) {
+			initial_url = QUrl::fromUserInput (append, initial_url.toLocalFile (), QUrl::AssumeLocalFile);
+		} else {
+			initial_url.setPath (initial_url.path () + '/' + append);
 		}
+		initial_url = initial_url.adjusted (QUrl::NormalizePathSegments);
 	}
+	if (initial_url.isLocalFile () || !only_local) {
+		if (!initial.isEmpty ()) edit->setUrl (initial_url);
+		else edit->setStartDir (initial_url);
+	}
+
 	connect (edit, &KUrlRequester::textChanged, this, &GetFileNameWidget::locationEditChanged);
 	connect (edit, &KUrlRequester::urlSelected, this, &GetFileNameWidget::updateLastUsedUrl);
 



More information about the rkward-tracker mailing list