]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* don't show a tooltip if a rubberband selection is done
authorPeter Penz <peter.penz19@gmail.com>
Wed, 22 Oct 2008 06:11:59 +0000 (06:11 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 22 Oct 2008 06:11:59 +0000 (06:11 +0000)
* hide a tooltip if a drag operation has been started

BUG: 173148
CCMAIL: simon@etotheipiplusone.com

svn path=/trunk/KDE/kdebase/apps/; revision=874641

src/dolphincolumnwidget.cpp
src/dolphincontroller.cpp
src/dolphincontroller.h
src/dolphindetailsview.cpp
src/dolphiniconsview.cpp
src/dolphinview.cpp
src/draganddrophelper.cpp
src/draganddrophelper.h
src/tooltipmanager.cpp
src/tooltipmanager.h

index 177de5444395d831d34ea8f12f6170b3c7fc803a..7f93638403e62a6556db9d3de51f3b29fc61395a 100644 (file)
@@ -289,7 +289,7 @@ QStyleOptionViewItem DolphinColumnWidget::viewOptions() const
 
 void DolphinColumnWidget::startDrag(Qt::DropActions supportedActions)
 {
 
 void DolphinColumnWidget::startDrag(Qt::DropActions supportedActions)
 {
-    DragAndDropHelper::startDrag(this, supportedActions);
+    DragAndDropHelper::startDrag(this, supportedActions, m_view->m_controller);
 }
 
 void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event)
 }
 
 void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event)
index 9732316873e589349cd6edfc83721ac0fd864900..8493d877fa957b63b6d55ad87145d1965d66a31b 100644 (file)
@@ -153,6 +153,11 @@ void DolphinController::replaceUrlByClipboard()
     }
 }
 
     }
 }
 
+void DolphinController::emitHideToolTip()
+{
+    emit hideToolTip();
+}
+
 KFileItem DolphinController::itemForIndex(const QModelIndex& index) const
 {
     Q_ASSERT(m_itemView != 0);
 KFileItem DolphinController::itemForIndex(const QModelIndex& index) const
 {
     Q_ASSERT(m_itemView != 0);
index 312cea3ccc8f680064674318ebbba41bf84717c3..fd1b04ffcd87ba209b2f96fe19f5c506dde7653e 100644 (file)
@@ -64,6 +64,7 @@ class QWidget;
  * - emitItemEntered()
  * - emitViewportEntered()
  * - replaceUrlByClipboard()
  * - emitItemEntered()
  * - emitViewportEntered()
  * - replaceUrlByClipboard()
+ * - hideToolTip()
  *
  * The communication of the abstract view to the view implementations is done by:
  * - setUrl()
  *
  * The communication of the abstract view to the view implementations is done by:
  * - setUrl()
@@ -204,6 +205,9 @@ public:
      * nothing will be done.
      */
     void replaceUrlByClipboard();
      * nothing will be done.
      */
     void replaceUrlByClipboard();
+    
+    /** Emits the signal hideToolTip(). */
+    void emitHideToolTip();
 
     /**
      * Returns the file item for the proxy index \a index of the view \a view.
 
     /**
      * Returns the file item for the proxy index \a index of the view \a view.
@@ -334,6 +338,11 @@ signals:
      * must connect to this signal if it supports zooming.
      */
     void zoomLevelChanged(int level);
      * must connect to this signal if it supports zooming.
      */
     void zoomLevelChanged(int level);
+    
+    /**
+     * Is emitted if the abstract view should hide an open tooltip.
+     */
+    void hideToolTip();
 
 private slots:
     void updateOpenTabState();
 
 private slots:
     void updateOpenTabState();
index be7da836838f95c5d456b4ffc6a2931d69363e4f..ffddb29c14d4d74f6a7582795dd41c3560c31843 100644 (file)
@@ -306,7 +306,7 @@ void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event)
 
 void DolphinDetailsView::startDrag(Qt::DropActions supportedActions)
 {
 
 void DolphinDetailsView::startDrag(Qt::DropActions supportedActions)
 {
-    DragAndDropHelper::startDrag(this, supportedActions);
+    DragAndDropHelper::startDrag(this, supportedActions, m_controller);
     m_showElasticBand = false;
 }
 
     m_showElasticBand = false;
 }
 
index 14a8b9fcaa3ca9ae9ea1a7980293802e24b46299..83379e279c85985df839fc0fc02009bfd0226db3 100644 (file)
@@ -209,7 +209,7 @@ void DolphinIconsView::startDrag(Qt::DropActions supportedActions)
     // TODO: invoking KCategorizedView::startDrag() should not be necessary, we'll
     // fix this in KDE 4.1
     KCategorizedView::startDrag(supportedActions);
     // TODO: invoking KCategorizedView::startDrag() should not be necessary, we'll
     // fix this in KDE 4.1
     KCategorizedView::startDrag(supportedActions);
-    DragAndDropHelper::startDrag(this, supportedActions);
+    DragAndDropHelper::startDrag(this, supportedActions, m_controller);
 }
 
 void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
 }
 
 void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
