]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Do not display full path in the title of the tab
authorAntonio Prcela <antonio.prcela@gmail.com>
Wed, 15 Apr 2020 15:29:17 +0000 (09:29 -0600)
committerNate Graham <nate@kde.org>
Wed, 15 Apr 2020 15:47:57 +0000 (09:47 -0600)
Summary:
Displays the full path only in the window title, not in the tab title.

Screenshot for comparison: ( Dolphin on the right is without D28815 , Dolphin on left has both D28815 and this patch)

{F8240079}

Reviewers: #vdg, #dolphin, ngraham, meven

Reviewed By: #vdg, #dolphin, ngraham, meven

Subscribers: ngraham, elvisangelaccio, meven, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28857

src/dolphinmainwindow.cpp
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h

index 9fe870044f73e89c6e7ef7efcf71149c41e757ff..37f6bb8e461f43a6e686e23e74e105f8af5f9f9c 100644 (file)
@@ -1269,7 +1269,7 @@ void DolphinMainWindow::tabCountChanged(int count)
 
 void DolphinMainWindow::updateWindowTitle()
 {
-    const QString newTitle = m_activeViewContainer->caption();
+    const QString newTitle = m_activeViewContainer->captionWindowTitle();
     if (windowTitle() != newTitle) {
         setWindowTitle(newTitle);
     }
index 3a17805ab8916667d15752c942c699fdcccc1b24..0681c67d9929ed41f2706a3fb644484b6316c0b5 100644 (file)
@@ -449,6 +449,18 @@ void DolphinViewContainer::reload()
     m_messageWidget->hide();
 }
 
+QString DolphinViewContainer::captionWindowTitle() const
+{
+    if (GeneralSettings::showFullPathInTitlebar() && !isSearchModeEnabled()) {
+        if (!url().isLocalFile()) {
+            return url().adjusted(QUrl::StripTrailingSlash).toString();
+        }
+        return url().adjusted(QUrl::StripTrailingSlash).path();
+    } else {
+        return DolphinViewContainer::caption();
+    }
+}
+
 QString DolphinViewContainer::caption() const
 {
     if (isSearchModeEnabled()) {
@@ -459,13 +471,6 @@ QString DolphinViewContainer::caption() const
         }
     }
 
-    if (GeneralSettings::showFullPathInTitlebar()) {
-        if (!url().isLocalFile()) {
-            return url().adjusted(QUrl::StripTrailingSlash).toString();
-        }
-        return url().adjusted(QUrl::StripTrailingSlash).path();
-    }
-
     KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
     const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegExp);
 
index 5207d2d35d47cf39572d156916d8ce504d65809f..52e63cbe04f34e9e670c8c39232c0854fe45fbf5 100644 (file)
@@ -133,6 +133,13 @@ public:
      */
     void reload();
 
+    /**
+     * @return Returns a Caption suitable for display in the window title.
+     * It is calculated depending on GeneralSettings::showFullPathInTitlebar().
+     * If it's false, it calls caption().
+     */
+    QString captionWindowTitle() const;
+
     /**
      * @return Returns a Caption suitable for display to the user. It is
      * calculated depending on settings, if a search is active and other