X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/4c9952683a7f977402353f1b9a3fd5271e51740e..7165ea7afdf150600025f9c8ec28dadfe0b28406:/src/views/dolphinviewactionhandler.cpp diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 4aa59911b..a520d7e53 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -188,6 +188,14 @@ void DolphinViewActionHandler::createActions() 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); @@ -391,7 +399,7 @@ void DolphinViewActionHandler::slotPreviewsShownChanged(bool shown) { 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(); } @@ -454,6 +462,12 @@ void DolphinViewActionHandler::zoomOut() updateViewActions(); } +void DolphinViewActionHandler::zoomReset() +{ + m_currentView->resetZoomLevel(); + updateViewActions(); +} + void DolphinViewActionHandler::toggleSortFoldersFirst() { const bool sortFirst = m_currentView->sortFoldersFirst();