From: Frank Reininghaus Date: Sat, 24 Nov 2012 16:28:43 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/KDE/4.9' X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/06e5202c4727df7295fc7a515e41f65a9c2fcdde?hp=-c Merge remote-tracking branch 'origin/KDE/4.9' --- 06e5202c4727df7295fc7a515e41f65a9c2fcdde diff --combined src/views/dolphinview.cpp index e677613ba,70a739427..035d3dc55 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@@ -73,7 -73,7 +73,7 @@@ #include "zoomlevelinfo.h" #ifdef HAVE_NEPOMUK - #include + #include #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); @@@ -154,7 -155,6 +155,7 @@@ 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)), @@@ -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 selectedItems = selectionManager->selectedItems(); for (QList::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 1feaf0f11,f756de05e..6d15ebf32 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@@ -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 m_selectedUrls; // Used for making the view to remember selections after F5 + bool m_clearSelectionBeforeSelectingNewItems; VersionControlObserver* m_versionControlObserver;