Index: src/widgets/dropjob.cpp =================================================================== --- src/widgets/dropjob.cpp +++ src/widgets/dropjob.cpp @@ -102,6 +102,25 @@ if (m_destItem.isNull() && m_destUrl.isLocalFile()) { m_destItem = KFileItem(m_destUrl); } + + if (m_flags & KIO::PrivilegeExecution) { + m_flags |= KIO::PrivilegeExecution; + m_privilegeExecutionEnabled = true; + switch (m_dropAction) { + case Qt::CopyAction: + m_operationType = Copy; + break; + case Qt::MoveAction: + m_operationType = Move; + break; + case Qt::LinkAction: + m_operationType = Symlink; + break; + default: + m_operationType = Other; + break; + } + } } bool destIsDirectory() const @@ -129,7 +148,7 @@ Qt::KeyboardModifiers m_keyboardModifiers; QUrl m_destUrl; KFileItem m_destItem; // null for remote URLs not found in the dirlister cache - const JobFlags m_flags; + JobFlags m_flags; QList m_appActions; QList m_pluginActions; bool m_triggered; // Tracks whether an action has been triggered in the popup menu. @@ -243,8 +262,9 @@ if (!KProtocolManager::supportsWriting(m_destUrl)) { return KIO::ERR_CANNOT_WRITE; } - if (!m_destItem.isNull() && !m_destItem.isWritable()) { - return KIO::ERR_WRITE_ACCESS_DENIED; + + if (!m_destItem.isNull() && !m_destItem.isWritable() && !(m_flags & KIO::PrivilegeExecution)) { + return KIO::ERR_WRITE_ACCESS_DENIED; } bool allItemsAreFromTrash = true; @@ -478,6 +498,7 @@ return; } Q_ASSERT(job); + job->setParentJob(q); job->setMetaData(m_metaData); QObject::connect(job, &KIO::CopyJob::copyingDone, q, [q](KIO::Job*, const QUrl &, const QUrl &to) { emit q->itemCreated(to);