]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix KUrl -> QUrl porting error
authorArjun AK <arjunak234@gmail.com>
Mon, 1 Dec 2014 12:01:39 +0000 (17:31 +0530)
committerArjun AK <arjunak234@gmail.com>
Mon, 1 Dec 2014 12:01:39 +0000 (17:31 +0530)
Trailing slashes should be removed before calling QUrl::filename(),
else it will return an empty string.

BUG: 341411
REVIEW: 121293

src/dolphinmainwindow.cpp
src/dolphintabwidget.cpp

index 81aa1e81062bb263b8fac90cc4c82cf5801f2c9b..526f8047459dcde41024715b6e7546406ff4a512 100644 (file)
@@ -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);
index b38cd5146140e51eec3ca9847a8662cd24b6b42d..a0c9b9d8198269bcf9c560106332cdf0dd9b45a7 100644 (file)
@@ -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 {