Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
kdebase4
bko#259335-plasma-doubleclick-dnd.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bko#259335-plasma-doubleclick-dnd.diff of Package kdebase4
commit 40e65858d62915c6ea57c48207242729ea063053 Author: Aaron Seigo <aseigo@kde.org> Date: Sun Jan 30 12:13:37 2011 -0800 From: wstephenson@suse.de Subject: fix folderview drag and drop when double-click to select is enable (bko#259335) Patch-upstream: 40e65858d62915c6ea57c48207242729ea063053 fix 2-click drag, w/correct painting on selection (cherry picked from commit 0714dda8df441519009961148318011b6577c71b) diff --git a/plasma/applets/folderview/iconview.cpp b/plasma/applets/folderview/iconview.cpp index 83c28f7..937e6b2 100644 --- a/plasma/applets/folderview/iconview.cpp +++ b/plasma/applets/folderview/iconview.cpp @@ -1732,9 +1732,8 @@ void IconView::keyPressEvent(QKeyEvent *event) } nextIndex = currentIndex.sibling(newItem, currentIndex.column()); - } - - else { //If the user has moved the icons, i.e. the view is no longer sorted + } else { + //If the user has moved the icons, i.e. the view is no longer sorted QPoint currentPos = visualRect(currentIndex).center(); //Store distance between the first and the current index- @@ -1813,8 +1812,7 @@ void IconView::mousePressEvent(QGraphicsSceneMouseEvent *event) const QModelIndex index = indexAt(pos); // If an icon was pressed - if (index.isValid()) - { + if (index.isValid()) { //if ctrl is held if (event->modifiers() & Qt::ControlModifier) { m_selectionModel->select(index, QItemSelectionModel::Toggle); @@ -1833,16 +1831,11 @@ void IconView::mousePressEvent(QGraphicsSceneMouseEvent *event) m_selectionModel->select(index, QItemSelectionModel::ClearAndSelect); m_selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); markAreaDirty(visibleArea()); - } - else { + } else { markAreaDirty(visualRect(index)); } - if (!(event->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier)) && - KGlobalSettings::singleClick()) { - m_pressedIndex = index; - } - + m_pressedIndex = index; m_buttonDownPos = pos; return; } @@ -1882,8 +1875,7 @@ void IconView::mousePressEvent(QGraphicsSceneMouseEvent *event) void IconView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { - if (event->button() == Qt::LeftButton) - { + if (event->button() == Qt::LeftButton) { if (m_rubberBand.isValid()) { markAreaDirty(m_rubberBand); m_rubberBand = QRect(); @@ -1894,22 +1886,27 @@ void IconView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) const QModelIndex index = indexAt(pos); bool ctrlOrShiftPressed = (event->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier)); - if (index.isValid() && index == m_pressedIndex && !ctrlOrShiftPressed) { - if (!m_doubleClick && KGlobalSettings::singleClick()) { - emit activated(index); - m_selectionModel->clearSelection(); - markAreaDirty(visibleArea()); - } - // We don't clear and update the selection and current index in - // mousePressEvent() if the item is already selected when it's pressed, - // so we need to do that here. - if (m_selectionModel->currentIndex() != index || - m_selectionModel->selectedIndexes().count() > 1) { - m_selectionModel->select(index, QItemSelectionModel::ClearAndSelect); - m_selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); + if (index.isValid() && index == m_pressedIndex) { + if (ctrlOrShiftPressed) { markAreaDirty(visibleArea()); + } else { + if (!m_doubleClick) { + if (KGlobalSettings::singleClick()) { + emit activated(index); + m_selectionModel->clearSelection(); + } + markAreaDirty(visibleArea()); + } + // We don't clear and update the selection and current index in + // mousePressEvent() if the item is already selected when it's pressed, + // so we need to do that here. + if (m_selectionModel->currentIndex() != index || + m_selectionModel->selectedIndexes().count() > 1) { + m_selectionModel->select(index, QItemSelectionModel::ClearAndSelect); + m_selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); + markAreaDirty(visibleArea()); + } } - m_doubleClick = false; } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor