From 0945eb5bc2878882adbd90c99e44d2cc40fbcddf Mon Sep 17 00:00:00 2001 From: Shaun Reich Date: Mon, 9 Mar 2009 19:50:32 +0000 Subject: [PATCH] Added a few things to the "Recently Closed Tabs" menu: * Paths now ellide when they get too big. That is, according to the font size, not character length. * Added automatic mnemomics (or however you spell that crazy word) to the menu's items. svn path=/trunk/KDE/kdebase/apps/; revision=937504 --- src/dolphinmainwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index aa72a2b9b..c0910e274 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -85,6 +85,7 @@ #include #include #include +#include /* * Remembers the tab configuration if a tab has been closed. @@ -1326,7 +1327,10 @@ void DolphinMainWindow::rememberClosedTab(int index) const QString primaryPath = m_viewTab[index].primaryView->url().path(); const QString iconName = KMimeType::iconNameForUrl(primaryPath); - QAction* action = new QAction(primaryPath, tabsMenu); + const QFontMetrics fm = fontMetrics(); + const QString actionText = fm.elidedText(primaryPath, Qt::ElideMiddle, fm.maxWidth() * 20); + + QAction* action = new QAction(actionText, tabsMenu); ClosedTab closedTab; closedTab.primaryUrl = m_viewTab[index].primaryView->url(); @@ -1354,6 +1358,7 @@ void DolphinMainWindow::rememberClosedTab(int index) tabsMenu->removeAction(tabsMenu->actions().last()); } actionCollection()->action("closed_tabs")->setEnabled(true); + KAcceleratorManager::manage(tabsMenu); } void DolphinMainWindow::clearStatusBar() -- 2.47.3