]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/KDE/4.9' into KDE/4.10
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 27 Dec 2012 21:08:16 +0000 (22:08 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 27 Dec 2012 21:08:16 +0000 (22:08 +0100)
1  2 
src/views/dolphinview.cpp

index 941083fdeedd1c1a6f8e3867ff5317155174506a,cca5846b6f2a7494248abde2d2c749c94dc5d3f4..f0fad1976e81122444ed912a2c9c5ecc19faee4d
@@@ -73,7 -73,7 +73,7 @@@
  #include "zoomlevelinfo.h"
  
  #ifdef HAVE_NEPOMUK
 -    #include <Nepomuk/ResourceManager>
 +    #include <Nepomuk2/ResourceManager>
  #endif
  
  namespace {
@@@ -155,7 -155,6 +155,7 @@@ DolphinView::DolphinView(const KUrl& ur
  
      connect(m_model, SIGNAL(directoryLoadingStarted()),       this, SLOT(slotDirectoryLoadingStarted()));
      connect(m_model, SIGNAL(directoryLoadingCompleted()),     this, SLOT(slotDirectoryLoadingCompleted()));
 +    connect(m_model, SIGNAL(directoryLoadingCanceled()),      this, SIGNAL(directoryLoadingCanceled()));
      connect(m_model, SIGNAL(directoryLoadingProgress(int)),   this, SIGNAL(directoryLoadingProgress(int)));
      connect(m_model, SIGNAL(directorySortingProgress(int)),   this, SIGNAL(directorySortingProgress(int)));
      connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
@@@ -343,10 -342,12 +343,12 @@@ int DolphinView::itemsCount() cons
  KFileItemList DolphinView::selectedItems() const
  {
      const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
-     const QSet<int> selectedIndexes = selectionManager->selectedItems();
+     QList<int> selectedIndexes = selectionManager->selectedItems().toList();
+     qSort(selectedIndexes);
  
      KFileItemList selectedItems;
-     QSetIterator<int> it(selectedIndexes);
+     QListIterator<int> it(selectedIndexes);
      while (it.hasNext()) {
          const int index = it.next();
          selectedItems.append(m_model->fileItem(index));
@@@ -639,25 -640,25 +641,25 @@@ void DolphinView::clearSelection(
  void DolphinView::renameSelectedItems()
  {
      const KFileItemList items = selectedItems();
 -     if (items.isEmpty()) {
 -         return;
 -     }
 -
 -     if (items.count() == 1 && GeneralSettings::renameInline()) {
 -         const int index = m_model->index(items.first());
 -         m_view->editRole(index, "text");
 -     } else {
 -         RenameDialog* dialog = new RenameDialog(this, items);
 -         dialog->setAttribute(Qt::WA_DeleteOnClose);
 -         dialog->show();
 -         dialog->raise();
 -         dialog->activateWindow();
 -     }
 -
 -     // Assure that the current index remains visible when KFileItemModel
 -     // will notify the view about changed items (which might result in
 -     // a changed sorting).
 -     m_assureVisibleCurrentIndex = true;
 +    if (items.isEmpty()) {
 +        return;
 +    }
 +
 +    if (items.count() == 1 && GeneralSettings::renameInline()) {
 +        const int index = m_model->index(items.first());
 +        m_view->editRole(index, "text");
 +    } else {
 +        RenameDialog* dialog = new RenameDialog(this, items);
 +        dialog->setAttribute(Qt::WA_DeleteOnClose);
 +        dialog->show();
 +        dialog->raise();
 +        dialog->activateWindow();
 +    }
 +
 +    // Assure that the current index remains visible when KFileItemModel
 +    // will notify the view about changed items (which might result in
 +    // a changed sorting).
 +    m_assureVisibleCurrentIndex = true;
  }
  
  void DolphinView::trashSelectedItems()
@@@ -792,34 -793,21 +794,34 @@@ void DolphinView::slotItemsActivated(co
  {
      Q_ASSERT(indexes.count() >= 2);
  
 +    if (indexes.count() > 5) {
 +        QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count());
 +        const int answer = KMessageBox::warningYesNo(this, question);
 +        if (answer != KMessageBox::Yes) {
 +            return;
 +        }
 +    }
 +
      KFileItemList items;
 +    items.reserve(indexes.count());
  
      QSetIterator<int> it(indexes);
      while (it.hasNext()) {
          const int index = it.next();
 -        items.append(m_model->fileItem(index));
 -    }
 +        KFileItem item = m_model->fileItem(index);
  
 -    foreach (const KFileItem& item, items) {
 -        if (item.isDir()) {
 +        if (item.isDir()) { // Open folders in new tabs
              emit tabRequested(item.url());
          } else {
 -            emit itemActivated(item);
 +            items.append(item);
          }
      }
 +
 +    if (items.count() == 1) {
 +        emit itemActivated(items.first());
 +    } else if (items.count() > 1) {
 +        emit itemsActivated(items);
 +    }
  }
  
  void DolphinView::slotItemMiddleClicked(int index)
@@@ -853,10 -841,10 +855,10 @@@ void DolphinView::slotHeaderContextMenu
      bool nepomukRunning = false;
      bool indexingEnabled = false;
  #ifdef HAVE_NEPOMUK
 -    nepomukRunning = (Nepomuk::ResourceManager::instance()->initialized());
 +    nepomukRunning = (Nepomuk2::ResourceManager::instance()->initialized());
      if (nepomukRunning) {
          KConfig config("nepomukserverrc");
 -        indexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", false);
 +        indexingEnabled = config.group("Service-nepomukfileindexer").readEntry("autostart", true);
      }
  #endif