Commit 7165ea7a authored by Nate Graham's avatar Nate Graham
Browse files

Add Reset Zoom Level action inside View menu

FEATURE: 409591
FIXED-IN: 19.12.0

Test Plan: {F7096397}

Reviewers: elvisangelaccio, shubham, #dolphin

Reviewed By: elvisangelaccio, #dolphin

Subscribers: broulik, cfeck, kfm-devel, kde-doc-english

Tags: #dolphin, #documentation

Differential Revision:
parent 4c995268
......@@ -1758,6 +1758,17 @@ Selects all unselected items and deselects all selected items in the current fol
<listitem><para><action>Decreases the size of icons in the view.</action></para></listitem>
<keycombo action="simul">&Ctrl;<keycap>0</keycap></keycombo>
<guimenuitem>Zoom Reset</guimenuitem>
<listitem><para><action>Resets the size of icons in the view to default.</action></para></listitem>
......@@ -1016,6 +1016,7 @@ void DolphinMainWindow::updateControlMenu()
// Add "View" actions
if (!GeneralSettings::showZoomSlider()) {
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomIn)), menu);
addActionToMenu(ac->action(QStringLiteral("view_zoom_reset")), menu);
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomOut)), menu);
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="dolphin" version="25">
<kpartgui name="dolphin" version="26">
<Menu name="file">
<Action name="new_menu" />
......@@ -23,6 +23,10 @@
<Action name="invert_selection" />
<Menu name="view">
<Action name="view_zoom_in"/>
<Action name="view_zoom_reset"/>
<Action name="view_zoom_out"/>
<Action name="sort" />
<Action name="view_mode" />
<Action name="additional_info" />
......@@ -116,6 +120,7 @@
<Action priority="0" name="compact"/>
<Action priority="0" name="details"/>
<Action priority="0" name="view_zoom_in"/>
<Action priority="0" name="view_zoom_reset"/>
<Action priority="0" name="view_zoom_out"/>
<Action priority="0" name="edit_cut"/>
<Action priority="0" name="edit_copy"/>
......@@ -66,6 +66,7 @@
#include <QPixmapCache>
#include <QPointer>
#include <QScrollBar>
#include <QSize>
#include <QTimer>
#include <QVBoxLayout>
......@@ -1338,6 +1339,20 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
return QUrl();
void DolphinView::resetZoomLevel()
ViewModeSettings::ViewMode mode;
switch (m_mode) {
case IconsView: mode = ViewModeSettings::IconsMode; break;
case CompactView: mode = ViewModeSettings::CompactMode; break;
case DetailsView: mode = ViewModeSettings::DetailsMode; break;
const ViewModeSettings settings(mode);
const QSize iconSize = QSize(settings.iconSize(), settings.iconSize());
void DolphinView::observeCreatedItem(const QUrl& url)
if (m_active) {
......@@ -196,6 +196,11 @@ public:
void setZoomLevel(int level);
int zoomLevel() const;
* Resets the view's icon size to the default value
void resetZoomLevel();
void setSortRole(const QByteArray& role);
QByteArray sortRole() const;
......@@ -188,6 +188,14 @@ void DolphinViewActionHandler::createActions()
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."));
m_actionCollection->setDefaultShortcuts(zoomResetAction, {Qt::CTRL + Qt::Key_0});
connect(zoomResetAction, &QAction::triggered, this, &DolphinViewActionHandler::zoomReset);
QAction* zoomOutAction = KStandardAction::zoomOut(this,
......@@ -391,7 +399,7 @@ void DolphinViewActionHandler::slotPreviewsShownChanged(bool 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.
......@@ -454,6 +462,12 @@ void DolphinViewActionHandler::zoomOut()
void DolphinViewActionHandler::zoomReset()
void DolphinViewActionHandler::toggleSortFoldersFirst()
const bool sortFirst = m_currentView->sortFoldersFirst();
......@@ -131,6 +131,9 @@ private Q_SLOTS:
/** Decreases the size of the current set view mode. */
void zoomOut();
/** Resets the size of the current set view mode to default. */
void zoomReset();
/** Switches between a separate sorting and a mixed sorting of files and folders. */
void toggleSortFoldersFirst();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment