Branch: master

88a2e255 2014-10-03 23:13:17 Timothy Pearson
Add mechanism by which sections of relevant docbooks may be opened automatically based on active tab in TDECModule
Fix up several tabbed TDEControl modules to use this mechanism
Fix a couple of docbooks with missing section IDs
This relates to Bug 1850
M doc/kcontrol/keys/index.docbook
M doc/kcontrol/twindecoration/index.docbook
M kcontrol/icons/main.cpp
M kcontrol/icons/main.h
M kcontrol/input/mouse.cpp
M kcontrol/input/mouse.h
M kcontrol/kcontrol/helpwidget.cpp
M kcontrol/kcontrol/helpwidget.h
M kcontrol/kcontrol/proxywidget.cpp
M kcontrol/kcontrol/proxywidget.h
M kcontrol/keys/main.cpp
M kcontrol/keys/main.h
M kcontrol/konq/desktopbehavior_impl.cpp
M kcontrol/konq/desktopbehavior_impl.h
M kcontrol/performance/kcmperformance.cpp
M kcontrol/performance/kcmperformance.h
M kcontrol/style/kcmstyle.cpp
M kcontrol/style/kcmstyle.h
M twin/kcmtwin/twindecoration/twindecoration.cpp
M twin/kcmtwin/twindecoration/twindecoration.h
M twin/kcmtwin/twinoptions/main.cpp
M twin/kcmtwin/twinoptions/main.h
diff --git a/doc/kcontrol/keys/index.docbook b/doc/kcontrol/keys/index.docbook
index 3a57b03..3aa32d6 100644
--- a/doc/kcontrol/keys/index.docbook
+++ b/doc/kcontrol/keys/index.docbook
@@ -160,7 +160,7 @@
 
 </sect2>
 
-<sect2>
+<sect2 id="key-bindings-modifiers">
 <title>Modifier Keys</title>
 
 <para>Different keyboards offer different sets of modifier keys.  A
diff --git a/doc/kcontrol/twindecoration/index.docbook b/doc/kcontrol/twindecoration/index.docbook
index c94c12d..0efb5bb 100644
--- a/doc/kcontrol/twindecoration/index.docbook
+++ b/doc/kcontrol/twindecoration/index.docbook
@@ -29,7 +29,7 @@
 <sect1 id="window-deco">
 <title>Window Decoration</title>
 
-<sect2>
+<sect2 id="window-deco-general">
 <title>General</title>
 
 <para>This module allows you to select a style for the borders around
@@ -61,7 +61,7 @@
 
 </sect2>
 
-<sect2>
+<sect2 id="window-deco-buttons">
 <title>Buttons</title>
 
 <para>This page has instructions directly on it - just drag around the
diff --git a/kcontrol/icons/main.cpp b/kcontrol/icons/main.cpp
index 7afaf7d..359bfec 100644
--- a/kcontrol/icons/main.cpp
+++ b/kcontrol/icons/main.cpp
@@ -100,6 +100,21 @@
     "<p>You can also specify effects that should be applied to the icons.</p>");
 }
 
+TQString IconModule::handbookSection() const
+{
+  int index = tab->currentPageIndex();
+  if (index == 0) {
+    //return "icon-theme";
+    return TQString::null;
+  }
+  else if (index == 1) {
+    return "icons-use";
+  }
+  else {
+    return TQString::null;
+  }
+}
+
 
 
 #include "main.moc"
diff --git a/kcontrol/icons/main.h b/kcontrol/icons/main.h
index 515cc47..8407043 100644
--- a/kcontrol/icons/main.h
+++ b/kcontrol/icons/main.h
@@ -40,6 +40,7 @@
   void save();
   void defaults();
   TQString quickHelp() const;
+  virtual TQString handbookSection() const;
 
 protected slots:
   void moduleChanged(bool state);
diff --git a/kcontrol/input/mouse.cpp b/kcontrol/input/mouse.cpp
index 4ec79c2..0d07e78 100644
--- a/kcontrol/input/mouse.cpp
+++ b/kcontrol/input/mouse.cpp
@@ -890,4 +890,28 @@
   settings->m_handedNeedsApply = true;
 }
 
+TQString MouseConfig::handbookSection() const
+{
+  int index = tabwidget->currentPageIndex();
+  if (index == 0) {
+    //return "mouse-general";
+    return TQString::null;
+  }
+  else if (index == 1) {
+    return "cursor-theme";
+  }
+  else if (index == 2) {
+    return "mouse-advanced";
+  }
+  else if (index == 3) {
+    return "mouse-navigation";
+  }
+  else if (index >= 4) {
+    return "logitech-mouse";
+  }
+  else {
+    return TQString::null;
+  }
+}
+
 #include "mouse.moc"
