Changeset View
Changeset View
Standalone View
Standalone View
src/views/dolphinviewactionhandler.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 98 | { | |||
---|---|---|---|---|---|
108 | // File menu | 108 | // File menu | ||
109 | 109 | | |||
110 | QAction* rename = m_actionCollection->addAction(QStringLiteral("rename")); | 110 | QAction* rename = m_actionCollection->addAction(QStringLiteral("rename")); | ||
111 | rename->setText(i18nc("@action:inmenu File", "Rename...")); | 111 | rename->setText(i18nc("@action:inmenu File", "Rename...")); | ||
112 | m_actionCollection->setDefaultShortcut(rename, Qt::Key_F2); | 112 | m_actionCollection->setDefaultShortcut(rename, Qt::Key_F2); | ||
113 | rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | 113 | rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | ||
114 | connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename); | 114 | connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename); | ||
115 | 115 | | |||
116 | QAction* moveToTrash = m_actionCollection->addAction(QStringLiteral("move_to_trash")); | 116 | KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection); | ||
117 | moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash")); | | |||
118 | moveToTrash->setIcon(QIcon::fromTheme(QStringLiteral("user-trash"))); | | |||
119 | m_actionCollection->setDefaultShortcut(moveToTrash, QKeySequence::Delete); | | |||
120 | connect(moveToTrash, &QAction::triggered, | | |||
121 | this, &DolphinViewActionHandler::slotTrashActivated); | | |||
122 | | ||||
123 | KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection); | 117 | KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection); | ||
124 | 118 | | |||
125 | // This action is useful for being enabled when "move_to_trash" should be | 119 | // This action is useful for being enabled when KStandardAction::MoveToTrash should be | ||
126 | // disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del | 120 | // disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del | ||
127 | // can be used for deleting the file (#76016). It needs to be a separate action | 121 | // can be used for deleting the file (#76016). It needs to be a separate action | ||
128 | // so that the Edit menu isn't affected. | 122 | // so that the Edit menu isn't affected. | ||
129 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | 123 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | ||
130 | // The descriptive text is just for the shortcuts editor. | 124 | // The descriptive text is just for the shortcuts editor. | ||
131 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | 125 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | ||
132 | m_actionCollection->setDefaultShortcut(deleteWithTrashShortcut, QKeySequence::Delete); | 126 | m_actionCollection->setDefaultShortcut(deleteWithTrashShortcut, QKeySequence::Delete); | ||
133 | deleteWithTrashShortcut->setEnabled(false); | 127 | deleteWithTrashShortcut->setEnabled(false); | ||
▲ Show 20 Lines • Show All 472 Lines • Show Last 20 Lines |