From edfd68e87dcbaa0e594402cd94cfea727d7399eb Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Fri, 14 Feb 2020 16:24:49 +0300 Subject: [PATCH] Hide top level menu items if they have no children --- khelpcenter/navigator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/khelpcenter/navigator.cpp b/khelpcenter/navigator.cpp index 770ef3fc..db927dfa 100644 --- a/khelpcenter/navigator.cpp +++ b/khelpcenter/navigator.cpp @@ -216,13 +216,17 @@ History no X-KDE-PluginKeyword in kcmhistory.desktop list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), QStringLiteral("[X-KDE-ParentApp] == 'kinfocenter'") ); } + bool no_children_present = true; + for ( KService::List::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) { KService::Ptr s(*it); QString desktopFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kservices5/") + s->entryPath() ); createItemFromDesktopFile( topItem, desktopFile ); + no_children_present = false; } topItem->sortChildren( 0, Qt::AscendingOrder /* ascending */ ); + topItem->setHidden(no_children_present); } void Navigator::insertIOSlaveDocs( const QString &name, NavigatorItem *topItem ) -- 2.24.1