From: Peter Penz Date: Sun, 23 Nov 2008 11:54:24 +0000 (+0000) Subject: Fixes MS Windows related issue that when opening a context menu above an item, that... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/d5c0a60505fd5f20a4069d8fe3bcf4ae0b0b3594 Fixes MS Windows related issue that when opening a context menu above an item, that the item itself gets triggered too when the single click is used. BUG: 168940 svn path=/trunk/KDE/kdebase/apps/; revision=887975 --- diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index 8493d877f..f6ee66634 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -29,7 +29,7 @@ DolphinController::DolphinController(DolphinView* dolphinView) : QObject(dolphinView), m_zoomLevel(0), - m_openTab(false), + m_mouseButtons(Qt::NoButton), m_url(), m_dolphinView(dolphinView), m_itemView(0) @@ -52,7 +52,7 @@ void DolphinController::setItemView(QAbstractItemView* view) { if (m_itemView != 0) { disconnect(m_itemView, SIGNAL(pressed(const QModelIndex&)), - this, SLOT(updateOpenTabState())); + this, SLOT(updateMouseButtonState())); } m_itemView = view; @@ -62,7 +62,7 @@ void DolphinController::setItemView(QAbstractItemView* view) // TODO: this is a workaround until Qt-issue 176832 has been fixed connect(m_itemView, SIGNAL(pressed(const QModelIndex&)), - this, SLOT(updateOpenTabState())); + this, SLOT(updateMouseButtonState())); } } @@ -170,8 +170,13 @@ KFileItem DolphinController::itemForIndex(const QModelIndex& index) const void DolphinController::triggerItem(const QModelIndex& index) { - const bool openTab = m_openTab; - m_openTab = false; + if (m_mouseButtons & Qt::RightButton) { + // a context menu is opened - assure that no triggering is done + return; + } + + const bool openTab = m_mouseButtons & Qt::MidButton; + m_mouseButtons = Qt::NoButton; const KFileItem item = itemForIndex(index); if (index.isValid() && (index.column() == KDirModel::Name)) { @@ -201,9 +206,9 @@ void DolphinController::emitViewportEntered() emit viewportEntered(); } -void DolphinController::updateOpenTabState() +void DolphinController::updateMouseButtonState() { - m_openTab = QApplication::mouseButtons() & Qt::MidButton; + m_mouseButtons = QApplication::mouseButtons(); } #include "dolphincontroller.moc" diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index fd1b04ffc..13a840a38 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -345,11 +345,11 @@ signals: void hideToolTip(); private slots: - void updateOpenTabState(); + void updateMouseButtonState(); private: int m_zoomLevel; - bool m_openTab; // TODO: this is a workaround until Qt-issue 176832 has been fixed + Qt::MouseButtons m_mouseButtons; // TODO: this is a workaround until Qt-issue 176832 has been fixed KUrl m_url; DolphinView* m_dolphinView; QAbstractItemView* m_itemView;