diff options
| author | Peter Penz <[email protected]> | 2007-03-27 19:08:44 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-03-27 19:08:44 +0000 |
| commit | fd060ce7f67a95b1e3f41d3ff091595f34704920 (patch) | |
| tree | b5735e2c268b8461ede653ab2dfe83318122e42e /src/dolphinview.cpp | |
| parent | 3546be263253a3982077122fb861ebfb64d7de1d (diff) | |
Initial version for a column view support (thanks a lot to Benjamin Meyer for QColumnView in Qt4.3!). Currently there is a problem when using the DolphinSortFilterProxyModel: some items get duplicated, but I doubt it's an issue in QColumnView (the same issue occurs when using QTreeView) -> further investigations necessary...
svn path=/trunk/KDE/kdebase/apps/; revision=647234
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 17bbd608d..04b949a7d 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -39,6 +39,7 @@ #include <konq_operations.h> #include <kurl.h> +#include "dolphincolumnview.h" #include "dolphincontroller.h" #include "dolphinstatusbar.h" #include "dolphinmainwindow.h" @@ -71,6 +72,7 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow, m_controller(0), m_iconsView(0), m_detailsView(0), + m_columnView(0), m_fileItemDelegate(0), m_filterBar(0), m_statusBar(0), @@ -597,7 +599,16 @@ void DolphinView::loadDirectory(const KUrl& url) const ViewProperties props(url); const Mode mode = props.viewMode(); - if (m_mode != mode) { + bool changeMode = (m_mode != mode); + if (changeMode && isColumnViewActive()) { + // The column view is active. Only change the + // mode if the current URL is no child of the column view. + if (m_dirLister->url().isParentOf(url)) { + changeMode = false; + } + } + + if (changeMode) { m_mode = mode; createView(); emit modeChanged(); @@ -824,7 +835,15 @@ void DolphinView::startDirLister(const KUrl& url, bool reload) m_cutItemsCache.clear(); m_blockContentsMovedSignal = true; m_dirLister->stop(); - m_dirLister->openUrl(url, false, reload); + + bool keepOldDirs = isColumnViewActive(); + if (keepOldDirs && !m_dirLister->url().isParentOf(url)) { + // The current URL is not a child of the dir lister + // URL. This may happen when e. g. a bookmark has been selected + // and hence the view must be reset. + keepOldDirs = false; + } + m_dirLister->openUrl(url, keepOldDirs, reload); } QString DolphinView::defaultStatusBarText() const @@ -1072,11 +1091,13 @@ void DolphinView::createView() view = 0; m_iconsView = 0; m_detailsView = 0; + m_columnView = 0; m_fileItemDelegate = 0; } Q_ASSERT(m_iconsView == 0); Q_ASSERT(m_detailsView == 0); + Q_ASSERT(m_columnView == 0); // ... and recreate it representing the current mode switch (m_mode) { @@ -1089,6 +1110,11 @@ void DolphinView::createView() m_detailsView = new DolphinDetailsView(this, m_controller); view = m_detailsView; break; + + case ColumnView: + m_columnView = new DolphinColumnView(this, m_controller); + view = m_columnView; + break; } Q_ASSERT(view != 0); @@ -1125,10 +1151,13 @@ void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags) QAbstractItemView* DolphinView::itemView() const { - Q_ASSERT((m_iconsView == 0) || (m_detailsView == 0)); if (m_detailsView != 0) { return m_detailsView; } + else if (m_columnView != 0) { + return m_columnView; + } + return m_iconsView; } |
