]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Added a few things to the "Recently Closed Tabs" menu:
authorShaun Reich <shaun.reich@kdemail.net>
Mon, 9 Mar 2009 19:50:32 +0000 (19:50 +0000)
committerShaun Reich <shaun.reich@kdemail.net>
Mon, 9 Mar 2009 19:50:32 +0000 (19:50 +0000)
* 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

index aa72a2b9b6dd6798aed070940af39d25362cf333..c0910e2740cf8b01bfea179b5bade8be2c0a5db7 100644 (file)
@@ -85,6 +85,7 @@
 #include <QLineEdit>
 #include <QSplitter>
 #include <QDockWidget>
+#include <kacceleratormanager.h>
 
 /*
  * 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()