┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinmainwindow.cpp
diff options
context:
space:
mode:
authorShaun Reich <[email protected]>2009-07-09 04:41:53 +0000
committerShaun Reich <[email protected]>2009-07-09 04:41:53 +0000
commit70915125f7250ea8eb654ab253db7ed96b14a6bf (patch)
treefabc14294a2bfa27c3ddf062a2cc82627165edba /src/dolphinmainwindow.cpp
parent31d359323c758651bdc51f06017175da32d8bf42 (diff)
Fixed the annoying bug (for me) that dealt with having a very long folder name. In this case, the name of the tab could be many more times bigger than the tabBar itself.
Now they are ellided, so e.g. "really really long folder name...is" or something. Few more cases left for me to fix(shortly), but those are not quite close to this section. svn path=/trunk/KDE/kdebase/apps/; revision=993618
Diffstat (limited to 'src/dolphinmainwindow.cpp')
-rw-r--r--src/dolphinmainwindow.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 399c662f8..1c310b5b3 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -237,7 +237,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
updateGoActions();
setUrlAsCaption(url);
if (m_viewTab.count() > 1) {
- m_tabBar->setTabText(m_tabIndex, tabName(url));
+ m_tabBar->setTabText(m_tabIndex, squeezeText(tabName(m_activeViewContainer->url())));
}
const QString iconName = KMimeType::iconNameForUrl(url);
m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName));
@@ -339,11 +339,11 @@ void DolphinMainWindow::openNewTab(const KUrl& 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(icon, tabName(m_activeViewContainer->url()));
+ m_tabBar->addTab(icon, squeezeText(tabName(m_activeViewContainer->url())));
m_tabBar->blockSignals(false);
}
- m_tabBar->addTab(icon, tabName(url));
+ m_tabBar->addTab(icon, squeezeText(tabName(url)));
ViewTab viewTab;
viewTab.splitter = new QSplitter(this);
@@ -1434,10 +1434,7 @@ void DolphinMainWindow::rememberClosedTab(int index)
const QString primaryPath = m_viewTab[index].primaryView->url().path();
const QString iconName = KMimeType::iconNameForUrl(primaryPath);
- const QFontMetrics fm = fontMetrics();
- const QString actionText = fm.elidedText(primaryPath, Qt::ElideMiddle, fm.maxWidth() * 20);
-
- QAction* action = new QAction(actionText, tabsMenu);
+ QAction* action = new QAction(squeezeText(primaryPath), tabsMenu);
ClosedTab closedTab;
closedTab.primaryUrl = m_viewTab[index].primaryView->url();
@@ -1580,6 +1577,13 @@ void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
setCaption(caption);
}
+QString DolphinMainWindow::squeezeText(const QString& text)
+{
+ const QFontMetrics fm = fontMetrics();
+ QString result = fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10);
+ return result;
+}
+
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
KIO::FileUndoManager::UiInterface()
{