┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-02-21 14:01:40 +0000
committerPeter Penz <[email protected]>2008-02-21 14:01:40 +0000
commit518372394da1f58da8e69acbb981a97db375e739 (patch)
tree3f0b0fb6449a23ed8369a84bdb4c5485e027c281 /src/dolphinview.cpp
parentb34ed68daf1923eacc9330ec49088fc24a56a415 (diff)
* Install an event-filter for the view implementations. Whenever a view implementation gets the focus, it should request it's activation.
* Let the metadata widget only get the focus by clicking. * Tried to install a similar filter for the wheel-event code duplication in the view-implementations, but the event filter is invoked _after_ the view implementation gets the wheel event... -> added a note the the 3 implementations as hint. svn path=/trunk/KDE/kdebase/apps/; revision=777757
Diffstat (limited to 'src/dolphinview.cpp')
-rw-r--r--src/dolphinview.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 6f351e63b..d6c5f6c25 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -537,17 +537,26 @@ void DolphinView::mouseReleaseEvent(QMouseEvent* event)
void DolphinView::wheelEvent(QWheelEvent* event)
{
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
- int d = event->delta();
- if (d > 0 && isZoomInPossible()) {
+ if (event->modifiers() & Qt::ControlModifier) {
+ const int delta = event->delta();
+ if ((delta > 0) && isZoomInPossible()) {
zoomIn();
- } else if (d < 0 && isZoomOutPossible()) {
+ } else if ((delta < 0) && isZoomOutPossible()) {
zoomOut();
}
- event->accept();
+ event->accept();
}
}
+bool DolphinView::eventFilter(QObject* watched, QEvent* event)
+{
+ if ((watched == itemView()) && (event->type() == QEvent::FocusIn)) {
+ m_controller->requestActivation();
+ }
+
+ return QWidget::eventFilter(watched, event);
+}
+
void DolphinView::activate()
{
setActive(true);
@@ -897,6 +906,8 @@ void DolphinView::createView()
}
Q_ASSERT(view != 0);
+ view->installEventFilter(this);
+
m_controller->setItemView(view);
m_fileItemDelegate = new KFileItemDelegate(view);