From: Arjun AK Date: Mon, 1 Dec 2014 12:01:39 +0000 (+0530) Subject: Fix KUrl -> QUrl porting error X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/1d7b3b8df525d72126c716c9809c058f481e873e Fix KUrl -> QUrl porting error Trailing slashes should be removed before calling QUrl::filename(), else it will return an empty string. BUG: 341411 REVIEW: 121293 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 81aa1e810..526f80474 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -969,7 +969,11 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url) } } - const QString fileName = url.fileName().isEmpty() ? "/" : url.fileName(); + QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName(); + if (fileName.isEmpty()) { + fileName = '/'; + } + caption.append(fileName); setCaption(caption); diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index b38cd5146..a0c9b9d81 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -348,7 +348,7 @@ QString DolphinTabWidget::tabName(const QUrl& url) const if (url == QUrl("file:///")) { name = '/'; } else { - name = url.fileName(); + name = url.adjusted(QUrl::StripTrailingSlash).fileName(); if (name.isEmpty()) { name = url.scheme(); } else {