Commit c394f1b4 authored by Aleksei Nikiforov's avatar Aleksei Nikiforov Committed by Yuri Chornoivan
Browse files

Hide top level scrollkeeper menu item if it's empty

Differential revision: https://phabricator.kde.org/D27403
parent ef8192e5
...@@ -275,7 +275,7 @@ void Navigator::insertInfoDocs( NavigatorItem *topItem ) ...@@ -275,7 +275,7 @@ void Navigator::insertInfoDocs( NavigatorItem *topItem )
void Navigator::insertScrollKeeperDocs( NavigatorItem *topItem ) void Navigator::insertScrollKeeperDocs( NavigatorItem *topItem )
{ {
ScrollKeeperTreeBuilder *builder = new ScrollKeeperTreeBuilder( this ); ScrollKeeperTreeBuilder *builder = new ScrollKeeperTreeBuilder( this );
builder->build( topItem ); builder->buildOrHide( topItem );
} }
void Navigator::selectItem( const QUrl &url ) void Navigator::selectItem( const QUrl &url )
......
...@@ -45,6 +45,13 @@ void ScrollKeeperTreeBuilder::loadConfig() ...@@ -45,6 +45,13 @@ void ScrollKeeperTreeBuilder::loadConfig()
mShowEmptyDirs = Prefs::showEmptyDirs(); mShowEmptyDirs = Prefs::showEmptyDirs();
} }
void ScrollKeeperTreeBuilder::buildOrHide( NavigatorItem *parent )
{
build(parent);
parent->setHidden(parent->childCount() == 0);
}
void ScrollKeeperTreeBuilder::build( NavigatorItem *parent ) void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
{ {
QString lang = QLocale().bcp47Name(); QString lang = QLocale().bcp47Name();
......
...@@ -36,6 +36,8 @@ class ScrollKeeperTreeBuilder : public QObject ...@@ -36,6 +36,8 @@ class ScrollKeeperTreeBuilder : public QObject
void build( NavigatorItem *parent ); void build( NavigatorItem *parent );
void buildOrHide( NavigatorItem *parent );
private: private:
void loadConfig(); void loadConfig();
int insertSection( NavigatorItem *parent, int insertSection( NavigatorItem *parent,
......
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