diff --git a/doc/index.docbook b/doc/index.docbook --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1758,6 +1758,17 @@ Decreases the size of icons in the view. + + + +&Ctrl;0 + +View +Zoom Reset + +Resets the size of icons in the view to default. + + View diff --git a/src/dolphinui.rc b/src/dolphinui.rc --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -1,5 +1,5 @@ - + @@ -114,6 +114,7 @@ + diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -131,6 +131,9 @@ /** Decreases the size of the current set view mode. */ void zoomOut(); + + /** Resets the size of the current set view mode to the average level of zoomLevelInfo::minimumLevel() and ZoomLevelInfo::maximumLevel(). */ + void zoomReset(); /** Switches between a separate sorting and a mixed sorting of files and folders. */ void toggleSortFoldersFirst(); diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -193,6 +193,13 @@ m_actionCollection); zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This reduces the icon size.")); + QAction* zoomResetAction = m_actionCollection->addAction( QStringLiteral("view_zoom_reset") ); + zoomResetAction->setText( i18nc("@action:inmenu View", "Zoom Reset") ); + 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); + KToggleAction* showPreview = m_actionCollection->add(QStringLiteral("show_preview")); showPreview->setText(i18nc("@action:intoolbar", "Preview")); showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); @@ -391,7 +398,7 @@ { 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 +461,13 @@ updateViewActions(); } +void DolphinViewActionHandler::zoomReset() +{ + const int resetLevel = (ZoomLevelInfo::minimumLevel() + ZoomLevelInfo::maximumLevel())/2; + m_currentView->setZoomLevel(resetLevel); + updateViewActions(); +} + void DolphinViewActionHandler::toggleSortFoldersFirst() { const bool sortFirst = m_currentView->sortFoldersFirst();