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
@@ -435,8 +435,10 @@
// 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 side navigation panel is visible
+ if ( !Okular::Settings::hideSideContainer() )
+ m_sidebar->setCurrentItem( thumbsBox );
// [left toolbox: Reviews] | []
m_reviewsWidget = new Reviews( nullptr, m_document );
@@ -838,6 +840,8 @@
ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7));
m_showLeftPanel->setChecked( Okular::Settings::showLeftPanel() );
slotShowLeftPanel();
+ // Displaying the side navigation panel based on the last state
+ m_sidebar->setCollapsed( Okular::Settings::hideSideContainer() );
m_showBottomBar = ac->add(QStringLiteral("show_bottombar"));
m_showBottomBar->setText(i18n( "Show &Page Bar"));
@@ -2150,8 +2154,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 side navigation panel is visible
+ if ( enable && m_sidebar->currentItem() != m_toc && !Okular::Settings::hideSideContainer() )
{
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::setHideSideContainer( isCollapsed() );
+ Okular::Settings::self()->save();
delete d;
}
@@ -712,6 +714,7 @@
void Sidebar::itemClicked( QListWidgetItem *item, SetCurrentItemBehaviour b )
{
+
if ( !item )
return;