mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-21 09:20:13 +00:00
Port from KonqOperations::doPaste to new job KIO::paste
Remove KonqOperations::doPaste.
This commit is contained in:
parent
e256daa569
commit
8b306b67bf
|
@ -31,8 +31,8 @@
|
|||
#include <KConfigGroup>
|
||||
#include <kurlmimedata.h>
|
||||
#include <KFileItemListProperties>
|
||||
#include <konq_operations.h>
|
||||
#include <KLocalizedString>
|
||||
#include <KIO/PasteJob>
|
||||
#include <KIO/Paste>
|
||||
#include <KIO/FileUndoManager>
|
||||
#include <KPropertiesDialog>
|
||||
|
@ -182,7 +182,8 @@ void TreeViewContextMenu::copy()
|
|||
|
||||
void TreeViewContextMenu::paste()
|
||||
{
|
||||
KonqOperations::doPaste(m_parent, m_fileItem.url());
|
||||
KIO::PasteJob *job = KIO::paste(QApplication::clipboard()->mimeData(), m_fileItem.url());
|
||||
KJobWidgets::setWindow(job, m_parent);
|
||||
}
|
||||
|
||||
void TreeViewContextMenu::rename()
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <KIO/JobUiDelegate>
|
||||
#include <KIO/NetAccess>
|
||||
#include <KIO/PreviewJob>
|
||||
#include <KIO/PasteJob>
|
||||
#include <KIO/Paste>
|
||||
#include <KJob>
|
||||
#include <QMenu>
|
||||
|
@ -1040,16 +1041,19 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
|
|||
event->modifiers());
|
||||
|
||||
QString error;
|
||||
KonqOperations* op = DragAndDropHelper::dropUrls(destItem, destUrl, &dropEvent, error);
|
||||
KonqOperations* job = DragAndDropHelper::dropUrls(destItem, destUrl, &dropEvent, error);
|
||||
if (!error.isEmpty()) {
|
||||
emit infoMessage(error);
|
||||
}
|
||||
|
||||
if (op && destUrl == url()) {
|
||||
if (job && destUrl == url()) {
|
||||
// Mark the dropped urls as selected.
|
||||
m_clearSelectionBeforeSelectingNewItems = true;
|
||||
m_markFirstNewlySelectedItemAsCurrent = true;
|
||||
connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
|
||||
connect(job, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
|
||||
// TODO
|
||||
//connect(job, &KIO::InteractiveDropJob::itemCreated, this, &DolphinView::slotItemCreated);
|
||||
//connect(job, &KIO::InteractiveDropJob::result, this, &DolphinView::slotPasteJobResult);
|
||||
}
|
||||
|
||||
setActive(true);
|
||||
|
@ -1096,6 +1100,22 @@ void DolphinView::slotAboutToCreate(const QList<QUrl>& urls)
|
|||
}
|
||||
}
|
||||
|
||||
void DolphinView::slotItemCreated(const QUrl& url)
|
||||
{
|
||||
if (m_markFirstNewlySelectedItemAsCurrent) {
|
||||
markUrlAsCurrent(url);
|
||||
m_markFirstNewlySelectedItemAsCurrent = false;
|
||||
}
|
||||
m_selectedUrls << url;
|
||||
}
|
||||
|
||||
void DolphinView::slotPasteJobResult(KJob *)
|
||||
{
|
||||
if (!m_selectedUrls.isEmpty()) {
|
||||
m_selectedUrls << KDirModel::simplifiedUrlList(m_selectedUrls);
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous)
|
||||
{
|
||||
const int currentCount = current.count();
|
||||
|
@ -1649,12 +1669,12 @@ void DolphinView::applyModeToView()
|
|||
|
||||
void DolphinView::pasteToUrl(const QUrl& url)
|
||||
{
|
||||
KonqOperations* op = KonqOperations::doPaste(this, url);
|
||||
if (op) {
|
||||
m_clearSelectionBeforeSelectingNewItems = true;
|
||||
m_markFirstNewlySelectedItemAsCurrent = true;
|
||||
connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
|
||||
}
|
||||
KIO::PasteJob *job = KIO::paste(QApplication::clipboard()->mimeData(), url);
|
||||
KJobWidgets::setWindow(job, this);
|
||||
m_clearSelectionBeforeSelectingNewItems = true;
|
||||
m_markFirstNewlySelectedItemAsCurrent = true;
|
||||
connect(job, &KIO::PasteJob::itemCreated, this, &DolphinView::slotItemCreated);
|
||||
connect(job, &KIO::PasteJob::result, this, &DolphinView::slotPasteJobResult);
|
||||
}
|
||||
|
||||
QList<QUrl> DolphinView::simplifiedSelectedUrls() const
|
||||
|
|
|
@ -572,6 +572,11 @@ private slots:
|
|||
/*
|
||||
* Is called when new items get pasted or dropped.
|
||||
*/
|
||||
void slotItemCreated(const QUrl &url);
|
||||
/*
|
||||
* Is called after all pasted or dropped items have been copied to destination.
|
||||
*/
|
||||
void slotPasteJobResult(KJob *job);
|
||||
void slotAboutToCreate(const QList<QUrl> &urls);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue