X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a291c5999035bb17fe764c1910c3e78ba041f8ac..d0c71a1435bc9d:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index aef0e85d6..167f88c39 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2006-2009 by Peter Penz * - * Copyright (C) 2006 by Gregor Kališnik * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006-2009 Peter Penz + * SPDX-FileCopyrightText: 2006 Gregor Kališnik + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "dolphinview.h" @@ -147,6 +134,9 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading); connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged); connect(controller, &KItemListController::selectedItemTextPressed, this, &DolphinView::slotSelectedItemTextPressed); + connect(controller, &KItemListController::increaseZoom, this, &DolphinView::slotIncreaseZoom); + connect(controller, &KItemListController::decreaseZoom, this, &DolphinView::slotDecreaseZoom); + connect(controller, &KItemListController::swipeUp, this, &DolphinView::slotSwipeUp); connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted); connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted); @@ -692,7 +682,7 @@ void DolphinView::copySelectedItemsToClipboard() QApplication::clipboard()->setMimeData(mimeData); } -void DolphinView::copySelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl) +void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl) { KIO::CopyJob* job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags); KJobWidgets::setWindow(job, this); @@ -702,7 +692,7 @@ void DolphinView::copySelectedItemsToInactiveSplitView(const KFileItemList &sele KIO::FileUndoManager::self()->recordCopyJob(job); } -void DolphinView::moveSelectedItemsToInactiveSplitView(const KFileItemList &selection, const QUrl &destinationUrl) +void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl) { KIO::CopyJob* job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags); KJobWidgets::setWindow(job, this); @@ -761,7 +751,7 @@ void DolphinView::duplicateSelectedItems() duplicateURL.setPath(originalDirectoryPath + i18nc(" copy", "%1 copy", originalFilenameWithoutExtension) + originalExtension); } - KIO::CopyJob* job = KIO::copyAs(originalURL, duplicateURL, KIO::HideProgressInfo); + KIO::CopyJob* job = KIO::copyAs(originalURL, duplicateURL); KJobWidgets::setWindow(job, this); if (job) { @@ -1511,6 +1501,8 @@ void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior) if (GeneralSettings::showToolTips()) { m_toolTipManager->hideToolTip(behavior); } +#else + Q_UNUSED(behavior) #endif } @@ -1522,8 +1514,12 @@ void DolphinView::calculateItemCount(int& fileCount, bool countFileSize = true; + if (!m_model->rootItem().url().isValid()) { + return; + } + // In case we have a precomputed value - const auto job = KIO::statDetails(m_model->rootItem().url(), KIO::StatJob::SourceSide, KIO::StatRecursiveSize); + const auto job = KIO::statDetails(m_model->rootItem().url(), KIO::StatJob::SourceSide, KIO::StatRecursiveSize, KIO::HideProgressInfo); job->exec(); const auto entry = job->statResult(); if (entry.contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) { @@ -1945,3 +1941,36 @@ void DolphinView::forceUrlsSelection(const QUrl& current, const QList& sel markUrlAsCurrent(current); markUrlsAsSelected(selected); } + +void DolphinView::copyPathToClipboard() +{ + const KFileItemList list = selectedItems(); + if (list.isEmpty()) { + return; + } + const KFileItem& item = list.at(0); + QString path = item.localPath(); + if (path.isEmpty()) { + path = item.url().toDisplayString(); + } + QClipboard* clipboard = QApplication::clipboard(); + if (clipboard == nullptr) { + return; + } + clipboard->setText(path); +} + +void DolphinView::slotIncreaseZoom() +{ + setZoomLevel(zoomLevel() + 1); +} + +void DolphinView::slotDecreaseZoom() +{ + setZoomLevel(zoomLevel() - 1); +} + +void DolphinView::slotSwipeUp() +{ + emit goUpRequested(); +}