]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
allow to hide the rating, comments and tags of the Information Panel
[dolphin.git] / src / dolphinmainwindow.cpp
index c0910e2740cf8b01bfea179b5bade8be2c0a5db7..53505b95a0c9cd9bc942ce92ef2b042e10e8cc81 100644 (file)
@@ -78,6 +78,7 @@
 #include <kurlnavigator.h>
 #include <kurl.h>
 #include <kurlcombobox.h>
+#include <ktoolinvocation.h>
 
 #include <QDBusMessage>
 #include <QKeyEvent>
@@ -237,6 +238,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 +334,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);
@@ -739,6 +743,11 @@ void DolphinMainWindow::toggleShowMenuBar()
     menuBar()->setVisible(!visible);
 }
 
+void DolphinMainWindow::openTerminal()
+{
+    KToolInvocation::invokeTerminal(QString(), m_activeViewContainer->url().path());
+}
+
 void DolphinMainWindow::editSettings()
 {
     if (m_settingsDialog == 0) {
@@ -1009,6 +1018,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);
@@ -1138,6 +1148,12 @@ void DolphinMainWindow::setupActions()
     compareFiles->setEnabled(false);
     connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
 
+    KAction* openTerminal = actionCollection()->addAction("open_terminal");
+    openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
+    openTerminal->setIcon(KIcon("terminal"));
+    openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
+    connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
+
     // setup 'Settings' menu
     m_showMenuBar = KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection());
     KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
@@ -1352,8 +1368,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());
     }