┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2006-12-15 01:56:57 +0000
committerPeter Penz <[email protected]>2006-12-15 01:56:57 +0000
commit3b4dfa2040c1e970ba6689bd7a874fab5f423e2d (patch)
treea7a39cfcf80aae6bf0fc2c8bc1083673eba19079 /src/dolphinview.cpp
parent3bd97ea34c72164a2c583ec28eafcdfc887455cf (diff)
Update for using a proxy model: prevent accessing the model by model() and doing a cast do KDirModel afterwards. Instead the access to the KDirModel is done by a member variable. Still the proxy model does not seem to work and leads to a crash as soon as the QListView should work with the proxy model -> in the meantime in line 112 from DolphinView.cpp the KDirModel is used instead of the proxy model.
svn path=/trunk/playground/utils/dolphin/; revision=613768
Diffstat (limited to 'src/dolphinview.cpp')
-rw-r--r--src/dolphinview.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index c23cb2baa..1a02ddea0 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -67,6 +67,7 @@ DolphinView::DolphinView(DolphinMainWindow *mainWindow,
m_iconsView(0),
m_filterBar(0),
m_statusBar(0),
+ m_dirModel(0),
m_dirLister(0),
m_proxyModel(0)
{
@@ -102,20 +103,19 @@ DolphinView::DolphinView(DolphinMainWindow *mainWindow,
m_iconsView = new DolphinIconsView(this);
applyModeToView();
- KDirModel* model = new KDirModel();
- model->setDirLister(m_dirLister);
+ m_dirModel = new KDirModel();
+ m_dirModel->setDirLister(m_dirLister);
m_proxyModel = new DolphinSortFilterProxyModel(this);
- m_proxyModel->setSourceModel(model);
- m_proxyModel->setDynamicSortFilter(true);
+ m_proxyModel->setSourceModel(m_dirModel);
- m_iconsView->setModel(model);
+ m_iconsView->setModel(m_dirModel); // TODO: using m_proxyModel crashed when clicking on an item
KFileItemDelegate* delegate = new KFileItemDelegate(this);
m_iconsView->setItemDelegate(delegate);
m_dirLister->setDelayedMimeTypes(true);
- new KMimeTypeResolver(m_iconsView, model);
+ new KMimeTypeResolver(m_iconsView, m_dirModel);
m_iconSize = K3Icon::SizeMedium;
@@ -476,12 +476,11 @@ KFileItemList DolphinView::selectedItems() const
KFileItemList itemList;
if (selModel->hasSelection()) {
- KDirModel* dirModel = static_cast<KDirModel*>(m_iconsView->model());
const QModelIndexList indexList = selModel->selectedIndexes();
QModelIndexList::const_iterator end = indexList.end();
for (QModelIndexList::const_iterator it = indexList.begin(); it != end; ++it) {
- KFileItem* item = dirModel->itemForIndex(*it);
+ KFileItem* item = m_dirModel->itemForIndex(*it);
if (item != 0) {
itemList.append(item);
}
@@ -648,8 +647,7 @@ void DolphinView::triggerIconsViewItem(Q3IconViewItem* item)
void DolphinView::triggerItem(const QModelIndex& index)
{
- KDirModel* dirModel = static_cast<KDirModel*>(m_iconsView->model());
- KFileItem* item = dirModel->itemForIndex(index);
+ KFileItem* item = m_dirModel->itemForIndex(index);
if (item == 0) {
return;
}