]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/selectiontoggle.cpp
Fix compilation when Nepomuk is not available
[dolphin.git] / src / views / selectiontoggle.cpp
index f5287a3dd7a2c05637f5669de31d61865696d7cc..e08a0220e19e274b16d3f48de791f00cca722670 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2008 by Peter Penz <peter.penz@gmx.at>                  *
+ *   Copyright (C) 2008 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 "selectiontoggle.h"
 
-#include <kglobalsettings.h>
-#include <kicon.h>
-#include <kiconloader.h>
-#include <kiconeffect.h>
-#include <klocale.h>
+#include <KGlobalSettings>
+#include <KIcon>
+#include <KIconLoader>
+#include <KIconEffect>
+#include <KLocale>
 
+#include <QApplication>
 #include <QPainter>
 #include <QPaintEvent>
 #include <QRect>
 #include <QTimer>
 #include <QTimeLine>
 
+#include <KDebug>
+
 SelectionToggle::SelectionToggle(QWidget* parent) :
     QAbstractButton(parent),
     m_isHovered(false),
@@ -104,25 +107,12 @@ void SelectionToggle::setVisible(bool visible)
 
 bool SelectionToggle::eventFilter(QObject* obj, QEvent* event)
 {
-    if (obj == parent()) {
-        switch (event->type()) {
-        case QEvent::Leave:
-            hide();
-            break;
-
-        case QEvent::MouseMove:
-            if (m_leftMouseButtonPressed) {
-                // Don't forward mouse move events to the viewport,
-                // otherwise a rubberband selection will be shown when
-                // clicking on the selection toggle and moving the mouse
-                // above the viewport.
-                return true;
-            }
-            break;
-
-        default:
-            break;
-        }
+    if ((obj == parent()) && (event->type() == QEvent::MouseMove) && m_leftMouseButtonPressed) {
+        // Don't forward mouse move events to the viewport,
+        // otherwise a rubberband selection will be shown when
+        // clicking on the selection toggle and moving the mouse
+        // above the viewport.
+        return true;
     }
 
     return QAbstractButton::eventFilter(obj, event);
@@ -147,6 +137,7 @@ void SelectionToggle::enterEvent(QEvent* event)
 void SelectionToggle::leaveEvent(QEvent* event)
 {
     QAbstractButton::leaveEvent(event);
+
     m_isHovered = false;
     update();
 }