From e80f07735774cfd8e4debef48cbef7869506e585 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Mon, 3 Dec 2007 10:32:27 +0000 Subject: 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:peter.penz@gmx.at svn path=/trunk/KDE/kdebase/apps/; revision=744386 --- src/dolphincolumnwidget.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/dolphincolumnwidget.cpp') 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(model); + if(m_proxyModel) + m_dolphinModel = dynamic_cast(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() -- cgit v1.3