X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/0945eb5bc2878882adbd90c99e44d2cc40fbcddf..27a4b768714efb8a2b78f4fcb155e267cc1da05a:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index c0910e274..53505b95a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -78,6 +78,7 @@ #include #include #include +#include #include #include @@ -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()); }