diff options
| author | John Tapsell <[email protected]> | 2007-12-03 10:32:27 +0000 |
|---|---|---|
| committer | John Tapsell <[email protected]> | 2007-12-03 10:32:27 +0000 |
| commit | e80f07735774cfd8e4debef48cbef7869506e585 (patch) | |
| tree | f3da24f85c408335ca17c7190aab466e766146b6 /src/dolphincolumnwidget.cpp | |
| parent | 0f4ecd1c61631bcd8fb050f4d8af5c49e78bbeee (diff) | |
The first columns model and selection model should be the same as the view's model and selection model.
This means
1) We don't leak memory switching to and from column view
2) Selection is preserved when switching views
3) We don't have 2 models running for the root directory
CCMAIL:[email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=744386
Diffstat (limited to 'src/dolphincolumnwidget.cpp')
| -rw-r--r-- | src/dolphincolumnwidget.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index 677215972..abd236c7d 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -115,18 +115,16 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent, m_dirLister->setShowingDotFiles(showHiddenFiles); connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)), this, SLOT(generatePreviews(const KFileItemList&))); +} - m_dolphinModel = new DolphinModel(this); - m_dolphinModel->setDirLister(m_dirLister); - m_dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory); - - m_proxyModel = new DolphinSortFilterProxyModel(this); - m_proxyModel->setSourceModel(m_dolphinModel); - - setModel(m_proxyModel); +void DolphinColumnWidget::setModel ( QAbstractItemModel * model ) +{ + m_proxyModel = dynamic_cast<DolphinSortFilterProxyModel *>(model); + if(m_proxyModel) + m_dolphinModel = dynamic_cast<DolphinModel *>(m_proxyModel->sourceModel()); new KMimeTypeResolver(this, m_dolphinModel); - - m_dirLister->openUrl(url, KDirLister::NoFlags); + m_dirLister->openUrl(m_url, KDirLister::NoFlags); + QListView::setModel(m_proxyModel); } DolphinColumnWidget::~DolphinColumnWidget() |
