-/***************************************************************************
- * Copyright (C) 2006-2009 by Peter Penz <peter.penz19@gmail.com> *
- * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
- * *
- * 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 <peter.penz19@gmail.com>
+ * SPDX-FileCopyrightText: 2006 Gregor Kališnik <gregor@podnapisi.net>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "dolphinview.h"
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);
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);
duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> 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) {
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)) {
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);
+}