Commit 2770fe4e authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

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

parent 59214620
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment