From dea517bb6992eb72d34f4cfef436761b182f30a4 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Wed, 14 Apr 2021 11:36:02 -0600 Subject: [PATCH] Use icons-only "Show Sidebar" Button with new icon, if available This commit makes the "Show Sidebar" button that's on the toolbar by default use the new `sidebar-expand` icon, if present. If not, it falls back to the old `view-sidetree` icon for compatibility's sake. We also make thie button icons-only by default, as the new icon is clearer than the old one. This saves some horizontal space in the defualt toolbar, which is now quite wide. --- part/part.cpp | 3 ++- part/part.rc | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/part/part.cpp b/part/part.cpp index f99c74724..40fae196f 100644 --- a/part/part.cpp +++ b/part/part.cpp @@ -861,7 +861,8 @@ void Part::setupActions() m_showLeftPanel = ac->add(QStringLiteral("show_leftpanel")); m_showLeftPanel->setText(i18n("Show S&idebar")); - m_showLeftPanel->setIcon(QIcon::fromTheme(QStringLiteral("view-sidetree"))); + const QString preferredSidebarIcon = m_sidebar->layoutDirection() == Qt::LeftToRight ? QStringLiteral("sidebar-expand-left") : QStringLiteral("sidebar-expand-right"); + m_showLeftPanel->setIcon(QIcon::fromTheme(preferredSidebarIcon, QIcon::fromTheme(QStringLiteral("view-sidetree")))); connect(m_showLeftPanel, &QAction::toggled, this, &Part::slotShowLeftPanel); ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7)); m_showLeftPanel->setChecked(Okular::Settings::showLeftPanel()); diff --git a/part/part.rc b/part/part.rc index 1931230b1..30a21e7fa 100644 --- a/part/part.rc +++ b/part/part.rc @@ -1,6 +1,6 @@ - + &File @@ -110,6 +110,9 @@ + + +