]> 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, 5 Dec 2013 23:56:34 +0000 (00:56 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 5 Dec 2013 23:56:34 +0000 (00:56 +0100)
1  2 
src/views/dolphinview.cpp

index d0a85b3e26ef125112bcca4a3f903fa07d684769,db9d8d22fb9aa398bccd19f5ecf19288a22041d0..1416bb6df4de107e3b3fd03971285f5b3637de4b
@@@ -145,7 -145,7 +145,7 @@@ DolphinView::DolphinView(const KUrl& ur
  
      controller->setSelectionBehavior(KItemListController::MultiSelection);
      connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
 -    connect(controller, SIGNAL(itemsActivated(QSet<int>)), this, SLOT(slotItemsActivated(QSet<int>)));
 +    connect(controller, SIGNAL(itemsActivated(KItemSet)), this, SLOT(slotItemsActivated(KItemSet)));
      connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
      connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
      connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
      connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int)));
      connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int)));
      connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
 +    connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading()));
      connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
  
      connect(m_model, SIGNAL(directoryLoadingStarted()),       this, SLOT(slotDirectoryLoadingStarted()));
              this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
  
      KItemListSelectionManager* selectionManager = controller->selectionManager();
 -    connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)),
 -            this, SLOT(slotSelectionChanged(QSet<int>,QSet<int>)));
 +    connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)),
 +            this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
  
      m_toolTipManager = new ToolTipManager(this);
  
@@@ -350,9 -349,14 +350,9 @@@ int DolphinView::itemsCount() cons
  KFileItemList DolphinView::selectedItems() const
  {
      const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
 -    QList<int> selectedIndexes = selectionManager->selectedItems().toList();
 -
 -    qSort(selectedIndexes);
  
      KFileItemList selectedItems;
 -    QListIterator<int> it(selectedIndexes);
 -    while (it.hasNext()) {
 -        const int index = it.next();
 +    foreach (int index, selectionManager->selectedItems()) {
          selectedItems.append(m_model->fileItem(index));
      }
      return selectedItems;
@@@ -385,9 -389,9 +385,9 @@@ void DolphinView::selectItems(const QRe
      for (int index = 0; index < m_model->count(); index++) {
          const KFileItem item = m_model->fileItem(index);
          if (pattern.exactMatch(item.text())) {
 -            // An alternative approach would be to store the matching items in a QSet<int> and
 +            // An alternative approach would be to store the matching items in a KItemSet and
              // select them in one go after the loop, but we'd need a new function
 -            // KItemListSelectionManager::setSelected(QSet<int>, SelectionMode mode)
 +            // KItemListSelectionManager::setSelected(KItemSet, SelectionMode mode)
              // for that.
              selectionManager->setSelected(index, 1, mode);
          }
@@@ -481,6 -485,11 +481,6 @@@ void DolphinView::reload(
      restoreState(restoreStream);
  }
  
 -void DolphinView::stopLoading()
 -{
 -    m_model->cancelDirectoryLoading();
 -}
 -
  void DolphinView::readSettings()
  {
      const int oldZoomLevel = m_view->zoomLevel();
@@@ -547,8 -556,8 +547,8 @@@ QString DolphinView::statusBarText() co
          }
  
          if (folderCount + fileCount == 1) {
 -            // If only one item is selected, show the filename
 -            filesText = i18nc("@info:status", "<filename>%1</filename> selected", list.first().text());
 +            // If only one item is selected, show info about it
 +            return list.first().getStatusBarInfo();
          } else {
              // At least 2 items are selected
              foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
@@@ -715,11 -724,6 +715,11 @@@ void DolphinView::pasteIntoFolder(
      }
  }
  
 +void DolphinView::stopLoading()
 +{
 +    m_model->cancelDirectoryLoading();
 +}
 +
  bool DolphinView::eventFilter(QObject* watched, QEvent* event)
  {
      switch (event->type()) {
@@@ -798,7 -802,7 +798,7 @@@ void DolphinView::slotItemActivated(in
      }
  }
  
 -void DolphinView::slotItemsActivated(const QSet<int>& indexes)
 +void DolphinView::slotItemsActivated(const KItemSet& indexes)
  {
      Q_ASSERT(indexes.count() >= 2);
  
      KFileItemList items;
      items.reserve(indexes.count());
  
 -    QSetIterator<int> it(indexes);
 -    while (it.hasNext()) {
 -        const int index = it.next();
 +    foreach (int index, indexes) {
          KFileItem item = m_model->fileItem(index);
          const KUrl& url = openItemAsFolderUrl(item);
  
@@@ -1097,7 -1103,7 +1097,7 @@@ void DolphinView::slotAboutToCreate(con
      }
  }
  
 -void DolphinView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous)
 +void DolphinView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous)
  {
      const int currentCount = current.count();
      const int previousCount = previous.count();
@@@ -1316,7 -1322,7 +1316,7 @@@ void DolphinView::updateViewState(
              m_clearSelectionBeforeSelectingNewItems = false;
          }
  
 -        QSet<int> selectedItems = selectionManager->selectedItems();
 +        KItemSet selectedItems = selectionManager->selectedItems();
  
          QList<KUrl>::iterator it = m_selectedUrls.begin();
          while (it != m_selectedUrls.end()) {
@@@ -1486,7 -1492,9 +1486,9 @@@ void DolphinView::slotRoleEditingFinish
              }
  
              KonqOperations* op = KonqOperations::renameV2(this, oldUrl, newName);
-             if (op) {
+             if (op && !newNameExistsAlready) {
+                 // Only connect the renamingFailed signal if there is no item with the new name
+                 // in the model yet, see bug 328262.
                  connect(op, SIGNAL(renamingFailed(KUrl,KUrl)), SLOT(slotRenamingFailed(KUrl,KUrl)));
              }
          }
@@@ -1652,7 -1660,7 +1654,7 @@@ KUrl::List DolphinView::simplifiedSelec
  QMimeData* DolphinView::selectionMimeData() const
  {
      const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
 -    const QSet<int> selectedIndexes = selectionManager->selectedItems();
 +    const KItemSet selectedIndexes = selectionManager->selectedItems();
  
      return m_model->createMimeData(selectedIndexes);
  }
  void DolphinView::updateWritableState()
  {
      const bool wasFolderWritable = m_isFolderWritable;
 -    m_isFolderWritable = true;
 +    m_isFolderWritable = false;
  
      const KFileItem item = m_model->rootItem();
      if (!item.isNull()) {