-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(m_url, KDirLister::NoFlags);
- QListView::setModel(m_proxyModel);
+ 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);
+ m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ const DolphinView* dolphinView = m_view->m_controller->dolphinView();
+ m_proxyModel->setSorting(dolphinView->sorting());
+ m_proxyModel->setSortOrder(dolphinView->sortOrder());
+
+ setModel(m_proxyModel);
+
+ if (DolphinSettings::instance().generalSettings()->showSelectionToggle()) {
+ m_selectionManager = new SelectionManager(this);
+ connect(m_selectionManager, SIGNAL(selectionChanged()),
+ this, SLOT(requestActivation()));
+ connect(m_view->m_controller, SIGNAL(urlChanged(const KUrl&)),
+ m_selectionManager, SLOT(reset()));
+ }
+
+ m_previewGenerator = new KFilePreviewGenerator(this);
+ m_previewGenerator->setPreviewShown(m_view->m_controller->dolphinView()->showPreview());
+
+ if (DolphinSettings::instance().generalSettings()->showToolTips()) {
+ m_toolTipManager = new ToolTipManager(this, m_proxyModel);
+ }
+
+ m_dirLister->openUrl(url, KDirLister::NoFlags);
+
+ connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()),
+ this, SLOT(updateFont()));
+
+ FolderExpander* folderExpander = new FolderExpander(this, m_proxyModel);
+ folderExpander->setEnabled(DolphinSettings::instance().generalSettings()->autoExpandFolders());
+ connect (folderExpander, SIGNAL(enterDir(const QModelIndex&)),
+ m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));