X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/60d6a3bdbcd44360e1c6ae1c82239ecf6d60ded7..7165ea7afdf150600025f9c8ec28dadfe0b28406:/src/views/dolphinviewactionhandler.cpp
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index a79dacb1f..a520d7e53 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -163,7 +163,7 @@ void DolphinViewActionHandler::createActions()
" option is enabled."));
compactAction->setWhatsThis(xi18nc("@info:whatsthis Compact view mode",
"This switches to a compact view mode that lists the folders "
- "and files in columns with the names beside the icons. "
+ "and files in columns with the names beside the icons."
"This helps to keep the overview in folders with many items."));
detailsAction->setWhatsThis(xi18nc("@info:whatsthis Details view mode",
"This switches to a list view mode that focuses on folder "
@@ -188,10 +188,18 @@ 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);
- zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This reduces the icon size."));
+ zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size."));
KToggleAction* showPreview = m_actionCollection->add(QStringLiteral("show_preview"));
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
@@ -280,7 +288,7 @@ void DolphinViewActionHandler::createActions()
QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
{
const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_"));
- Q_ASSERT(isSortGroup || (!isSortGroup && groupPrefix == QLatin1String("show_")));
+ Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_"));
QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup);
@@ -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();
@@ -535,11 +549,11 @@ void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
// #374508: don't overwrite custom icons.
const QString iconName = showHiddenFilesAction->icon().name();
- if (!iconName.isEmpty() && iconName != QLatin1String("visibility") && iconName != QLatin1String("hint")) {
+ if (!iconName.isEmpty() && iconName != QLatin1String("view-visible") && iconName != QLatin1String("view-hidden")) {
return;
}
- showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("visibility") : QStringLiteral("hint")));
+ showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)