]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/KDE/4.11' into KDE/4.12
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 14 Nov 2013 08:14:51 +0000 (09:14 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 14 Nov 2013 08:14:51 +0000 (09:14 +0100)
1  2 
src/kitemviews/kitemlistcontroller.cpp

index 51a1f91b91c1a257c1658fe6d3ae6bdb32088d13,158c12de1d38deb475efc9c295e730f6f18bf611..7344b9960f07ec72eb7f47d6a76caa66b063d75c
@@@ -364,11 -364,11 +364,11 @@@ bool KItemListController::keyPressEvent
  
      case Qt::Key_Enter:
      case Qt::Key_Return: {
 -        const QSet<int> selectedItems = m_selectionManager->selectedItems();
 +        const KItemSet selectedItems = m_selectionManager->selectedItems();
          if (selectedItems.count() >= 2) {
              emit itemsActivated(selectedItems);
          } else if (selectedItems.count() == 1) {
 -            emit itemActivated(selectedItems.toList().first());
 +            emit itemActivated(selectedItems.first());
          } else {
              emit itemActivated(index);
          }
      case Qt::Key_Menu: {
          // Emit the signal itemContextMenuRequested() in case if at least one
          // item is selected. Otherwise the signal viewContextMenuRequested() will be emitted.
 -        const QSet<int> selectedItems = m_selectionManager->selectedItems();
 +        const KItemSet selectedItems = m_selectionManager->selectedItems();
          int index = -1;
          if (selectedItems.count() >= 2) {
              const int currentItemIndex = m_selectionManager->currentItem();
              index = selectedItems.contains(currentItemIndex)
 -                    ? currentItemIndex : selectedItems.toList().first();
 +                    ? currentItemIndex : selectedItems.first();
          } else if (selectedItems.count() == 1) {
 -            index = selectedItems.toList().first();
 +            index = selectedItems.first();
          }
  
          if (index >= 0) {
              m_selectionManager->clearSelection();
          }
          m_keyboardManager->cancelSearch();
 +        emit escapePressed();
          break;
  
      case Qt::Key_Space:
@@@ -538,6 -537,14 +538,14 @@@ bool KItemListController::mousePressEve
      m_pressedIndex = m_view->itemAt(m_pressedMousePos);
      emit mouseButtonPressed(m_pressedIndex, event->buttons());
  
+     if ((event->buttons() & (Qt::XButton1 | Qt::XButton2)) && m_pressedIndex < 0) {
+         // Do not select items when clicking the empty part of the view with
+         // the back/forward buttons, see https://bugs.kde.org/show_bug.cgi?id=327412.
+         // Note that clicking an item with these buttons selects it, see comment in
+         // DolphinView::slotMouseButtonPressed(int, Qt::MouseButtons).
+         return true;
+     }
      if (m_view->isAboveExpansionToggle(m_pressedIndex, m_pressedMousePos)) {
          m_selectionManager->endAnchoredSelection();
          m_selectionManager->setCurrentItem(m_pressedIndex);
@@@ -1079,7 -1086,7 +1087,7 @@@ void KItemListController::slotRubberBan
          }
      }
  
 -    QSet<int> selectedItems;
 +    KItemSet selectedItems;
  
      // Select all visible items that intersect with the rubberband
      foreach (const KItemListWidget* widget, m_view->visibleItemListWidgets()) {
          // Therefore, the new selection contains:
          // 1. All previously selected items which are not inside the rubberband, and
          // 2. all items inside the rubberband which have not been selected previously.
 -        m_selectionManager->setSelectedItems((m_oldSelection - selectedItems) + (selectedItems - m_oldSelection));
 +        m_selectionManager->setSelectedItems(m_oldSelection ^ selectedItems);
      }
      else {
          m_selectionManager->setSelectedItems(selectedItems + m_oldSelection);
@@@ -1140,7 -1147,7 +1148,7 @@@ void KItemListController::startDragging
          return;
      }
  
 -    const QSet<int> selectedItems = m_selectionManager->selectedItems();
 +    const KItemSet selectedItems = m_selectionManager->selectedItems();
      if (selectedItems.isEmpty()) {
          return;
      }