mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-02 14:45:04 +00:00
It seems some people cannot live without a tree view ;-) So Dolphin will provide a dock which contains the directory hierarchy, which will be synchronized with the active view. It does not clutter the UI (the dock can be turned off), but makes happy a lot of users -> kind of win-win-situation. This commit provides only a rough initial version, which shows the current URL as tree. I'll work on the interaction during the next week(s)...
svn path=/trunk/KDE/kdebase/apps/; revision=638628
This commit is contained in:
parent
802a2572b3
commit
fe8b349bce
|
@ -40,6 +40,7 @@ set(dolphin_SRCS
|
|||
sidebarpage.cpp
|
||||
statusbarspaceinfo.cpp
|
||||
statusbarmessagelabel.cpp
|
||||
treeviewsidebarpage.cpp
|
||||
urlbutton.cpp
|
||||
urlnavigator.cpp
|
||||
urlnavigatorbutton.cpp
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "bookmarkssidebarpage.h"
|
||||
#include "dolphinapplication.h"
|
||||
#include "dolphinnewmenu.h"
|
||||
#include "dolphinsettings.h"
|
||||
#include "dolphinsettingsdialog.h"
|
||||
#include "dolphinstatusbar.h"
|
||||
#include "dolphinapplication.h"
|
||||
#include "urlnavigator.h"
|
||||
#include "dolphinsettings.h"
|
||||
#include "bookmarkssidebarpage.h"
|
||||
#include "infosidebarpage.h"
|
||||
#include "dolphin_generalsettings.h"
|
||||
#include "viewpropertiesdialog.h"
|
||||
#include "viewproperties.h"
|
||||
#include "metadataloader.h"
|
||||
#include "mainwindowadaptor.h"
|
||||
#include "treeviewsidebarpage.h"
|
||||
#include "urlnavigator.h"
|
||||
#include "viewpropertiesdialog.h"
|
||||
#include "viewproperties.h"
|
||||
|
||||
#include "dolphin_generalsettings.h"
|
||||
|
||||
#include <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
|
@ -1191,6 +1191,10 @@ void DolphinMainWindow::setupActions()
|
|||
|
||||
void DolphinMainWindow::setupDockWidgets()
|
||||
{
|
||||
// TODO: there's a lot copy/paste code here. Provide a generic approach
|
||||
// after the dock concept has been finalized.
|
||||
|
||||
// setup "Bookmarks"
|
||||
QDockWidget* shortcutsDock = new QDockWidget(i18n("Bookmarks"));
|
||||
shortcutsDock->setObjectName("bookmarksDock");
|
||||
shortcutsDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
@ -1201,6 +1205,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, shortcutsDock);
|
||||
|
||||
// setup "Information"
|
||||
QDockWidget* infoDock = new QDockWidget(i18n("Information"));
|
||||
infoDock->setObjectName("infoDock");
|
||||
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
@ -1210,6 +1215,17 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, infoDock);
|
||||
|
||||
// setup "Tree View"
|
||||
QDockWidget* treeViewDock = new QDockWidget(i18n("Folders")); // TODO: naming?
|
||||
treeViewDock->setObjectName("treeViewDock");
|
||||
treeViewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
treeViewDock->setWidget(new TreeViewSidebarPage(this));
|
||||
|
||||
treeViewDock->toggleViewAction()->setText(i18n("Show Folders Panel"));
|
||||
actionCollection()->addAction("show_folders_panel", treeViewDock->toggleViewAction());
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, treeViewDock);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::updateHistory()
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<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>
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* 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>
|
||||
|
||||
|
@ -60,7 +60,7 @@ class InfoSidebarPage : public SidebarPage
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent=0);
|
||||
explicit InfoSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent = 0);
|
||||
virtual ~InfoSidebarPage();
|
||||
|
||||
protected:
|
||||
|
@ -161,12 +161,12 @@ private:
|
|||
* 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;
|
||||
|
@ -218,4 +218,4 @@ private:
|
|||
int m_index;
|
||||
};
|
||||
|
||||
#endif // _INFOSIDEBARPAGE_H_
|
||||
#endif // INFOSIDEBARPAGE_H
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "sidebarpage.h"
|
||||
#include "dolphinmainwindow.h"
|
||||
|
||||
SidebarPage::SidebarPage(DolphinMainWindow *mainWindow, QWidget* parent) :
|
||||
SidebarPage::SidebarPage(DolphinMainWindow* mainWindow, QWidget* parent) :
|
||||
QWidget(parent),
|
||||
m_mainWindow(mainWindow)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
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();
|
||||
|
||||
|
|
89
src/treeviewsidebarpage.cpp
Normal file
89
src/treeviewsidebarpage.cpp
Normal file
|
@ -0,0 +1,89 @@
|
|||
/***************************************************************************
|
||||
* 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"
|
65
src/treeviewsidebarpage.h
Normal file
65
src/treeviewsidebarpage.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/***************************************************************************
|
||||
* 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
|
Loading…
Reference in a new issue