┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <[email protected]>2006-11-29 18:09:26 +0000
committerKevin Ottens <[email protected]>2006-11-29 18:09:26 +0000
commitb1d5b6b7467d15417131c8df8fdecb22b2008db4 (patch)
tree119882f5616809a57eb9b81621dc6361a97ed282
parent91c5f52d87c7af2412b5935095df1f90d6eb4a04 (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
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/bookmarkssidebarpage.h2
-rw-r--r--src/dolphinmainwindow.cpp87
-rw-r--r--src/dolphinmainwindow.h12
-rw-r--r--src/dolphinsettings.cpp6
-rw-r--r--src/dolphinsettings.h3
-rw-r--r--src/dolphinui.rc1
-rw-r--r--src/infosidebarpage.h2
-rw-r--r--src/sidebar.cpp111
-rw-r--r--src/sidebar.h67
-rw-r--r--src/sidebarpage.h2
-rw-r--r--src/sidebarsettings.kcfg19
-rw-r--r--src/sidebarsettings.kcfgc4
13 files changed, 22 insertions, 300 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7ea5426bb..2ee66d31a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,6 @@ set(dolphin_SRCS
bookmarkssettingspage.cpp
editbookmarkdialog.cpp
settingspagebase.cpp
- sidebar.cpp
sidebarpage.cpp
bookmarkssidebarpage.cpp
infosidebarpage.cpp
@@ -52,8 +51,7 @@ kde4_add_kcfg_files(dolphin_SRCS
generalsettings.kcfgc
iconsmodesettings.kcfgc
detailsmodesettings.kcfgc
- previewsmodesettings.kcfgc
- sidebarsettings.kcfgc )
+ previewsmodesettings.kcfgc )
kde4_add_executable(dolphin ${dolphin_SRCS})
@@ -65,7 +63,7 @@ install(TARGETS dolphin DESTINATION ${BIN_INSTALL_DIR})
########### install files ###############
install( FILES dolphin.desktop DESTINATION ${XDG_APPS_DIR} )
-install( FILES directoryviewpropertysettings.kcfg generalsettings.kcfg iconsmodesettings.kcfg detailsmodesettings.kcfg previewsmodesettings.kcfg sidebarsettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
+install( FILES directoryviewpropertysettings.kcfg generalsettings.kcfg iconsmodesettings.kcfg detailsmodesettings.kcfg previewsmodesettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin )
kde4_install_icons( ${ICON_INSTALL_DIR} )
diff --git a/src/bookmarkssidebarpage.h b/src/bookmarkssidebarpage.h
index 953755399..601a4d836 100644
--- a/src/bookmarkssidebarpage.h
+++ b/src/bookmarkssidebarpage.h
@@ -41,7 +41,7 @@ class BookmarksSidebarPage : public SidebarPage
Q_OBJECT
public:
- BookmarksSidebarPage(DolphinMainWindow *mainWindow, QWidget* parent);
+ BookmarksSidebarPage(DolphinMainWindow *mainWindow, QWidget* parent=0);
virtual ~BookmarksSidebarPage();
protected:
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 9748c6e24..938d41cbc 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -58,6 +58,7 @@
#include <Q3ValueList>
#include <QCloseEvent>
#include <QSplitter>
+#include <QDockWidget>
#include "urlnavigator.h"
#include "viewpropertiesdialog.h"
@@ -69,8 +70,8 @@
#include "undomanager.h"
#include "progressindicator.h"
#include "dolphinsettings.h"
-#include "sidebar.h"
-#include "sidebarsettings.h"
+#include "bookmarkssidebarpage.h"
+#include "infosidebarpage.h"
#include "generalsettings.h"
#include "dolphinapplication.h"
@@ -78,7 +79,6 @@
DolphinMainWindow::DolphinMainWindow() :
KMainWindow(0, "Dolphin"),
m_splitter(0),
- m_sidebar(0),
m_activeView(0),
m_clipboardContainsCutData(false)
{
@@ -339,13 +339,6 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
GeneralSettings* generalSettings = settings.generalSettings();
generalSettings->setFirstRun(false);
- SidebarSettings* sidebarSettings = settings.sidebarSettings();
- const bool isSidebarVisible = (m_sidebar != 0);
- sidebarSettings->setVisible(isSidebarVisible);
- if (isSidebarVisible) {
- sidebarSettings->setWidth(m_sidebar->width());
- }
-
settings.save();
KMainWindow::closeEvent(event);
@@ -1107,36 +1100,6 @@ void DolphinMainWindow::addUndoOperation(KJob* job)
}
}
-void DolphinMainWindow::toggleSidebar()
-{
- if (m_sidebar == 0) {
- openSidebar();
- }
- else {
- closeSidebar();
- }
-
- KToggleAction* sidebarAction = static_cast<KToggleAction*>(actionCollection()->action("sidebar"));
- sidebarAction->setChecked(m_sidebar != 0);
-}
-
-void DolphinMainWindow::closeSidebar()
-{
- if (m_sidebar == 0) {
- // the sidebar has already been closed
- return;
- }
-
- // store width of sidebar and remember that the sidebar has been closed
- SidebarSettings* settings = DolphinSettings::instance().sidebarSettings();
- settings->setVisible(false);
- settings->setWidth(m_sidebar->width());
-
- m_sidebar->deleteLater();
- m_sidebar = 0;
-}
-
-
void DolphinMainWindow::init()
{
// Check whether Dolphin runs the first time. If yes then
@@ -1162,7 +1125,6 @@ void DolphinMainWindow::init()
}
setupActions();
- setupGUI(Keys|Save|Create|ToolBar);
const KUrl& homeUrl = root.first().url();
setCaption(homeUrl.fileName());
@@ -1176,14 +1138,9 @@ void DolphinMainWindow::init()
m_activeView = m_view[PrimaryIdx];
setCentralWidget(m_splitter);
+ setupDockWidgets();
- // open sidebar
- SidebarSettings* sidebarSettings = settings.sidebarSettings();
- assert(sidebarSettings != 0);
- if (sidebarSettings->visible()) {
- openSidebar();
- }
-
+ setupGUI(Keys|Save|Create|ToolBar);
createGUI();
stateChanged("new_file");
@@ -1351,10 +1308,6 @@ void DolphinMainWindow::setupActions()
editLocation->setShortcut(Qt::Key_F6);
connect(editLocation, SIGNAL(triggered()), this, SLOT(editLocation()));
- KToggleAction* sidebar = new KToggleAction(i18n("Sidebar"), actionCollection(), "sidebar");
- sidebar->setShortcut(Qt::Key_F9);
- connect(sidebar, SIGNAL(triggered()), this, SLOT(toggleSidebar()));
-
KAction* adjustViewProps = new KAction(i18n("Adjust View Properties..."), actionCollection(), "view_properties");
connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(adjustViewProperties()));
@@ -1585,9 +1538,6 @@ void DolphinMainWindow::updateViewActions()
KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
splitAction->setChecked(m_view[SecondaryIdx] != 0);
-
- KToggleAction* sidebarAction = static_cast<KToggleAction*>(actionCollection()->action("sidebar"));
- sidebarAction->setChecked(m_sidebar != 0);
}
void DolphinMainWindow::updateGoActions()
@@ -1652,24 +1602,19 @@ void DolphinMainWindow::clearStatusBar()
m_activeView->statusBar()->clear();
}
-void DolphinMainWindow::openSidebar()
+void DolphinMainWindow::setupDockWidgets()
{
- if (m_sidebar != 0) {
- // the sidebar is already open
- return;
- }
-
- m_sidebar = new Sidebar(this, m_splitter);
- m_sidebar->show();
-
- connect(m_sidebar, SIGNAL(urlChanged(const KUrl&)),
- this, SLOT(slotUrlChangeRequest(const KUrl&)));
- m_splitter->setCollapsible(m_sidebar, false);
- m_splitter->setResizeMode(m_sidebar, QSplitter::KeepSize);
- m_splitter->moveToFirst(m_sidebar);
+ QDockWidget *shortcutsDock = new QDockWidget(i18n("Shortcuts"));
+ shortcutsDock->setObjectName("shortcutsDock");
+ shortcutsDock->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
+ shortcutsDock->setWidget(new BookmarksSidebarPage(this));
+ addDockWidget(Qt::LeftDockWidgetArea, shortcutsDock);
- SidebarSettings* settings = DolphinSettings::instance().sidebarSettings();
- settings->setVisible(true);
+ QDockWidget *infoDock = new QDockWidget(i18n("Information"));
+ infoDock->setObjectName("infoDock");
+ infoDock->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
+ infoDock->setWidget(new InfoSidebarPage(this));
+ addDockWidget(Qt::RightDockWidgetArea, infoDock);
}
#include "dolphinmainwindow.moc"
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index d736c8262..8b5694619 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -48,7 +48,6 @@ class Q3IconViewItem;
class QSplitter;
class KAction;
class UrlNavigator;
-class Sidebar;
class DolphinApplication;
/**
@@ -373,14 +372,6 @@ private slots:
void addUndoOperation(KJob* job);
- void toggleSidebar();
-
- /**
- * Stores the current sidebar width and closes
- * the sidebar.
- */
- void closeSidebar();
-
private:
DolphinMainWindow();
void init();
@@ -388,6 +379,7 @@ private:
void setupAccel();
void setupActions();
+ void setupDockWidgets();
void setupCreateNewMenuActions();
void updateHistory();
void updateEditActions();
@@ -401,10 +393,8 @@ private:
const KUrl::List& source,
const KUrl& dest);
void clearStatusBar();
- void openSidebar();
QSplitter* m_splitter;
- Sidebar* m_sidebar;
DolphinView* m_activeView;
/**
diff --git a/src/dolphinsettings.cpp b/src/dolphinsettings.cpp
index f197d36f0..11c18914f 100644
--- a/src/dolphinsettings.cpp
+++ b/src/dolphinsettings.cpp
@@ -34,7 +34,6 @@
#include "iconsmodesettings.h"
#include "previewsmodesettings.h"
#include "detailsmodesettings.h"
-#include "sidebarsettings.h"
#include <Q3IconView>
@@ -78,7 +77,6 @@ void DolphinSettings::save()
m_iconsModeSettings->writeConfig();
m_previewsModeSettings->writeConfig();
m_detailsModeSettings->writeConfig();
- m_sidebarSettings->writeConfig();
QString basePath = KGlobal::instance()->instanceName();
basePath.append("/bookmarks.xml");
@@ -163,7 +161,6 @@ DolphinSettings::DolphinSettings()
m_iconsModeSettings = new IconsModeSettings();
m_previewsModeSettings = new PreviewsModeSettings();
m_detailsModeSettings = new DetailsModeSettings();
- m_sidebarSettings = new SidebarSettings();
}
DolphinSettings::~DolphinSettings()
@@ -179,7 +176,4 @@ DolphinSettings::~DolphinSettings()
delete m_detailsModeSettings;
m_detailsModeSettings = 0;
-
- delete m_sidebarSettings;
- m_sidebarSettings = 0;
}
diff --git a/src/dolphinsettings.h b/src/dolphinsettings.h
index 981e7d51e..2b97356a5 100644
--- a/src/dolphinsettings.h
+++ b/src/dolphinsettings.h
@@ -27,7 +27,6 @@ class GeneralSettings;
class IconsModeSettings;
class PreviewsModeSettings;
class DetailsModeSettings;
-class SidebarSettings;
/**
* @brief Manages and stores all settings from Dolphin.
@@ -48,7 +47,6 @@ public:
IconsModeSettings* iconsModeSettings() const { return m_iconsModeSettings; }
PreviewsModeSettings* previewsModeSettings() const { return m_previewsModeSettings; }
DetailsModeSettings* detailsModeSettings() const { return m_detailsModeSettings; }
- SidebarSettings* sidebarSettings() const { return m_sidebarSettings; }
KBookmarkManager* bookmarkManager() const;
@@ -97,7 +95,6 @@ private:
IconsModeSettings* m_iconsModeSettings;
PreviewsModeSettings* m_previewsModeSettings;
DetailsModeSettings* m_detailsModeSettings;
- SidebarSettings* m_sidebarSettings;
};
#endif
diff --git a/src/dolphinui.rc b/src/dolphinui.rc
index 49eb67daf..5db6ff9a9 100644
--- a/src/dolphinui.rc
+++ b/src/dolphinui.rc
@@ -46,7 +46,6 @@
<Action name="editable_location" />
<Action name="edit_location" />
</Menu>
- <Action name="sidebar" />
<Action name="view_properties" />
</Menu>
<Menu name="tools">
diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h
index edd43229e..e7d527126 100644
--- a/src/infosidebarpage.h
+++ b/src/infosidebarpage.h
@@ -59,7 +59,7 @@ class InfoSidebarPage : public SidebarPage
Q_OBJECT
public:
- InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent);
+ InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent=0);
virtual ~InfoSidebarPage();
protected:
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"
diff --git a/src/sidebar.h b/src/sidebar.h
deleted file mode 100644
index 6c7abab34..000000000
--- a/src/sidebar.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2006 by Cvetoslav Ludmiloff <[email protected]> *
- * Copyright (C) 2006 by Peter Penz <[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. *
- ***************************************************************************/
-
-#ifndef _SIDEBAR_H_
-#define _SIDEBAR_H_
-
-#include <QWidget>
-#include <QVBoxLayout>
-
-class KUrl;
-class QComboBox;
-class Q3VBoxLayout;
-class SidebarPage;
-class DolphinMainWindow;
-
-/**
- * @brief The sidebar allows to access bookmarks, history items and TODO...
- *
- * TODO
- */
-class Sidebar : public QWidget
-{
- Q_OBJECT
-
-public:
- Sidebar(DolphinMainWindow* mainwindow, QWidget* parent);
- virtual ~Sidebar();
-
- virtual QSize sizeHint() const;
-
-signals:
- /**
- * The user selected an item on sidebar widget and item has
- * Url property, so inform the parent togo to this Url;
- */
- void urlChanged(const KUrl& url);
-
-private slots:
- void createPage(int index);
-
-private:
- int indexForName(const QString& name) const;
-
- DolphinMainWindow *m_mainWindow;
- QComboBox* m_pagesSelector;
- SidebarPage* m_page;
- QVBoxLayout* m_layout;
-};
-
-#endif // _SIDEBAR_H_
diff --git a/src/sidebarpage.h b/src/sidebarpage.h
index e97b0c9cf..d83ef5e9a 100644
--- a/src/sidebarpage.h
+++ b/src/sidebarpage.h
@@ -36,7 +36,7 @@ class SidebarPage : public QWidget
Q_OBJECT
public:
- SidebarPage(DolphinMainWindow* mainwindow, QWidget* parent);
+ SidebarPage(DolphinMainWindow* mainwindow, QWidget* parent=0);
virtual ~SidebarPage();
protected slots:
diff --git a/src/sidebarsettings.kcfg b/src/sidebarsettings.kcfg
deleted file mode 100644
index e3f72114c..000000000
--- a/src/sidebarsettings.kcfg
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
-<kcfg>
- <kcfgfile name="dolphinrc"/>
- <group name="Sidebar">
- <entry name="SelectedPage" type="String">
- <label>Selected page</label>
- <default>Information</default>
- </entry>
- <entry name="Visible" type="Bool">
- <label>Is the sidebar visible</label>
- <default>true</default>
- </entry>
- <entry name="Width" type="Int">
- <label>Sidebar with</label>
- <default>150</default>
- </entry>
- </group>
-</kcfg> \ No newline at end of file
diff --git a/src/sidebarsettings.kcfgc b/src/sidebarsettings.kcfgc
deleted file mode 100644
index 2b6e07873..000000000
--- a/src/sidebarsettings.kcfgc
+++ /dev/null
@@ -1,4 +0,0 @@
-File=sidebarsettings.kcfg
-ClassName=SidebarSettings
-Singleton=false
-Mutators=true \ No newline at end of file