X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/9b82b08fb18724662c69ed288b1a36a215548539..d1a70c0b629bebda297c3867946035aadd9dd22f:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index d8f2aab93..c98929ead 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -364,7 +364,7 @@ void DolphinView::markUrlAsCurrent(const QUrl &url) m_scrollToCurrentItem = true; } -void DolphinView::selectItems(const QRegExp& pattern, bool enabled) +void DolphinView::selectItems(const QRegularExpression ®exp, bool enabled) { const KItemListSelectionManager::SelectionMode mode = enabled ? KItemListSelectionManager::Select @@ -373,7 +373,7 @@ void DolphinView::selectItems(const QRegExp& pattern, bool enabled) for (int index = 0; index < m_model->count(); index++) { const KFileItem item = m_model->fileItem(index); - if (pattern.exactMatch(item.text())) { + if (regexp.match(item.text()).hasMatch()) { // 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(KItemSet, SelectionMode mode) @@ -686,7 +686,7 @@ void DolphinView::cutSelectedItems() QApplication::clipboard()->setMimeData(mimeData); } -void DolphinView::copySelectedItems() +void DolphinView::copySelectedItemsToClipboard() { QMimeData* mimeData = selectionMimeData(); QApplication::clipboard()->setMimeData(mimeData); @@ -1200,7 +1200,7 @@ void DolphinView::slotPasteJobResult(KJob *job) emit errorMessage(job->errorString()); } if (!m_selectedUrls.isEmpty()) { - m_selectedUrls << KDirModel::simplifiedUrlList(m_selectedUrls); + m_selectedUrls = KDirModel::simplifiedUrlList(m_selectedUrls); } } @@ -1493,13 +1493,27 @@ void DolphinView::calculateItemCount(int& fileCount, KIO::filesize_t& totalFileSize) const { const int itemCount = m_model->count(); + + bool countFileSize = true; + + // In case we have a precomputed value + const auto job = KIO::statDetails(m_model->rootItem().url(), KIO::StatJob::SourceSide, KIO::StatRecursiveSize); + job->exec(); + const auto entry = job->statResult(); + if (entry.contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) { + totalFileSize = static_cast(entry.numberValue(KIO::UDSEntry::UDS_RECURSIVE_SIZE)); + countFileSize = false; + } + for (int i = 0; i < itemCount; ++i) { const KFileItem item = m_model->fileItem(i); if (item.isDir()) { ++folderCount; } else { ++fileCount; - totalFileSize += item.size(); + if (countFileSize) { + totalFileSize += item.size(); + } } } }