bookmarkssettingspage.cpp
editbookmarkdialog.cpp
settingspagebase.cpp
- sidebar.cpp
sidebarpage.cpp
bookmarkssidebarpage.cpp
infosidebarpage.cpp
generalsettings.kcfgc
iconsmodesettings.kcfgc
detailsmodesettings.kcfgc
- previewsmodesettings.kcfgc
- sidebarsettings.kcfgc )
+ previewsmodesettings.kcfgc )
kde4_add_executable(dolphin ${dolphin_SRCS})
########### 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} )
Q_OBJECT
public:
- BookmarksSidebarPage(DolphinMainWindow *mainWindow, QWidget* parent);
+ BookmarksSidebarPage(DolphinMainWindow *mainWindow, QWidget* parent=0);
virtual ~BookmarksSidebarPage();
protected:
#include <Q3ValueList>
#include <QCloseEvent>
#include <QSplitter>
+#include <QDockWidget>
#include "urlnavigator.h"
#include "viewpropertiesdialog.h"
#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"
DolphinMainWindow::DolphinMainWindow() :
KMainWindow(0, "Dolphin"),
m_splitter(0),
- m_sidebar(0),
m_activeView(0),
m_clipboardContainsCutData(false)
{
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);
}
}
-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
}
setupActions();
- setupGUI(Keys|Save|Create|ToolBar);
const KUrl& homeUrl = root.first().url();
setCaption(homeUrl.fileName());
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");
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()));
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()
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"
class QSplitter;
class KAction;
class UrlNavigator;
-class Sidebar;
class DolphinApplication;
/**
void addUndoOperation(KJob* job);
- void toggleSidebar();
-
- /**
- * Stores the current sidebar width and closes
- * the sidebar.
- */
- void closeSidebar();
-
private:
DolphinMainWindow();
void init();
void setupAccel();
void setupActions();
+ void setupDockWidgets();
void setupCreateNewMenuActions();
void updateHistory();
void updateEditActions();
const KUrl::List& source,
const KUrl& dest);
void clearStatusBar();
- void openSidebar();
QSplitter* m_splitter;
- Sidebar* m_sidebar;
DolphinView* m_activeView;
/**
#include "iconsmodesettings.h"
#include "previewsmodesettings.h"
#include "detailsmodesettings.h"
-#include "sidebarsettings.h"
#include <Q3IconView>
m_iconsModeSettings->writeConfig();
m_previewsModeSettings->writeConfig();
m_detailsModeSettings->writeConfig();
- m_sidebarSettings->writeConfig();
QString basePath = KGlobal::instance()->instanceName();
basePath.append("/bookmarks.xml");
m_iconsModeSettings = new IconsModeSettings();
m_previewsModeSettings = new PreviewsModeSettings();
m_detailsModeSettings = new DetailsModeSettings();
- m_sidebarSettings = new SidebarSettings();
}
DolphinSettings::~DolphinSettings()
delete m_detailsModeSettings;
m_detailsModeSettings = 0;
-
- delete m_sidebarSettings;
- m_sidebarSettings = 0;
}
class IconsModeSettings;
class PreviewsModeSettings;
class DetailsModeSettings;
-class SidebarSettings;
/**
* @brief Manages and stores all settings from Dolphin.
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;
IconsModeSettings* m_iconsModeSettings;
PreviewsModeSettings* m_previewsModeSettings;
DetailsModeSettings* m_detailsModeSettings;
- SidebarSettings* m_sidebarSettings;
};
#endif
<Action name="editable_location" />
<Action name="edit_location" />
</Menu>
- <Action name="sidebar" />
<Action name="view_properties" />
</Menu>
<Menu name="tools">
Q_OBJECT
public:
- InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent);
+ InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent=0);
virtual ~InfoSidebarPage();
protected:
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
- * *
- * 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"
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at>
- * *
- * 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_
Q_OBJECT
public:
- SidebarPage(DolphinMainWindow* mainwindow, QWidget* parent);
+ SidebarPage(DolphinMainWindow* mainwindow, QWidget* parent=0);
virtual ~SidebarPage();
protected slots:
+++ /dev/null
-<?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
+++ /dev/null
-File=sidebarsettings.kcfg
-ClassName=SidebarSettings
-Singleton=false
-Mutators=true
\ No newline at end of file