From: Peter Penz Date: Wed, 22 Oct 2008 06:11:59 +0000 (+0000) Subject: * don't show a tooltip if a rubberband selection is done X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/cb928888f7e8b0450fc8c4cf0dd4f5ea3c46eb42?ds=sidebyside * don't show a tooltip if a rubberband selection is done * hide a tooltip if a drag operation has been started BUG: 173148 CCMAIL: simon@etotheipiplusone.com svn path=/trunk/KDE/kdebase/apps/; revision=874641 --- diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp index 177de5444..7f9363840 100644 --- a/src/dolphincolumnwidget.cpp +++ b/src/dolphincolumnwidget.cpp @@ -289,7 +289,7 @@ QStyleOptionViewItem DolphinColumnWidget::viewOptions() const void DolphinColumnWidget::startDrag(Qt::DropActions supportedActions) { - DragAndDropHelper::startDrag(this, supportedActions); + DragAndDropHelper::startDrag(this, supportedActions, m_view->m_controller); } void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event) diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index 973231687..8493d877f 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -153,6 +153,11 @@ void DolphinController::replaceUrlByClipboard() } } +void DolphinController::emitHideToolTip() +{ + emit hideToolTip(); +} + KFileItem DolphinController::itemForIndex(const QModelIndex& index) const { Q_ASSERT(m_itemView != 0); diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index 312cea3cc..fd1b04ffc 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -64,6 +64,7 @@ class QWidget; * - emitItemEntered() * - emitViewportEntered() * - replaceUrlByClipboard() + * - hideToolTip() * * 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(); + + /** Emits the signal hideToolTip(). */ + void emitHideToolTip(); /** * 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); + + /** + * Is emitted if the abstract view should hide an open tooltip. + */ + void hideToolTip(); private slots: void updateOpenTabState(); diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index be7da8368..ffddb29c1 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -306,7 +306,7 @@ void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event) void DolphinDetailsView::startDrag(Qt::DropActions supportedActions) { - DragAndDropHelper::startDrag(this, supportedActions); + DragAndDropHelper::startDrag(this, supportedActions, m_controller); m_showElasticBand = false; } diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 14a8b9fca..83379e279 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -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); - DragAndDropHelper::startDrag(this, supportedActions); + DragAndDropHelper::startDrag(this, supportedActions, m_controller); } void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event) diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index d0e1b8bd2..9d6038c2c 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -1232,6 +1232,8 @@ void DolphinView::createView() 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); diff --git a/src/draganddrophelper.cpp b/src/draganddrophelper.cpp index ab674cd5c..6d8854d2d 100644 --- a/src/draganddrophelper.cpp +++ b/src/draganddrophelper.cpp @@ -19,6 +19,7 @@ #include "draganddrophelper.h" #include "dolphiniconsview.h" +#include "dolphincontroller.h" #include #include @@ -27,7 +28,9 @@ #include #include -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) { @@ -35,6 +38,10 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions s if (data == 0) { return; } + + if (controller != 0) { + controller->emitHideToolTip(); + } QDrag* drag = new QDrag(itemView); QPixmap pixmap; diff --git a/src/draganddrophelper.h b/src/draganddrophelper.h index 93f9ddd12..64e347e9c 100644 --- a/src/draganddrophelper.h +++ b/src/draganddrophelper.h @@ -22,6 +22,7 @@ #include +class DolphinController; class QAbstractItemView; class QBrush; class QRect; @@ -41,7 +42,9 @@ public: /** * 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 diff --git a/src/tooltipmanager.cpp b/src/tooltipmanager.cpp index ad1dbe5d3..3caff4ae1 100644 --- a/src/tooltipmanager.cpp +++ b/src/tooltipmanager.cpp @@ -182,6 +182,12 @@ void ToolTipManager::prepareToolTip() 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(); diff --git a/src/tooltipmanager.h b/src/tooltipmanager.h index 213f95871..96df4819e 100644 --- a/src/tooltipmanager.h +++ b/src/tooltipmanager.h @@ -48,6 +48,7 @@ public: DolphinSortFilterProxyModel* model); virtual ~ToolTipManager(); +public slots: /** * Hides the currently shown tooltip. Invoking this method is * only needed when the tooltip should be hidden although