From c05395ef9a6f449bd96b4323d308b53d70cede99 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 29 Aug 2009 09:42:21 +0000 Subject: Move code for initializing and handling view extensions to the new class ViewExtensionsFactory. Beside making DolphinView less complex this will allow the column view to share the view extension code instead of (partly) duplicating it as it has been done before. Currently only the tooltips- and filepreview-handling have been moved into ViewExtensionsFactory, a further cleanup will be done later. svn path=/trunk/KDE/kdebase/apps/; revision=1016893 --- src/dolphinview.cpp | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 2e41b4aa4..42305be1f 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -62,7 +61,6 @@ #include "draganddrophelper.h" #include "folderexpander.h" #include "renamedialog.h" -#include "tooltips/tooltipmanager.h" #include "settings/dolphinsettings.h" #include "versioncontrolobserver.h" #include "viewproperties.h" @@ -96,8 +94,6 @@ DolphinView::DolphinView(QWidget* parent, m_viewAccessor(proxyModel), m_selectionModel(0), m_selectionChangedTimer(0), - m_previewGenerator(0), - m_toolTipManager(0), m_versionControlObserver(0), m_rootUrl(), m_activeItemUrl(), @@ -388,7 +384,6 @@ void DolphinView::setZoomLevel(int level) if (level != zoomLevel()) { m_controller->setZoomLevel(level); - m_previewGenerator->updateIcons(); emit zoomLevelChanged(level); } } @@ -483,7 +478,6 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl) return; } - m_previewGenerator->cancelPreviews(); m_controller->setUrl(url); // emits urlChanged, which we forward if (m_viewAccessor.prepareUrlChange(url)) { initializeView(); @@ -754,8 +748,6 @@ void DolphinView::setShowPreview(bool show) props.setShowPreview(show); m_showPreview = show; - m_previewGenerator->setPreviewShown(show); - const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); @@ -886,10 +878,6 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) case QEvent::KeyPress: if (watched == m_viewAccessor.itemView()) { - if (m_toolTipManager != 0) { - m_toolTipManager->hideTip(); - } - // clear the selection when Escape has been pressed QKeyEvent* keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Escape) { @@ -924,9 +912,6 @@ void DolphinView::triggerItem(const KFileItem& item) return; } - if (m_toolTipManager != 0) { - m_toolTipManager->hideTip(); - } emit itemTriggered(item); // caught by DolphinViewContainer or DolphinPart } @@ -953,10 +938,6 @@ void DolphinView::openContextMenu(const QPoint& pos, item = m_viewAccessor.dirModel()->itemForIndex(dolphinModelIndex); } - if (m_toolTipManager != 0) { - m_toolTipManager->hideTip(); - } - m_isContextMenuOpen = true; // TODO: workaround for Qt-issue 207192 emit requestContextMenu(item, url(), customActions); m_isContextMenuOpen = false; @@ -1300,8 +1281,6 @@ void DolphinView::applyViewProperties() const bool showPreview = props.showPreview(); if (showPreview != m_showPreview) { m_showPreview = showPreview; - m_previewGenerator->setPreviewShown(showPreview); - const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); @@ -1342,11 +1321,6 @@ void DolphinView::deleteView() m_topLayout->removeWidget(view); view->close(); - // m_previewGenerator's parent is not always destroyed, and we - // don't want two active at once - manually delete. - delete m_previewGenerator; - m_previewGenerator = 0; - disconnect(view); m_controller->disconnect(view); view->disconnect(); @@ -1357,7 +1331,6 @@ void DolphinView::deleteView() m_viewAccessor.deleteView(); m_fileItemDelegate = 0; - m_toolTipManager = 0; } } @@ -1412,9 +1385,6 @@ void DolphinView::initializeView() view->setSelectionMode(QAbstractItemView::ExtendedSelection); - m_previewGenerator = new KFilePreviewGenerator(view); - m_previewGenerator->setPreviewShown(m_showPreview); - m_versionControlObserver = new VersionControlObserver(view); connect(m_versionControlObserver, SIGNAL(infoMessage(const QString&)), this, SIGNAL(infoMessage(const QString&))); @@ -1423,12 +1393,6 @@ void DolphinView::initializeView() connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(const QString&)), this, SIGNAL(operationCompletedMessage(const QString&))); - if (DolphinSettings::instance().generalSettings()->showToolTips()) { - m_toolTipManager = new ToolTipManager(view, m_viewAccessor.proxyModel()); - connect(m_controller, SIGNAL(hideToolTip()), - m_toolTipManager, SLOT(hideTip())); - } - connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(emitDelayedSelectionChangedSignal())); connect(view->verticalScrollBar(), SIGNAL(valueChanged(int)), @@ -1493,11 +1457,11 @@ void DolphinView::ViewAccessor::createView(QWidget* parent, switch (mode) { case IconsView: - m_iconsView = new DolphinIconsView(parent, controller); + m_iconsView = new DolphinIconsView(parent, controller, m_proxyModel); break; case DetailsView: - m_detailsView = new DolphinDetailsView(parent, controller); + m_detailsView = new DolphinDetailsView(parent, controller, m_proxyModel); break; case ColumnView: -- cgit v1.3