sidebarpage.cpp
statusbarspaceinfo.cpp
statusbarmessagelabel.cpp
+ treeviewsidebarpage.cpp
urlbutton.cpp
urlnavigator.cpp
urlnavigatorbutton.cpp
\r
#include <assert.h>\r
\r
+#include "bookmarkssidebarpage.h"\r
#include "dolphinapplication.h"\r
#include "dolphinnewmenu.h"\r
#include "dolphinsettings.h"\r
#include "dolphinsettingsdialog.h"\r
#include "dolphinstatusbar.h"\r
-#include "dolphinapplication.h"\r
-#include "urlnavigator.h"\r
-#include "dolphinsettings.h"\r
-#include "bookmarkssidebarpage.h"\r
#include "infosidebarpage.h"\r
-#include "dolphin_generalsettings.h"\r
-#include "viewpropertiesdialog.h"\r
-#include "viewproperties.h"\r
#include "metadataloader.h"\r
#include "mainwindowadaptor.h"\r
+#include "treeviewsidebarpage.h"\r
+#include "urlnavigator.h"\r
+#include "viewpropertiesdialog.h"\r
+#include "viewproperties.h"\r
+\r
+#include "dolphin_generalsettings.h"\r
\r
#include <kaction.h>\r
#include <kactioncollection.h>\r
\r
void DolphinMainWindow::setupDockWidgets()\r
{\r
+ // TODO: there's a lot copy/paste code here. Provide a generic approach\r
+ // after the dock concept has been finalized.\r
+\r
+ // setup "Bookmarks"\r
QDockWidget* shortcutsDock = new QDockWidget(i18n("Bookmarks"));\r
shortcutsDock->setObjectName("bookmarksDock");\r
shortcutsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);\r
\r
addDockWidget(Qt::LeftDockWidgetArea, shortcutsDock);\r
\r
+ // setup "Information"\r
QDockWidget* infoDock = new QDockWidget(i18n("Information"));\r
infoDock->setObjectName("infoDock");\r
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);\r
actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());\r
\r
addDockWidget(Qt::RightDockWidgetArea, infoDock);\r
+\r
+ // setup "Tree View"\r
+ QDockWidget* treeViewDock = new QDockWidget(i18n("Folders")); // TODO: naming?\r
+ treeViewDock->setObjectName("treeViewDock");\r
+ treeViewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);\r
+ treeViewDock->setWidget(new TreeViewSidebarPage(this));\r
+\r
+ treeViewDock->toggleViewAction()->setText(i18n("Show Folders Panel"));\r
+ actionCollection()->addAction("show_folders_panel", treeViewDock->toggleViewAction());\r
+\r
+ addDockWidget(Qt::LeftDockWidgetArea, treeViewDock);\r
}\r
\r
void DolphinMainWindow::updateHistory()\r
<text>Panels</text>
<Action name="show_bookmarks_panel" />
<Action name="show_info_panel" />
+ <Action name="show_folders_panel" />
</Menu>
<Menu name="navigation_bar">
<text>Navigation Bar</text>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef _INFOSIDEBARPAGE_H_
-#define _INFOSIDEBARPAGE_H_
+#ifndef INFOSIDEBARPAGE_H
+#define INFOSIDEBARPAGE_H
#include <sidebarpage.h>
Q_OBJECT
public:
- explicit InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent=0);
+ explicit InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent = 0);
virtual ~InfoSidebarPage();
protected:
* Show the annotation of a file in the sidebar.
*/
void showAnnotation(const KUrl& file);
-
+
/**
* Show the annotations of multiple files in the sidebar.
*/
void showAnnotations(const KUrl::List& files);
-
+
bool m_multipleSelection;
bool m_pendingPreview;
QTimer* m_timer;
int m_index;
};
-#endif // _INFOSIDEBARPAGE_H_
+#endif // INFOSIDEBARPAGE_H
#include "sidebarpage.h"
#include "dolphinmainwindow.h"
-SidebarPage::SidebarPage(DolphinMainWindow *mainWindow, QWidget* parent) :
+SidebarPage::SidebarPage(DolphinMainWindow* mainWindow, QWidget* parent) :
QWidget(parent),
m_mainWindow(mainWindow)
{
protected slots:
/**
* Is invoked whenever the active view from Dolphin has been changed.
- * The active view can be retrieved by Dolphin::mainWin().activeView();
+ * The active view can be retrieved by mainWindow()->activeView();
*/
virtual void activeViewChanged();
--- /dev/null
+/***************************************************************************
+ * 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., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "treeviewsidebarpage.h"
+
+#include "dolphinmainwindow.h"
+#include "dolphinview.h"
+
+#include "kdirlister.h"
+#include "kdirmodel.h"
+
+#include <QTreeView>
+#include <QVBoxLayout>
+
+TreeViewSidebarPage::TreeViewSidebarPage(DolphinMainWindow* mainWindow,
+ QWidget* parent) :
+ SidebarPage(mainWindow, parent),
+ m_dirLister(0),
+ m_dirModel(0),
+ m_treeView(0)
+{
+ Q_ASSERT(mainWindow != 0);
+
+ m_dirLister = new KDirLister();
+ m_dirLister->setDirOnlyMode(true);
+ m_dirLister->setAutoUpdate(true);
+ m_dirLister->setMainWindow(this);
+ m_dirLister->setDelayedMimeTypes(true);
+ m_dirLister->setAutoErrorHandlingEnabled(false, this);
+
+ m_dirModel = new KDirModel();
+ m_dirModel->setDirLister(m_dirLister);
+
+ m_treeView = new QTreeView(this);
+ m_treeView->setModel(m_dirModel);
+
+ // hide all columns except of the 'Name' column
+ m_treeView->hideColumn(KDirModel::Size);
+ m_treeView->hideColumn(KDirModel::ModifiedTime);
+ m_treeView->hideColumn(KDirModel::Permissions);
+ m_treeView->hideColumn(KDirModel::Owner);
+ m_treeView->hideColumn(KDirModel::Group);
+
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ layout->addWidget(m_treeView);
+
+ connectToActiveView();
+}
+
+TreeViewSidebarPage::~TreeViewSidebarPage()
+{
+ delete m_dirLister;
+ m_dirLister = 0;
+}
+
+void TreeViewSidebarPage::activeViewChanged()
+{
+ connectToActiveView();
+}
+
+void TreeViewSidebarPage::updatePosition(const KUrl& url)
+{
+}
+
+void TreeViewSidebarPage::connectToActiveView()
+{
+ DolphinView* view = mainWindow()->activeView();
+ m_dirLister->openUrl(view->url(), true);
+ connect(view, SIGNAL(urlChanged(const KUrl&)),
+ this, SLOT(updatePosition(const KUrl&)));
+}
+
+#include "treeviewsidebarpage.moc"
--- /dev/null
+/***************************************************************************
+ * 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., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef TREEVIEWSIDEBARPAGE_H
+#define TREEVIEWSIDEBARPAGE_H
+
+#include <sidebarpage.h>
+
+class KDirLister;
+class KDirModel;
+class KUrl;
+class QTreeView;
+
+/**
+ * @brief
+ */
+class TreeViewSidebarPage : public SidebarPage
+{
+ Q_OBJECT
+
+public:
+ TreeViewSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent = 0);
+ virtual ~TreeViewSidebarPage();
+
+protected:
+ /** @see SidebarPage::activeViewChanged() */
+ virtual void activeViewChanged();
+
+private slots:
+ /**
+ * Updates the current position inside the tree to
+ * \a url.
+ */
+ void updatePosition(const KUrl& url);
+
+private:
+ /**
+ * Connects to signals from the currently active Dolphin view to get
+ * informed about highlighting changes.
+ */
+ void connectToActiveView();
+
+private:
+ KDirLister* m_dirLister;
+ KDirModel* m_dirModel;
+ QTreeView* m_treeView;
+};
+
+#endif // BOOKMARKSSIDEBARPAGE_H