diff --git a/kcontrol/input/mouse.h b/kcontrol/input/mouse.h
index 487ceb2..6d035b8 100644
--- a/kcontrol/input/mouse.h
+++ b/kcontrol/input/mouse.h
@@ -102,6 +102,8 @@
   void load( bool useDefaults );
   void defaults();
 
+  virtual TQString handbookSection() const;
+
 private slots:
 
   void slotClick();
diff --git a/kcontrol/kcontrol/helpwidget.cpp b/kcontrol/kcontrol/helpwidget.cpp
index 3e4fe71..5407f80 100644
--- a/kcontrol/kcontrol/helpwidget.cpp
+++ b/kcontrol/kcontrol/helpwidget.cpp
@@ -26,9 +26,13 @@
 #include <krun.h>
 
 #include "global.h"
+#include "dockcontainer.h"
+#include "proxywidget.h"
+#include "modules.h"
+
 #include "helpwidget.h"
 
-HelpWidget::HelpWidget(TQWidget *parent) : TQWhatsThis(parent)
+HelpWidget::HelpWidget(DockContainer *parent) : TQWhatsThis(parent), _dock(parent)
 {
   setBaseText();
 }
@@ -60,16 +64,25 @@
 
 bool HelpWidget::clicked(const TQString & _url)
 {
-    if ( _url.isNull() )
+    TQString textUrl = _url;
+    ConfigModule* dockModule = _dock->module();
+    if ( dockModule) {
+        TQString section = dockModule->module()->handbookSection();
+        if (section != "") {
+            textUrl = TQString( "%1#%2" ).arg( textUrl ).arg( section );
+        }
+    }
+
+    if ( textUrl.isNull() )
         return true;
 
-    if ( _url.find('@') > -1 ) {
-        kapp->invokeMailer(_url);
+    if ( textUrl.find('@') > -1 ) {
+        kapp->invokeMailer(textUrl);
         return true;
     }
 
     TDEProcess process;
-    KURL url(KURL("help:/"), _url);
+    KURL url(KURL("help:/"), textUrl);
 
     if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
         process << "khelpcenter"
diff --git a/kcontrol/kcontrol/helpwidget.h b/kcontrol/kcontrol/helpwidget.h
index 1a01cc8..680184d 100644
--- a/kcontrol/kcontrol/helpwidget.h
+++ b/kcontrol/kcontrol/helpwidget.h
@@ -22,11 +22,12 @@
 
 class TQWidget;
 class TQWhatsThis;
+class DockContainer;
 
 class HelpWidget : public TQWhatsThis
 {
 public:
-  HelpWidget(TQWidget *parent);
+  HelpWidget(DockContainer *parent);
 
   void setText( const TQString& docPath, const TQString& text);
   void setBaseText();
@@ -38,6 +39,7 @@
 private:
   TQString docpath;
   TQString helptext;
+  DockContainer* _dock;
 };
 
 #endif
diff --git a/kcontrol/kcontrol/proxywidget.cpp b/kcontrol/kcontrol/proxywidget.cpp
index 7aa2383..f937493 100644
--- a/kcontrol/kcontrol/proxywidget.cpp
+++ b/kcontrol/kcontrol/proxywidget.cpp
@@ -320,6 +320,14 @@
   emit changed(state);
 }
 
+TQString ProxyWidget::handbookSection() const
+{
+  if (_client)
+    return _client->handbookSection();
+  else
+    return TQString::null;
+}
+
 const TDEAboutData *ProxyWidget::aboutData() const
 {
   return _client->aboutData();
diff --git a/kcontrol/kcontrol/proxywidget.h b/kcontrol/kcontrol/proxywidget.h
index bb951cc..874d30d 100644
--- a/kcontrol/kcontrol/proxywidget.h
+++ b/kcontrol/kcontrol/proxywidget.h
@@ -46,6 +46,7 @@
   ~ProxyWidget();
 
   TQString quickHelp() const;
+  TQString handbookSection() const;
   const TDEAboutData *aboutData() const;
 
 public slots:
diff --git a/kcontrol/keys/main.cpp b/kcontrol/keys/main.cpp
index 7e158b6..5fda60c 100644
--- a/kcontrol/keys/main.cpp
+++ b/kcontrol/keys/main.cpp
@@ -125,6 +125,25 @@
 	m_pTab->setGeometry( 0, 0, width(), height() );
 }
 
+TQString KeyModule::handbookSection() const
+{
+	int index = m_pTab->currentPageIndex();
+	if (index == 0) {
+		//return "key-bindings-intro";
+		return TQString::null;
+	}
+	else if (index == 1) {
+		//return "key-bindings-use";
+		return TQString::null;
+	}
+	else if (index == 2) {
+		return "key-bindings-modifiers";
+	}
+	else {
+		return TQString::null;
+	}
 ** Diff limit reached (max: 250 lines) **