]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/KDE/4.9'
authorFrank Reininghaus <frank78ac@googlemail.com>
Sat, 24 Nov 2012 16:28:43 +0000 (17:28 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 24 Nov 2012 16:28:43 +0000 (17:28 +0100)
1  2 
src/views/dolphinview.cpp
src/views/dolphinview.h

index e677613bac2ca45714e2d763f250aa027e8e1cd8,70a7394274a65c3a8be9808e6993b8c4cfbffac8..035d3dc5589e88d2228873a0986a40f465333672
@@@ -73,7 -73,7 +73,7 @@@
  #include "zoomlevelinfo.h"
  
  #ifdef HAVE_NEPOMUK
 -    #include <Nepomuk/ResourceManager>
 +    #include <Nepomuk2/ResourceManager>
  #endif
  
  namespace {
@@@ -101,6 -101,7 +101,7 @@@ DolphinView::DolphinView(const KUrl& ur
      m_scrollToCurrentItem(false),
      m_restoredContentsPosition(),
      m_selectedUrls(),
+     m_clearSelectionBeforeSelectingNewItems(false),
      m_versionControlObserver(0)
  {
      m_topLayout = new QVBoxLayout(this);
  
      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>)),
@@@ -638,25 -638,25 +639,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()
@@@ -799,14 -799,6 +800,14 @@@ void DolphinView::slotItemsActivated(co
          items.append(m_model->fileItem(index));
      }
  
 +    if (items.count() > 5) {
 +        QString question = QString("Are you sure you want to open %1 items?").arg(items.count());
 +        const int answer = KMessageBox::warningYesNo(this, question);
 +        if (answer != KMessageBox::Yes) {
 +            return;
 +        }
 +    }
 +
      foreach (const KFileItem& item, items) {
          if (item.isDir()) {
              emit tabRequested(item.url());
@@@ -847,7 -839,7 +848,7 @@@ 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);
@@@ -1227,6 -1219,12 +1228,12 @@@ void DolphinView::updateViewState(
  
      if (!m_selectedUrls.isEmpty()) {
          KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+         if (m_clearSelectionBeforeSelectingNewItems) {
+             selectionManager->clearSelection();
+             m_clearSelectionBeforeSelectingNewItems = false;
+         }
          QSet<int> selectedItems = selectionManager->selectedItems();
  
          for (QList<KUrl>::iterator it = m_selectedUrls.begin(); it != m_selectedUrls.end(); ++it) {
@@@ -1544,6 -1542,7 +1551,7 @@@ void DolphinView::markPastedUrlsAsSelec
          destUrls << destination;
      }
      markUrlsAsSelected(destUrls);
+     m_clearSelectionBeforeSelectingNewItems = true;
  }
  
  void DolphinView::updateWritableState()
diff --combined src/views/dolphinview.h
index 1feaf0f11eff59d2562e7159cb18e6db5b578870,f756de05edae39311f7c9e728046732205d5a3bd..6d15ebf3239f7e84e2b90b992fdb67d0f01dba05
@@@ -483,12 -483,6 +483,12 @@@ signals
       */
      void directoryLoadingCompleted();
  
 +    /**
 +     * Is emitted after the directory loading triggered by DolphinView::setUrl()
 +     * has been canceled.
 +     */
 +    void directoryLoadingCanceled();
 +
      /**
       * Is emitted after DolphinView::setUrl() has been invoked and provides
       * the information how much percent of the current directory have been loaded.
@@@ -765,6 -759,7 +765,7 @@@ private
      QPoint m_restoredContentsPosition;
  
      QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
+     bool m_clearSelectionBeforeSelectingNewItems;
  
      VersionControlObserver* m_versionControlObserver;