diff options
| author | Kevin Ottens <[email protected]> | 2006-11-29 18:09:26 +0000 |
|---|---|---|
| committer | Kevin Ottens <[email protected]> | 2006-11-29 18:09:26 +0000 |
| commit | b1d5b6b7467d15417131c8df8fdecb22b2008db4 (patch) | |
| tree | 119882f5616809a57eb9b81621dc6361a97ed282 /src/sidebar.cpp | |
| parent | 91c5f52d87c7af2412b5935095df1f90d6eb4a04 (diff) | |
Get ride of the sidebar and use dockwidgets instead.
Default is now three panes, but the dockwidgets can be stacked, etc. to
the user convenience.
There's a slight loss in feature since I disabled dockwidgets hiding,
it's simply because some rework is still needed in kdelibs and Qt to
make them work correctly.
svn path=/trunk/playground/utils/dolphin/; revision=609186
Diffstat (limited to 'src/sidebar.cpp')
| -rw-r--r-- | src/sidebar.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/src/sidebar.cpp b/src/sidebar.cpp deleted file mode 100644 index 26cfa0c46..000000000 --- a/src/sidebar.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Cvetoslav Ludmiloff <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "sidebar.h" - -#include <QVBoxLayout> -#include <QComboBox> - -#include <kiconloader.h> -#include <klocale.h> - -#include "dolphinsettings.h" -#include "sidebarsettings.h" -#include "bookmarkssidebarpage.h" -#include "infosidebarpage.h" - -Sidebar::Sidebar(DolphinMainWindow* mainWindow, QWidget* parent) : - QWidget(parent), - m_mainWindow(mainWindow), - m_pagesSelector(0), - m_page(0), - m_layout(0) -{ - m_layout = new QVBoxLayout(this); - m_layout->setMargin(0); - m_layout->setSpacing(0); - - m_pagesSelector = new QComboBox(this); - m_pagesSelector->insertItem(i18n("Information")); - m_pagesSelector->insertItem(i18n("Bookmarks")); - - // Assure that the combo box has the same height as the Url navigator for - // a clean layout. - // TODO: the following 2 lines have been copied from the UrlNavigator - // constructor (-> provide a shared height setting?) - QFontMetrics fontMetrics(font()); - m_pagesSelector->setMinimumHeight(fontMetrics.height() + 8); - - SidebarSettings* settings = DolphinSettings::instance().sidebarSettings(); - const int selectedIndex = indexForName(settings->selectedPage()); - m_pagesSelector->setCurrentItem(selectedIndex); - m_layout->addWidget(m_pagesSelector); - - createPage(selectedIndex); - - connect(m_pagesSelector, SIGNAL(activated(int)), - this, SLOT(createPage(int))); -} - -Sidebar::~Sidebar() -{ -} - -QSize Sidebar::sizeHint() const -{ - QSize size(QWidget::sizeHint()); - - SidebarSettings* settings = DolphinSettings::instance().sidebarSettings(); - size.setWidth(settings->width()); - return size; -} - -void Sidebar::createPage(int index) -{ - if (m_page != 0) { - m_page->deleteLater(); - m_page = 0; - } - - switch (index) { - case 0: m_page = new InfoSidebarPage(m_mainWindow, this); break; - case 1: m_page = new BookmarksSidebarPage(m_mainWindow, this); break; - default: break; - } - - m_layout->addWidget(m_page); - m_page->show(); - - SidebarSettings* settings = DolphinSettings::instance().sidebarSettings(); - settings->setSelectedPage(m_pagesSelector->text(index)); -} - -int Sidebar::indexForName(const QString& name) const -{ - const int count = m_pagesSelector->count(); - for (int i = 0; i < count; ++i) { - if (m_pagesSelector->text(i) == name) { - return i; - } - } - - return 0; -} - -#include "sidebar.moc" |
