diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 64 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 12 | ||||
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 6 |
3 files changed, 54 insertions, 28 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index cca5846b6..f0fad1976 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -73,7 +73,7 @@ #include "zoomlevelinfo.h" #ifdef HAVE_NEPOMUK - #include <Nepomuk/ResourceManager> + #include <Nepomuk2/ResourceManager> #endif namespace { @@ -155,6 +155,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : 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>)), @@ -640,25 +641,25 @@ void DolphinView::clearSelection() void DolphinView::renameSelectedItems() { const KFileItemList items = selectedItems(); - if (items.isEmpty()) { - return; - } + 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(); - } + 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; + // 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() @@ -793,21 +794,34 @@ void DolphinView::slotItemsActivated(const QSet<int>& indexes) { 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) @@ -841,10 +855,10 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos) 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 diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index f756de05e..a2fe9f62a 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -386,6 +386,12 @@ signals: void itemActivated(const KFileItem& item); /** + * Is emitted when multiple items have been activated by e. g. + * context menu open with. + */ + void itemsActivated(const KFileItemList& items); + + /** * Is emitted if items have been added or deleted. */ void itemCountChanged(); @@ -484,6 +490,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. */ diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 0249964ac..c7832d725 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -40,7 +40,7 @@ #include <KIcon> #ifdef HAVE_NEPOMUK - #include <Nepomuk/ResourceManager> + #include <Nepomuk2/ResourceManager> #endif #include <KDebug> @@ -237,10 +237,10 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt 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 |
