]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinviewactionhandler.cpp
Merge branch 'release/20.04'
[dolphin.git] / src / views / dolphinviewactionhandler.cpp
index a520d7e5303c5e1ba3f5e9e49dc388d084058dad..e89e2e62c2b705e32223dca048334d6c22f7f224 100644 (file)
@@ -136,6 +136,13 @@ void DolphinViewActionHandler::createActions()
     deleteWithTrashShortcut->setEnabled(false);
     connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
 
+    QAction* duplicateAction = m_actionCollection->addAction(QStringLiteral("duplicate"));
+    duplicateAction->setText(i18nc("@action:inmenu File", "Duplicate Here"));
+    duplicateAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-duplicate")));
+    m_actionCollection->setDefaultShortcut(duplicateAction, Qt::CTRL | Qt::Key_D);
+    duplicateAction->setEnabled(false);
+    connect(duplicateAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDuplicate);
+
     QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") );
     // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
     propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
@@ -202,7 +209,7 @@ void DolphinViewActionHandler::createActions()
     zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size."));
 
     KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview"));
-    showPreview->setText(i18nc("@action:intoolbar", "Preview"));
+    showPreview->setText(i18nc("@action:intoolbar", "Show Previews"));
     showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
     showPreview->setWhatsThis(xi18nc("@info:whatsthis", "When this is "
         "enabled, the icons are based on the actual file or folder "
@@ -253,7 +260,8 @@ void DolphinViewActionHandler::createActions()
     QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
 
     KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
-    visibleRolesMenu->setText(i18nc("@action:inmenu View", "Additional Information"));
+    visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information"));
+    visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
     visibleRolesMenu->setDelayed(false);
 
     foreach (QAction* action, visibleRolesGroup->actions()) {
@@ -267,7 +275,7 @@ void DolphinViewActionHandler::createActions()
     connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
 
     KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
-    showHiddenFiles->setText(i18nc("@action:inmenu View", "Hidden Files"));
+    showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
     showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders"));
     showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "<para>When "
         "this is enabled <emphasis>hidden</emphasis> files and folders "
@@ -275,11 +283,12 @@ void DolphinViewActionHandler::createActions()
         "<para>Hidden items only differ from other ones in that their "
         "name starts with a \".\". In general there is no need for "
         "users to access them which is why they are hidden.</para>"));
-    m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::CTRL + Qt::Key_H, Qt::Key_F8});
+    m_actionCollection->setDefaultShortcuts(showHiddenFiles, KStandardShortcut::showHideHiddenFiles());
     connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
 
     QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
-    adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
+    adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Display Style..."));
+    adjustViewProps->setIcon(QIcon::fromTheme(QStringLiteral("view-choose")));
     adjustViewProps->setWhatsThis(i18nc("@info:whatsthis", "This opens a window "
         "in which all folder view properties can be adjusted."));
     connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
@@ -397,7 +406,7 @@ void DolphinViewActionHandler::togglePreview(bool show)
 
 void DolphinViewActionHandler::slotPreviewsShownChanged(bool shown)
 {
-    Q_UNUSED(shown);
+    Q_UNUSED(shown)
     // It is not enough to update the 'Show Preview' action, also
     // the 'Zoom In', 'Zoom Out' and 'Zoom Reset' actions must be adapted.
     updateViewActions();
@@ -513,7 +522,7 @@ void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
 void DolphinViewActionHandler::slotVisibleRolesChanged(const QList<QByteArray>& current,
                                                        const QList<QByteArray>& previous)
 {
-    Q_UNUSED(previous);
+    Q_UNUSED(previous)
 
     const QSet<QByteArray> checkedRoles = current.toSet();
     QHashIterator<QByteArray, KToggleAction*> it(m_visibleRoles);
@@ -632,7 +641,7 @@ void DolphinViewActionHandler::slotSortRoleChanged(const QByteArray& role)
 
 void DolphinViewActionHandler::slotZoomLevelChanged(int current, int previous)
 {
-    Q_UNUSED(previous);
+    Q_UNUSED(previous)
 
     QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
     if (zoomInAction) {
@@ -653,7 +662,6 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action)
     // actions and the sub-menu-actions. If an action gets checked, it must
     // be assured that all other actions get unchecked, except the ascending/
     // descending actions
-    QAction* sortByMenu =  m_actionCollection->action(QStringLiteral("sort"));
     for (QAction *groupAction : qAsConst(m_sortByActions)) {
         KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction);
         if (actionMenu) {
@@ -679,6 +687,12 @@ void DolphinViewActionHandler::slotAdjustViewProperties()
     delete dialog;
 }
 
+void DolphinViewActionHandler::slotDuplicate()
+{
+    emit actionBeingHandled();
+    m_currentView->duplicateSelectedItems();
+}
+
 void DolphinViewActionHandler::slotProperties()
 {
     KPropertiesDialog* dialog = nullptr;