explicitly construct QUrl for new (local) skipList entries

getExistingDirectory returns a string, which we implicitly constructed
a QUrl from without using fromLocalFile() resulting in a QUrl that is
isValid && !isEmpty, but when converted toLocalFile() it will be "" as it
is !isLocal.

To resolve this problem simply construct a QUrl::fromLocalFile explicitly
to make sure that the resulting url is valid, !empty and local.

Otherwise this will attempt to insert empty strings as paths, rendering the
feature defunct.

REVIEW: 126985
This commit is contained in:
Harald Sitter 2016-02-04 10:19:49 +01:00
parent 350e0043ef
commit 95c04b7ee4

View File

@ -169,7 +169,8 @@ void SettingsDialog::toggleDontScanRemovableMedia(bool b)
void SettingsDialog::addFolder()
{
const QUrl url = QFileDialog::getExistingDirectory(this, i18n("Select path to ignore"), QDir::rootPath());
const QString urlString = QFileDialog::getExistingDirectory(this, i18n("Select path to ignore"), QDir::rootPath());
const QUrl url = QUrl::fromLocalFile(urlString);
//TODO error handling!
//TODO wrong protocol handling!