]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't show an empty window caption when browsing "/", "trash:", etc.
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 5 May 2009 21:49:03 +0000 (21:49 +0000)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 5 May 2009 21:49:03 +0000 (21:49 +0000)
BUG: 190783

svn path=/trunk/KDE/kdebase/apps/; revision=964061

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 64aba63a5556b4ef9a8219f23dbd31d93d83a488..3ce1e9f2d80dcdef55689348c0cf06f9ec99f56e 100644 (file)
@@ -236,7 +236,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
         updateEditActions();
         updateViewActions();
         updateGoActions();
-        setCaption(url.fileName());
+        setUrlAsCaption(url);
         if (m_viewTab.count() > 1) {
             m_tabBar->setTabText(m_tabIndex, tabName(url));
         }
@@ -987,7 +987,7 @@ void DolphinMainWindow::init()
     setupActions();
 
     const KUrl& homeUrl = generalSettings->homeUrl();
-    setCaption(homeUrl.fileName());
+    setUrlAsCaption(homeUrl);
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
     connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
@@ -1096,7 +1096,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
     updateGoActions();
 
     const KUrl& url = m_activeViewContainer->url();
-    setCaption(url.fileName());
+    setUrlAsCaption(url);
     if (m_viewTab.count() > 1 && m_viewTab[m_tabIndex].secondaryView != 0) {
         m_tabBar->setTabText(m_tabIndex, tabName(url));
         m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url)));
@@ -1555,6 +1555,21 @@ QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) co
     return "Tab " + QString::number(tabIndex) + ' ' + property;
 }
 
+void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
+{
+    QString caption;
+    if (url.equals(KUrl("file:///"))) {
+        caption = '/';
+    } else {
+        caption = url.fileName();
+        if (caption.isEmpty()) {
+            caption = url.protocol();
+       }
+    }
+    
+    setCaption(caption);
+}
+
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
     KIO::FileUndoManager::UiInterface()
 {
index 5e1d27476bc1c10af8f1461f42f18046b93a2122..c1e0ffcbdc14415e0c4cd50d5d5a3f0b9a1ab486 100644 (file)
@@ -435,6 +435,12 @@ private:
      */
     QString tabProperty(const QString& property, int tabIndex) const;
 
+    /**
+     * Sets the window caption to url.fileName() if this is non-empty, 
+     * "/" if the URL is "file:///", and url.protocol() otherwise.
+     */
+    void setUrlAsCaption(const KUrl& url);
+
 private:
     /**
      * Implements a custom error handling for the undo manager. This