/***************************************************************************
- * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
#include "dolphin_generalsettings.h"
-#include <kdirlister.h>
-#include <kdirmodel.h>
-#include <kfilepreviewgenerator.h>
+#include <KDirLister>
+#include <KDirModel>
+#include <KFilePreviewGenerator>
#include <QAbstractItemView>
#include <QApplication>
DolphinViewController* dolphinViewController,
const ViewModeController* viewModeController) :
QObject(view),
- m_appliedPointingHandCursor(false),
m_view(view),
m_dolphinViewController(dolphinViewController),
m_toolTipManager(0),
this, SLOT(slotShowPreviewChanged()));
// initialize selection manager
- if (settings->showSelectionToggle()) {
- m_selectionManager = new SelectionManager(view);
- connect(m_selectionManager, SIGNAL(selectionChanged()),
- this, SLOT(requestActivation()));
- connect(viewModeController, SIGNAL(urlChanged(const KUrl&)),
- m_selectionManager, SLOT(reset()));
- }
+ m_selectionManager = new SelectionManager(view);
+ connect(m_selectionManager, SIGNAL(selectionChanged()),
+ this, SLOT(requestActivation()));
+ connect(viewModeController, SIGNAL(urlChanged(const KUrl&)),
+ m_selectionManager, SLOT(reset()));
// initialize auto scroller
m_autoScroller = new DolphinViewAutoScroller(view);
this, SLOT(slotNameFilterChanged(const QString&)));
view->viewport()->installEventFilter(this);
-
- // Apply a pointing-hand cursor when hovering files
- connect(view, SIGNAL(entered(const QModelIndex&)), SLOT(applyPointingHandCursor()));
- connect(view, SIGNAL(viewportEntered()), SLOT(restoreCursor()));
}
ViewExtensionsFactory::~ViewExtensionsFactory()
bool ViewExtensionsFactory::eventFilter(QObject* watched, QEvent* event)
{
Q_UNUSED(watched);
-
- switch (event->type()) {
- case QEvent::Wheel:
- if (m_selectionManager != 0) {
- m_selectionManager->reset();
- }
- break;
-
- case QEvent::Leave:
- restoreCursor();
- break;
-
- default: break;
+ if ((event->type() == QEvent::Wheel) && (m_selectionManager != 0)) {
+ m_selectionManager->reset();
}
-
return false;
}
m_dolphinViewController->requestActivation();
}
-void ViewExtensionsFactory::applyPointingHandCursor()
-{
- if (!m_appliedPointingHandCursor && !(QApplication::mouseButtons() & Qt::LeftButton)) {
- QApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor));
- m_appliedPointingHandCursor = true;
- }
-}
-
-void ViewExtensionsFactory::restoreCursor()
-{
- if (m_appliedPointingHandCursor) {
- QApplication::restoreOverrideCursor();
- m_appliedPointingHandCursor = false;
- }
-}
-
DolphinSortFilterProxyModel* ViewExtensionsFactory::proxyModel() const
{
return static_cast<DolphinSortFilterProxyModel*>(m_view->model());