QAction* action = 0;
const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir();
if (isDir && (m_selectedItems.count() == 1)) {
- action = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
+ const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileInfo.url());
- const QMimeData* mimeData = QApplication::clipboard()->mimeData();
- const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
- action->setEnabled(!pasteData.isEmpty() && selectedItemsProperties().supportsWriting());
+ action = new QAction(QIcon::fromTheme("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
- connect(action, SIGNAL(triggered()), m_mainWindow, SLOT(pasteIntoFolder()));
+ action->setEnabled(pasteInfo.first);
+ connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
} else {
action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
}
// insert 'Cut', 'Copy' and 'Paste'
QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
cutAction->setEnabled(capabilities.supportsMoving());
- connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
+ connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
- connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
+ connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
- QAction* pasteAction = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste"), this);
- const QMimeData* mimeData = QApplication::clipboard()->mimeData();
- const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
+ const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileItem.url());
+ QAction* pasteAction = new QAction(KIcon("edit-paste"), pasteInfo.second, this);
- connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
+ connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
- pasteAction->setEnabled(!pasteData.isEmpty() && capabilities.supportsWriting());
+ pasteAction->setEnabled(pasteInfo.first);
popup->addAction(cutAction);
popup->addAction(copyAction);