m_actionCollection);
zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size."));
+ QAction* zoomResetAction = m_actionCollection->addAction(QStringLiteral("view_zoom_reset"));
+ zoomResetAction->setText(i18nc("@action:inmenu View", "Reset Zoom Level"));
+ zoomResetAction->setToolTip(i18n("Zoom To Default"));
+ zoomResetAction->setWhatsThis(i18nc("@info:whatsthis zoom reset", "This resets the icon size to default."));
+ zoomResetAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-original")));
+ m_actionCollection->setDefaultShortcuts(zoomResetAction, {Qt::CTRL + Qt::Key_0});
+ connect(zoomResetAction, &QAction::triggered, this, &DolphinViewActionHandler::zoomReset);
+
QAction* zoomOutAction = KStandardAction::zoomOut(this,
&DolphinViewActionHandler::zoomOut,
m_actionCollection);
{
Q_UNUSED(shown);
// It is not enough to update the 'Show Preview' action, also
- // the 'Zoom In' and 'Zoom Out' actions must be adapted.
+ // the 'Zoom In', 'Zoom Out' and 'Zoom Reset' actions must be adapted.
updateViewActions();
}
updateViewActions();
}
+void DolphinViewActionHandler::zoomReset()
+{
+ m_currentView->resetZoomLevel();
+ updateViewActions();
+}
+
void DolphinViewActionHandler::toggleSortFoldersFirst()
{
const bool sortFirst = m_currentView->sortFoldersFirst();
// and several sub-menus. Because of this they don't have a common
// action-group that assures an exclusive toggle-state between the main-menu
// actions and the sub-menu-actions. If an action gets checked, it must
- // be assured that all other actions get unchecked.
+ // be assured that all other actions get unchecked, except the ascending/
+ // descending actions
QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
- foreach (QAction* groupAction, sortByMenu->menu()->actions()) {
+ for (QAction *groupAction : qAsConst(m_sortByActions)) {
KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction);
if (actionMenu) {
foreach (QAction* subAction, actionMenu->menu()->actions()) {