From 451b27ccaa1959dba4f6d7147f4ebe77923bc9a7 Mon Sep 17 00:00:00 2001 From: kateleet Date: Tue, 28 Dec 2021 16:52:26 +0800 Subject: [PATCH] fix: cut logic --- model/foldermodel.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index d7187cc..499278f 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -983,7 +983,19 @@ void FolderModel::paste() } if (enable) { - KIO::paste(mimeData, m_dirModel->dirLister()->url()); + // Copy a new MimeData. + QMimeData *data = new QMimeData; + for (QString mimetype : mimeData->formats()) { + data->setData(mimetype, mimeData->data(mimetype)); + } + + KIO::Job *job = KIO::paste(data, m_dirModel->dirLister()->url()); + job->start(); + + // Clear system clipboard. + if (mimeData->hasFormat("application/x-kde-cutselection")) { + QApplication::clipboard()->clear(); + } } }