diff --git a/conf/okular.kcfg b/conf/okular.kcfg --- a/conf/okular.kcfg +++ b/conf/okular.kcfg @@ -204,6 +204,9 @@ true + + true + true diff --git a/part.cpp b/part.cpp --- a/part.cpp +++ b/part.cpp @@ -441,8 +441,9 @@ // ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList ); connect( m_thumbnailList.data(), &ThumbnailList::rightClick, this, &Part::slotShowMenu ); m_sidebar->addItem( thumbsBox, QIcon::fromTheme( QStringLiteral("view-preview") ), i18n("Thumbnails") ); - - m_sidebar->setCurrentItem( thumbsBox ); + // Setting current item as thumbsBox if the sidebar is visible + if ( !Okular::Settings::sidebarCollapsed() ) + m_sidebar->setCurrentItem( thumbsBox ); // [left toolbox: Reviews] | [] m_reviewsWidget = new Reviews( nullptr, m_document ); @@ -864,6 +865,8 @@ ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7)); m_showLeftPanel->setChecked( Okular::Settings::showLeftPanel() ); slotShowLeftPanel(); + // Displaying the sidebar based on the last state + m_sidebar->setCollapsed( Okular::Settings::sidebarCollapsed() ); m_showBottomBar = ac->add(QStringLiteral("show_bottombar")); m_showBottomBar->setText(i18n( "Show &Page Bar")); @@ -2217,8 +2220,8 @@ { m_sidebar->setItemEnabled(m_toc, enable); - // If present, show the TOC when a document is opened - if ( enable && m_sidebar->currentItem() != m_toc ) + // If present, show the TOC when a document is opened and sidebar is collapsed + if ( enable && m_sidebar->currentItem() != m_toc && !Okular::Settings::sidebarCollapsed() ) { m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed ); } diff --git a/ui/sidebar.cpp b/ui/sidebar.cpp --- a/ui/sidebar.cpp +++ b/ui/sidebar.cpp @@ -522,6 +522,8 @@ Sidebar::~Sidebar() { + Okular::Settings::setSidebarCollapsed( isCollapsed() ); + Okular::Settings::self()->save(); delete d; }