diff options
| author | Rafael Fernández López <[email protected]> | 2007-09-17 04:02:17 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-09-17 04:02:17 +0000 |
| commit | c8072005fada01d772595ec64adca449134f421e (patch) | |
| tree | 2bbcad6b43218569c813ef888bec3ad009335b69 /src/dolphinviewcontainer.cpp | |
| parent | 231436769d037a83afbf57fedea167b6fb9a5ad4 (diff) | |
Create the new architecture for KCategorizedView. Now DolphinModel is created, inheriting KDirModel for returning valid data for the role of the category of
an item. DolphinSortFilterProxyModel implements now methods lessThanCategoryMethod and lessThanGeneralMethod from KCategorizedSortFilterProxyModel.
The only thing that needs to be adapted is the keyboard navigation on the KCategorizedView.
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=713319
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 379c238d9..c30b2d0bc 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -27,7 +27,6 @@ #include <QtCore/QTimer> #include <QtGui/QScrollBar> -#include <kdirmodel.h> #include <kfileitemdelegate.h> #include <kfileplacesmodel.h> #include <kglobalsettings.h> @@ -41,6 +40,7 @@ #include <konq_operations.h> #include <kurl.h> +#include "dolphinmodel.h" #include "dolphincolumnview.h" #include "dolphincontroller.h" #include "dolphinstatusbar.h" @@ -50,7 +50,6 @@ #include "dolphindetailsview.h" #include "dolphiniconsview.h" #include "dolphincontextmenu.h" -#include "dolphinitemcategorizer.h" #include "filterbar.h" #include "renamedialog.h" #include "kurlnavigator.h" @@ -71,7 +70,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, m_view(0), m_filterBar(0), m_statusBar(0), - m_dirModel(0), m_dirLister(0), m_proxyModel(0) { @@ -96,12 +94,13 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, m_dirLister->setMainWindow(this); m_dirLister->setDelayedMimeTypes(true); - m_dirModel = new KDirModel(); - m_dirModel->setDirLister(m_dirLister); - m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory); + m_dolphinModel = new DolphinModel(); + m_dolphinModel->setDirLister(m_dirLister); + m_dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory); + m_proxyModel = new DolphinSortFilterProxyModel(this); - m_proxyModel->setSourceModel(m_dirModel); + m_proxyModel->setSourceModel(m_dolphinModel); connect(m_dirLister, SIGNAL(clear()), this, SLOT(updateStatusBar())); @@ -119,7 +118,7 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow, m_view = new DolphinView(this, url, m_dirLister, - m_dirModel, + m_dolphinModel, m_proxyModel); connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_urlNavigator, SLOT(setUrl(const KUrl&))); @@ -268,8 +267,8 @@ bool DolphinViewContainer::isUrlEditable() const KFileItem DolphinViewContainer::fileItem(const QModelIndex& index) const { - const QModelIndex dirModelIndex = m_proxyModel->mapToSource(index); - return m_dirModel->itemForIndex(dirModelIndex); + const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index); + return m_dolphinModel->itemForIndex(dolphinModelIndex); } void DolphinViewContainer::updateProgress(int percent) @@ -349,6 +348,21 @@ void DolphinViewContainer::closeFilterBar() QString DolphinViewContainer::defaultStatusBarText() const { + int m_fileCount = 0; + int m_folderCount = 0; + + for (int i = 0; i < m_proxyModel->rowCount(); i++) + { + if (m_dolphinModel->itemForIndex(m_proxyModel->mapToSource(m_proxyModel->index(i, m_proxyModel->sortColumn()))).isDir()) + { + m_folderCount++; + } + else + { + m_fileCount++; + } + } + return KIO::itemsSummaryString(m_fileCount + m_folderCount, m_fileCount, m_folderCount, @@ -448,6 +462,8 @@ void DolphinViewContainer::changeNameFilter(const QString& nameFilter) #else m_proxyModel->setFilterRegExp(nameFilter); #endif + + updateStatusBar(); } void DolphinViewContainer::openContextMenu(const KFileItem& item, |
