From 88a2e255141f97ac65c65fd89b5ef9a30b9138c4 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 3 Oct 2014 23:13:17 -0500 Subject: 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 --- doc/kcontrol/keys/index.docbook | 2 +- doc/kcontrol/twindecoration/index.docbook | 4 +-- kcontrol/icons/main.cpp | 15 ++++++++++++ kcontrol/icons/main.h | 1 + kcontrol/input/mouse.cpp | 24 ++++++++++++++++++ kcontrol/input/mouse.h | 2 ++ kcontrol/kcontrol/helpwidget.cpp | 23 +++++++++++++---- kcontrol/kcontrol/helpwidget.h | 4 ++- kcontrol/kcontrol/proxywidget.cpp | 8 ++++++ kcontrol/kcontrol/proxywidget.h | 1 + kcontrol/keys/main.cpp | 19 ++++++++++++++ kcontrol/keys/main.h | 2 ++ kcontrol/konq/desktopbehavior_impl.cpp | 18 ++++++++++++++ kcontrol/konq/desktopbehavior_impl.h | 4 ++- kcontrol/performance/kcmperformance.cpp | 17 ++++++++++++- kcontrol/performance/kcmperformance.h | 2 ++ kcontrol/style/kcmstyle.cpp | 12 +++++++++ kcontrol/style/kcmstyle.h | 2 ++ twin/kcmtwin/twindecoration/twindecoration.cpp | 14 +++++++++++ twin/kcmtwin/twindecoration/twindecoration.h | 2 ++ twin/kcmtwin/twinoptions/main.cpp | 34 ++++++++++++++++++++++++++ twin/kcmtwin/twinoptions/main.h | 1 + 22 files changed, 200 insertions(+), 11 deletions(-) diff --git a/doc/kcontrol/keys/index.docbook b/doc/kcontrol/keys/index.docbook index 3a57b03e8..3aa32d659 100644 --- a/doc/kcontrol/keys/index.docbook +++ b/doc/kcontrol/keys/index.docbook @@ -160,7 +160,7 @@ scheme, discarding your changes. - + Modifier Keys Different keyboards offer different sets of modifier keys. A diff --git a/doc/kcontrol/twindecoration/index.docbook b/doc/kcontrol/twindecoration/index.docbook index c94c12d30..0efb5bb17 100644 --- a/doc/kcontrol/twindecoration/index.docbook +++ b/doc/kcontrol/twindecoration/index.docbook @@ -29,7 +29,7 @@ Window Decoration - + General This module allows you to select a style for the borders around @@ -61,7 +61,7 @@ use. - + Buttons This page has instructions directly on it - just drag around the diff --git a/kcontrol/icons/main.cpp b/kcontrol/icons/main.cpp index 7afaf7df7..359bfec91 100644 --- a/kcontrol/icons/main.cpp +++ b/kcontrol/icons/main.cpp @@ -100,6 +100,21 @@ TQString IconModule::quickHelp() const "

You can also specify effects that should be applied to the icons.

