TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
KFileItemListProperties capabilities(KFileItemList() << m_fileItem);
// insert 'Cut', 'Copy' and 'Paste'
KFileItemListProperties capabilities(KFileItemList() << m_fileItem);
// insert 'Cut', 'Copy' and 'Paste'
- QAction* cutAction = new QAction(QIcon::fromTheme("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
+ QAction* cutAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-cut")), i18nc("@action:inmenu", "Cut"), this);
cutAction->setEnabled(capabilities.supportsMoving());
connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
cutAction->setEnabled(capabilities.supportsMoving());
connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
- QAction* copyAction = new QAction(QIcon::fromTheme("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
+ QAction* copyAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18nc("@action:inmenu", "Copy"), this);
connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
bool canPaste;
const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileItem);
connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
bool canPaste;
const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileItem);
connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
pasteAction->setEnabled(canPaste);
connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
pasteAction->setEnabled(canPaste);
// insert 'Rename'
QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
renameAction->setEnabled(capabilities.supportsMoving());
// insert 'Rename'
QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
renameAction->setEnabled(capabilities.supportsMoving());
connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename);
popup->addAction(renameAction);
// insert 'Move to Trash' and (optionally) 'Delete'
connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename);
popup->addAction(renameAction);
// insert 'Move to Trash' and (optionally) 'Delete'
KConfigGroup configGroup(globalConfig, "KDE");
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
const QUrl url = m_fileItem.url();
if (url.isLocalFile()) {
KConfigGroup configGroup(globalConfig, "KDE");
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
const QUrl url = m_fileItem.url();
if (url.isLocalFile()) {
i18nc("@action:inmenu", "Move to Trash"), this);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
moveToTrashAction->setEnabled(enableMoveToTrash);
i18nc("@action:inmenu", "Move to Trash"), this);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
moveToTrashAction->setEnabled(enableMoveToTrash);
- QAction* deleteAction = new QAction(QIcon::fromTheme("edit-delete"), i18nc("@action:inmenu", "Delete"), this);
+ QAction* deleteAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@action:inmenu", "Delete"), this);
deleteAction->setEnabled(capabilities.supportsDeleting());
connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem);
popup->addAction(deleteAction);
deleteAction->setEnabled(capabilities.supportsDeleting());
connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem);
popup->addAction(deleteAction);
if (!m_fileItem.isNull()) {
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
if (!m_fileItem.isNull()) {
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties);
popup->addAction(propertiesAction);
}
connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties);
popup->addAction(propertiesAction);
}
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(list);
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(list);
- KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl("trash:/"), job);
+ KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job);
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::del(list);
KJobWidgets::setWindow(job, m_parent);
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::del(list);
KJobWidgets::setWindow(job, m_parent);