Changeset View
Changeset View
Standalone View
Standalone View
src/views/dolphinviewactionhandler.cpp
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Line(s) | 90 | { | |||
---|---|---|---|---|---|
121 | // so that the Edit menu isn't affected. | 121 | // so that the Edit menu isn't affected. | ||
122 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | 122 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | ||
123 | // The descriptive text is just for the shortcuts editor. | 123 | // The descriptive text is just for the shortcuts editor. | ||
124 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | 124 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | ||
125 | m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash()); | 125 | m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash()); | ||
126 | deleteWithTrashShortcut->setEnabled(false); | 126 | deleteWithTrashShortcut->setEnabled(false); | ||
127 | connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); | 127 | connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); | ||
128 | 128 | | |||
129 | QAction* duplicateAction = m_actionCollection->addAction(QStringLiteral("duplicate")); | ||||
130 | duplicateAction->setText(i18nc("@action:inmenu File", "Duplicate")); | ||||
131 | duplicateAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-duplicate"))); | ||||
132 | m_actionCollection->setDefaultShortcut(duplicateAction, Qt::CTRL | Qt::Key_D); | ||||
133 | duplicateAction->setEnabled(false); | ||||
134 | connect(duplicateAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDuplicate); | ||||
135 | | ||||
129 | QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") ); | 136 | QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") ); | ||
130 | // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) | 137 | // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) | ||
131 | propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); | 138 | propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); | ||
132 | propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties"))); | 139 | propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties"))); | ||
133 | m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter}); | 140 | m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter}); | ||
134 | connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); | 141 | connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); | ||
135 | 142 | | |||
136 | // View menu | 143 | // View menu | ||
▲ Show 20 Lines • Show All 438 Lines • ▼ Show 20 Line(s) | |||||
575 | void DolphinViewActionHandler::slotAdjustViewProperties() | 582 | void DolphinViewActionHandler::slotAdjustViewProperties() | ||
576 | { | 583 | { | ||
577 | emit actionBeingHandled(); | 584 | emit actionBeingHandled(); | ||
578 | QPointer<ViewPropertiesDialog> dialog = new ViewPropertiesDialog(m_currentView); | 585 | QPointer<ViewPropertiesDialog> dialog = new ViewPropertiesDialog(m_currentView); | ||
579 | dialog->exec(); | 586 | dialog->exec(); | ||
580 | delete dialog; | 587 | delete dialog; | ||
581 | } | 588 | } | ||
582 | 589 | | |||
590 | void DolphinViewActionHandler::slotDuplicate() | ||||
591 | { | ||||
592 | emit actionBeingHandled(); | ||||
593 | m_currentView->duplicateSelectedItems(); | ||||
594 | } | ||||
595 | | ||||
583 | void DolphinViewActionHandler::slotProperties() | 596 | void DolphinViewActionHandler::slotProperties() | ||
584 | { | 597 | { | ||
585 | KPropertiesDialog* dialog = nullptr; | 598 | KPropertiesDialog* dialog = nullptr; | ||
586 | const KFileItemList list = m_currentView->selectedItems(); | 599 | const KFileItemList list = m_currentView->selectedItems(); | ||
587 | if (list.isEmpty()) { | 600 | if (list.isEmpty()) { | ||
588 | const QUrl url = m_currentView->url(); | 601 | const QUrl url = m_currentView->url(); | ||
589 | dialog = new KPropertiesDialog(url, m_currentView); | 602 | dialog = new KPropertiesDialog(url, m_currentView); | ||
590 | } else { | 603 | } else { | ||
591 | dialog = new KPropertiesDialog(list, m_currentView); | 604 | dialog = new KPropertiesDialog(list, m_currentView); | ||
592 | } | 605 | } | ||
593 | 606 | | |||
594 | dialog->setAttribute(Qt::WA_DeleteOnClose); | 607 | dialog->setAttribute(Qt::WA_DeleteOnClose); | ||
595 | dialog->show(); | 608 | dialog->show(); | ||
596 | dialog->raise(); | 609 | dialog->raise(); | ||
597 | dialog->activateWindow(); | 610 | dialog->activateWindow(); | ||
598 | } | 611 | } |