index d0e1b8bd24bb4b78b7c1798342e6509c83639731..9d6038c2c7c9aa4eb68a21656fcb0de4376a3822 100644 (file)
@@ -1232,6 +1232,8 @@ void DolphinView::createView()
 
     if (DolphinSettings::instance().generalSettings()->showToolTips()) {
         m_toolTipManager = new ToolTipManager(view, m_proxyModel);
 
     if (DolphinSettings::instance().generalSettings()->showToolTips()) {
         m_toolTipManager = new ToolTipManager(view, m_proxyModel);
+        connect(m_controller, SIGNAL(hideToolTip()),
+                m_toolTipManager, SLOT(hideTip()));
     }
 
     m_topLayout->insertWidget(1, view);
     }
 
     m_topLayout->insertWidget(1, view);
index ab674cd5cdb79551cd10de44a521fbd57c4b75e8..6d8854d2d5d8aa8090afbeb09224ca4956667650 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "draganddrophelper.h"
 #include "dolphiniconsview.h"
 
 #include "draganddrophelper.h"
 #include "dolphiniconsview.h"
+#include "dolphincontroller.h"
 
 #include <kdirmodel.h>
 #include <kicon.h>
 
 #include <kdirmodel.h>
 #include <kicon.h>
@@ -27,7 +28,9 @@
 #include <QAbstractProxyModel>
 #include <QDrag>
 
 #include <QAbstractProxyModel>
 #include <QDrag>
 
-void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions)
+void DragAndDropHelper::startDrag(QAbstractItemView* itemView,
+                                  Qt::DropActions supportedActions,
+                                  DolphinController* controller)
 {
     QModelIndexList indexes = itemView->selectionModel()->selectedIndexes();
     if (indexes.count() > 0) {
 {
     QModelIndexList indexes = itemView->selectionModel()->selectedIndexes();
     if (indexes.count() > 0) {
@@ -35,6 +38,10 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions s
         if (data == 0) {
             return;
         }
         if (data == 0) {
             return;
         }
+        
+        if (controller != 0) {
+            controller->emitHideToolTip();
+        }
 
         QDrag* drag = new QDrag(itemView);
         QPixmap pixmap;
 
         QDrag* drag = new QDrag(itemView);
         QPixmap pixmap;
index 93f9ddd127065904030da1e4128cbd8502f808ab..64e347e9c5ed7f14dc318b88d1e84f55eb8c1a90 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <QtCore/Qt>
 
 
 #include <QtCore/Qt>
 
+class DolphinController;
 class QAbstractItemView;
 class QBrush;
 class QRect;
 class QAbstractItemView;
 class QBrush;
 class QRect;
@@ -41,7 +42,9 @@ public:
     /**
      * Creates a drag object for the view \a itemView for all selected items.
      */
     /**
      * Creates a drag object for the view \a itemView for all selected items.
      */
-    static void startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions);
+    static void startDrag(QAbstractItemView* itemView,
+                          Qt::DropActions supportedActions,
+                          DolphinController* controller = 0);
 };
 
 #endif
 };
 
 #endif
index ad1dbe5d3d7776ee6cdb640402a619abcd174c05..3caff4ae1a872e7bcb05b0be6ae92d2e6be6e248 100644 (file)
@@ -182,6 +182,12 @@ void ToolTipManager::prepareToolTip()
 
 void ToolTipManager::showToolTip(KToolTipItem* tip)
 {
 
 void ToolTipManager::showToolTip(KToolTipItem* tip)
 {
+    if (QApplication::mouseButtons() & Qt::LeftButton) {
+        delete tip;
+        tip = 0;
+        return;
+    }
+    
     KStyleOptionToolTip option;
     // TODO: get option content from KToolTip or add KToolTip::sizeHint() method
     option.direction      = QApplication::layoutDirection();
     KStyleOptionToolTip option;
     // TODO: get option content from KToolTip or add KToolTip::sizeHint() method
     option.direction      = QApplication::layoutDirection();
index 213f95871e350544f79d72933fa9bcdb35e2ccdf..96df4819e1d9bac54c8d05ebb8e6b6df7954f03c 100644 (file)
@@ -48,6 +48,7 @@ public:
                             DolphinSortFilterProxyModel* model);
     virtual ~ToolTipManager();
 
                             DolphinSortFilterProxyModel* model);
     virtual ~ToolTipManager();
 
+public slots:
     /**
      * Hides the currently shown tooltip. Invoking this method is
      * only needed when the tooltip should be hidden although
     /**
      * Hides the currently shown tooltip. Invoking this method is
      * only needed when the tooltip should be hidden although