From 47d283876b6d291b04dab7da05c2ce1bce9e8eb3 Mon Sep 17 00:00:00 2001
From: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date: Thu, 9 Oct 2014 16:14:40 -0500
Subject: Load proper handbook section when a TDEControl module is loaded via
 tdecmshell instead of kcontrol This relates to Bug 1850

---
 kdoctools/customization/entities/general.entities |  4 ++++
 tdeutils/kcmultidialog.cpp                        |  8 +++++++-
 tdeutils/tdecmoduleproxy.cpp                      | 20 ++++++++++++++++----
 tdeutils/tdecmoduleproxy.h                        |  5 +++++
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/kdoctools/customization/entities/general.entities b/kdoctools/customization/entities/general.entities
index e21e2e515..c724031f6 100644
--- a/kdoctools/customization/entities/general.entities
+++ b/kdoctools/customization/entities/general.entities
@@ -424,3 +424,7 @@
 <!ENTITY quanta "<application>Quanta</application>">
 
 <!ENTITY tde-team "The &tde; Team">
+
+<!ENTITY tde-release-version "R14.0.0 [DEVELOPMENT]">
+<!ENTITY tde-release-date "October  9, 2014">
+<!ENTITY tde-copyright-date "2010-2014">
diff --git a/tdeutils/kcmultidialog.cpp b/tdeutils/kcmultidialog.cpp
index 6a074040b..0ba07fe6b 100644
--- a/tdeutils/kcmultidialog.cpp
+++ b/tdeutils/kcmultidialog.cpp
@@ -186,12 +186,18 @@ void KCMultiDialog::slotHelp()
 
     int curPageIndex = activePageIndex();
     ModuleList::Iterator end = m_modules.end();
-    for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
+    for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it ) {
         if( pageIndex( ( TQWidget * )( *it ).kcm->parent() ) == curPageIndex )
         {
             docPath = ( *it ).kcm->moduleInfo().docPath();
+            TDECModuleProxy * m = ( *it ).kcm;
+            TQString section = m->handbookSection();
+            if (section != "") {
+                docPath = TQString( "%1#%2" ).arg( docPath ).arg( section );
+            }
             break;
         }
+    }
 
     KURL url( KURL("help:/"), docPath );
 
diff --git a/tdeutils/tdecmoduleproxy.cpp b/tdeutils/tdecmoduleproxy.cpp
index eeac43b02..f1c91e414 100644
--- a/tdeutils/tdecmoduleproxy.cpp
+++ b/tdeutils/tdecmoduleproxy.cpp
@@ -588,14 +588,26 @@ TQString TDECModuleProxy::quickHelp() const
 
 const TDEAboutData * TDECModuleProxy::aboutData() const
 {
-	if( !d->rootMode )
+	if( !d->rootMode ) {
 		return realModule() ? realModule()->aboutData() : 0;
-	else
-	/* This needs fixing, perhaps cache a TDEAboutData copy 
+	}
+	else {
+	/* This needs fixing, perhaps cache a TDEAboutData copy
 	 * while in root mode? */
 		return 0;
-		
+	}
+}
 
+TQString TDECModuleProxy::handbookSection() const
+{
+	if( !d->rootMode ) {
+		return realModule() ? realModule()->handbookSection() : TQString::null;
+	}
+	else {
+	/* This needs fixing, perhaps cache a TDEAboutData copy
+	 * while in root mode? */
+		return TQString::null;
+	}
 }
 
 int TDECModuleProxy::buttons() const
diff --git a/tdeutils/tdecmoduleproxy.h b/tdeutils/tdecmoduleproxy.h
index 728404f1a..3d2b1ca82 100644
--- a/tdeutils/tdecmoduleproxy.h
+++ b/tdeutils/tdecmoduleproxy.h
@@ -157,6 +157,11 @@ public:
 	 */
 	const TDEAboutData * aboutData() const;
 
+	/**
+	 * @return the module's handbookSection()
+	 */
+	TQString handbookSection() const;
+
 	/**
 	 * @return what buttons the module
 	 * needs
-- 
cgit v1.2.3

