From e3591fc1126add9c122eb1921ffb87948ab04af6 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Fri, 10 Aug 2012 12:08:55 +0200 Subject: BookmarkWidget: - Don't display an empty entry if the bookmark is in the root folder - Improve the code to choose the current index --- src/urlbar/bookmarkwidget.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/urlbar') diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp index 6026cb20..2a91f333 100644 --- a/src/urlbar/bookmarkwidget.cpp +++ b/src/urlbar/bookmarkwidget.cpp @@ -256,7 +256,14 @@ void BookmarkWidget::setupFolderComboBox() if (m_bookmark->parentGroup().address() != toolBarRoot.address()) { - m_folder->addItem(m_bookmark->parentGroup().text(), + QString parentText = m_bookmark->parentGroup().text(); + + if (m_bookmark->parentGroup().address() == root.address()) + { + parentText = i18n("Root folder"); + } + + m_folder->addItem(parentText, m_bookmark->parentGroup().address()); m_folder->insertSeparator(3); } @@ -269,15 +276,8 @@ void BookmarkWidget::setupFolderComboBox() } } - if (m_bookmark->parentGroup().address() == toolBarRoot.address()) - { - m_folder->setCurrentIndex(0); - } - else - { - int index = m_folder->findText(m_bookmark->parentGroup().text()); - m_folder->setCurrentIndex(index); - } + int index = m_folder->findData(m_bookmark->parentGroup().address()); + m_folder->setCurrentIndex(index); } -- cgit v1.2.1