]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
SVN_SILENT: comment update
[dolphin.git] / src / dolphinmainwindow.cpp
index c0910e2740cf8b01bfea179b5bade8be2c0a5db7..6338f0f3fb763d2857061b00494eda0dceebb1f7 100644 (file)
@@ -237,6 +237,8 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
         if (m_viewTab.count() > 1) {
             m_tabBar->setTabText(m_tabIndex, tabName(url));
         }
+        const QString iconName = KMimeType::iconNameForUrl(url);
+        m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName));
         emit urlChanged(url);
     }
 }
@@ -331,14 +333,15 @@ void DolphinMainWindow::openNewTab()
 
 void DolphinMainWindow::openNewTab(const KUrl& url)
 {
+    const KIcon icon = KIcon(KMimeType::iconNameForUrl(m_activeViewContainer->url()));
     if (m_viewTab.count() == 1) {
         // Only one view is open currently and hence no tab is shown at
         // all. Before creating a tab for 'url', provide a tab for the current URL.
-        m_tabBar->addTab(KIcon("folder"), tabName(m_activeViewContainer->url()));
+        m_tabBar->addTab(icon, tabName(m_activeViewContainer->url()));
         m_tabBar->blockSignals(false);
     }
 
-    m_tabBar->addTab(KIcon("folder"), tabName(url));
+    m_tabBar->addTab(icon, tabName(url));
 
     ViewTab viewTab;
     viewTab.splitter = new QSplitter(this);
@@ -1009,6 +1012,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
     setCaption(url.fileName());
     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)));
     }
 
     emit urlChanged(url);
@@ -1352,8 +1356,8 @@ void DolphinMainWindow::rememberClosedTab(int index)
     } else {
         tabsMenu->insertAction(tabsMenu->actions().at(2), action);
     }
-    //10 is the limit, remove the oldest one to make room. It's actually 8, since
-    //the separator and the "Empty Recently Closed Tabs" entry count as one
+
+    // assure that only up to 8 closed tabs are shown in the menu
     if (tabsMenu->actions().size() > 8) {
         tabsMenu->removeAction(tabsMenu->actions().last());
     }