"); } +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 515cc47e9..840704351 100644 --- a/kcontrol/icons/main.h +++ b/kcontrol/icons/main.h @@ -40,6 +40,7 @@ public: 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 4ec79c24c..0d07e782e 100644 --- a/kcontrol/input/mouse.cpp +++ b/kcontrol/input/mouse.cpp @@ -890,4 +890,28 @@ void MouseConfig::slotScrollPolarityChanged() 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 487ceb2db..6d035b8d1 100644 --- a/kcontrol/input/mouse.h +++ b/kcontrol/input/mouse.h @@ -102,6 +102,8 @@ public: 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 3e4fe717f..5407f8027 100644 --- a/kcontrol/kcontrol/helpwidget.cpp +++ b/kcontrol/kcontrol/helpwidget.cpp @@ -26,9 +26,13 @@ #include #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 @@ TQString HelpWidget::text() const 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 1a01cc860..680184df5 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 @@ public: private: TQString docpath; TQString helptext; + DockContainer* _dock; }; #endif diff --git a/kcontrol/kcontrol/proxywidget.cpp b/kcontrol/kcontrol/proxywidget.cpp index 7aa2383b1..f937493fa 100644 --- a/kcontrol/kcontrol/proxywidget.cpp +++ b/kcontrol/kcontrol/proxywidget.cpp @@ -320,6 +320,14 @@ void ProxyWidget::clientChanged(bool state) 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 bb951ccdf..874d30d4f 100644 --- a/kcontrol/kcontrol/proxywidget.h +++ b/kcontrol/kcontrol/proxywidget.h @@ -46,6 +46,7 @@ public: ~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 7e158b677..5fda60ca3 100644 --- a/kcontrol/keys/main.cpp +++ b/kcontrol/keys/main.cpp @@ -125,6 +125,25 @@ void KeyModule::resizeEvent( TQResizeEvent * ) 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; + } +} + //---------------------------------------------------- extern "C" diff --git a/kcontrol/keys/main.h b/kcontrol/keys/main.h index 5299e3884..281b2d37a 100644 --- a/kcontrol/keys/main.h +++ b/kcontrol/keys/main.h @@ -43,6 +43,8 @@ class KeyModule : public TDECModule void save(); void defaults(); + virtual TQString handbookSection() const; + protected: void initGUI(); void resizeEvent( TQResizeEvent* ); diff --git a/kcontrol/konq/desktopbehavior_impl.cpp b/kcontrol/konq/desktopbehavior_impl.cpp index 68bbb160c..17fc2f364 100644 --- a/kcontrol/konq/desktopbehavior_impl.cpp +++ b/kcontrol/konq/desktopbehavior_impl.cpp @@ -485,4 +485,22 @@ TQString DesktopBehavior::quickHelp() const "Use the \"What's This?\" (Shift+F1) to get help on specific options."); } +TQString DesktopBehavior::handbookSection() const +{ + int index = behaviorTab->currentPageIndex(); + if (index == 0) { + //return "desktop-desktop"; + return TQString::null; + } + else if (index == 1) { + return "desktop-behavior-file-icons"; + } + else if (index == 2) { + return "desktop-behavior-device-icons"; + } + else { + return TQString::null; + } +} + #include "desktopbehavior_impl.moc" diff --git a/kcontrol/konq/desktopbehavior_impl.h b/kcontrol/konq/desktopbehavior_impl.h index d04d82136..bc5965750 100644 --- a/kcontrol/konq/desktopbehavior_impl.h +++ b/kcontrol/konq/desktopbehavior_impl.h @@ -36,8 +36,9 @@ public: virtual void save(); virtual void defaults(); virtual TQString quickHelp() const; + virtual TQString handbookSection() const; friend class DesktopBehaviorPreviewItem; - friend class DesktopBehaviorMediaItem; + friend class DesktopBehaviorMediaItem; signals: void changed(); @@ -71,6 +72,7 @@ public: virtual void load() { m_behavior->load(); emit TDECModule::changed( false ); } virtual void save() { m_behavior->save(); emit TDECModule::changed( false ); } virtual void defaults() { m_behavior->defaults(); emit TDECModule::changed( true ); } + virtual TQString handbookSection() const { return m_behavior->handbookSection(); }; private slots: void changed(); diff --git a/kcontrol/performance/kcmperformance.cpp b/kcontrol/performance/kcmperformance.cpp index 93c5019a6..84959e34d 100644 --- a/kcontrol/performance/kcmperformance.cpp +++ b/kcontrol/performance/kcmperformance.cpp @@ -49,7 +49,7 @@ Config::Config( TQWidget* parent_P, const char* ) " You can configure settings that improve TDE performance here." )); TQVBoxLayout *topLayout = new TQVBoxLayout( this ); - TQTabWidget* tabs = new TQTabWidget( this ); + tabs = new TQTabWidget( this ); konqueror_widget = new Konqueror( tabs ); konqueror_widget->layout()->setMargin( KDialog::marginHint() ); connect( konqueror_widget, TQT_SIGNAL( changed()), TQT_SLOT( changed())); @@ -85,6 +85,21 @@ void Config::defaults() load( true ); } +TQString Config::handbookSection() const + { + int index = tabs->currentPageIndex(); + if (index == 0) { + //return "konqueror-performance"; + return TQString::null; + } + else if (index == 1) { + return "system-performance"; + } + else { + return TQString::null; + } + } + KonquerorConfig::KonquerorConfig( TQWidget* parent_P, const char* ) : TDECModule( parent_P, "kcmperformance" ) { diff --git a/kcontrol/performance/kcmperformance.h b/kcontrol/performance/kcmperformance.h index a9963e18a..7e0660c60 100644 --- a/kcontrol/performance/kcmperformance.h +++ b/kcontrol/performance/kcmperformance.h @@ -37,9 +37,11 @@ class Config virtual void load( bool useDefaults ); virtual void save(); virtual void defaults(); + virtual TQString handbookSection() const; private: Konqueror* konqueror_widget; SystemWidget* system_widget; + TQTabWidget* tabs; }; class KonquerorConfig diff --git a/kcontrol/style/kcmstyle.cpp b/kcontrol/style/kcmstyle.cpp index 2ca50631d..e6f426423 100644 --- a/kcontrol/style/kcmstyle.cpp +++ b/kcontrol/style/kcmstyle.cpp @@ -1138,6 +1138,18 @@ void KCMStyle::addWhatsThis() "or submenu appears.") ); } +TQString KCMStyle::handbookSection() const +{ + int index = tabWidget->currentPageIndex(); + if (index == 0) { + //return "style-intro"; + return TQString::null; + } + else { + return TQString::null; + } +} + #include "kcmstyle.moc" // vim: set noet ts=4: diff --git a/kcontrol/style/kcmstyle.h b/kcontrol/style/kcmstyle.h index aa00b9695..ad9fec498 100644 --- a/kcontrol/style/kcmstyle.h +++ b/kcontrol/style/kcmstyle.h @@ -73,6 +73,8 @@ public: virtual void save(); virtual void defaults(); + virtual TQString handbookSection() const; + protected: bool findStyle( const TQString& str, int& combobox_item ); void switchStyle(const TQString& styleName, bool force = false); diff --git a/twin/kcmtwin/twindecoration/twindecoration.cpp b/twin/kcmtwin/twindecoration/twindecoration.cpp index 8e668e78a..e07329b67 100644 --- a/twin/kcmtwin/twindecoration/twindecoration.cpp +++ b/twin/kcmtwin/twindecoration/twindecoration.cpp @@ -956,6 +956,20 @@ TQString KWinDecorationModule::quickHelp() const " In the \"Buttons\" tab you can change the positions of the buttons to your liking.

" ); } +TQString KWinDecorationModule::handbookSection() const +{ + int index = tabWidget->currentPageIndex(); + if (index == 0) { + //return "window-deco-general"; + return TQString::null; + } + else if (index == 1) { + return "window-deco-buttons"; + } + else { + return TQString::null; + } +} void KWinDecorationModule::resetKWin() { diff --git a/twin/kcmtwin/twindecoration/twindecoration.h b/twin/kcmtwin/twindecoration/twindecoration.h index cf968df1d..459823f08 100644 --- a/twin/kcmtwin/twindecoration/twindecoration.h +++ b/twin/kcmtwin/twindecoration/twindecoration.h @@ -73,6 +73,8 @@ class KWinDecorationModule : public TDECModule, virtual public KWinDecorationIfa TQString quickHelp() const; + virtual TQString handbookSection() const; + virtual void dcopUpdateClientList(); signals: diff --git a/twin/kcmtwin/twinoptions/main.cpp b/twin/kcmtwin/twinoptions/main.cpp index c2a74ebb0..8ed52b067 100644 --- a/twin/kcmtwin/twinoptions/main.cpp +++ b/twin/kcmtwin/twinoptions/main.cpp @@ -200,6 +200,40 @@ void KWinOptions::moduleChanged(bool state) emit TDECModule::changed(state); } +TQString KWinOptions::handbookSection() const +{ + int index = tab->currentPageIndex(); + if (index == 0) + { + //return "focus"; + return TQString::null; + } + else if (index == 1) + { + return "titlebar-actions"; + } + else if (index == 2) + { + return "window-actions"; + } + else if (index == 3) + { + return "moving"; + } + else if (index == 4) + { + return "advanced"; + } + else if (index == 5) + { + return "translucency"; + } + else + { + return TQString::null; + } +} + TDEActionsOptions::TDEActionsOptions(TQWidget *parent, const char *name) : TDECModule(parent, name) diff --git a/twin/kcmtwin/twinoptions/main.h b/twin/kcmtwin/twinoptions/main.h index cb80f7e8d..554b7b761 100644 --- a/twin/kcmtwin/twinoptions/main.h +++ b/twin/kcmtwin/twinoptions/main.h @@ -48,6 +48,7 @@ public: void save(); void defaults(); TQString quickHelp() const; + virtual TQString handbookSection() const; protected slots: -- cgit v1.2.1