From 9a6735bb63e078fe0281bda13efa3c759f9bbd1d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 9 Oct 2014 22:06:23 -0500 Subject: Add handbookSection method to TDECModuleContainer This relates to Bug 1850 --- tdeutils/tdecmodulecontainer.cpp | 30 ++++++++++++++++++++---------- tdeutils/tdecmodulecontainer.h | 6 ++++++ 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'tdeutils') diff --git a/tdeutils/tdecmodulecontainer.cpp b/tdeutils/tdecmodulecontainer.cpp index 004ceb78a..2df7a0421 100644 --- a/tdeutils/tdecmodulecontainer.cpp +++ b/tdeutils/tdecmodulecontainer.cpp @@ -60,6 +60,7 @@ class TDECModuleContainer::TDECModuleContainerPrivate KPushButton *btnRootMode; TQHBoxLayout *btnLayout; TQVBoxLayout *topLayout; + TQString handbookSection; }; @@ -134,10 +135,14 @@ void TDECModuleContainer::addModule( const TQString& module ) return; } - if( !TDECModuleLoader::testModule( module )) + if( !TDECModuleLoader::testModule( module )) { return; + } TDECModuleProxy* proxy = new TDECModuleProxy( module, false, d->tabWidget, module.latin1()); + if (allModules.count() < 1) { + d->handbookSection = proxy->handbookSection(); + } allModules.append( proxy ); d->tabWidget->addTab( proxy, TQIconSet(TDEGlobal::iconLoader()->loadIcon( @@ -153,37 +158,42 @@ void TDECModuleContainer::addModule( const TQString& module ) d->buttons = d->buttons | proxy->realModule()->buttons(); /* If we should add an Administrator Mode button */ - if ( proxy->moduleInfo().needsRootPrivileges() ) + if ( proxy->moduleInfo().needsRootPrivileges() ) { d->hasRootKCM=true; - - + } } void TDECModuleContainer::tabSwitched( TQWidget * module ) { - if ( !d->hasRootKCM ) + TDECModuleProxy* mod = (TDECModuleProxy *) module; + d->handbookSection = mod->handbookSection(); + + if ( !d->hasRootKCM ) { return; + } /* Not like this. Not like this. */ disconnect( d->btnRootMode, 0, 0, 0 ); /* Welcome to the real world huh baby? */ - - TDECModuleProxy* mod = (TDECModuleProxy *) module; - if ( mod->moduleInfo().needsRootPrivileges() && !mod->rootMode() ) - { + if ( mod->moduleInfo().needsRootPrivileges() && !mod->rootMode() ) { d->btnRootMode->setEnabled( true ); connect( d->btnRootMode, TQT_SIGNAL( clicked() ), TQT_SLOT( runAsRoot() )); connect( mod, TQT_SIGNAL( childClosed() ), TQT_SLOT ( rootExited() )); } - else + else { d->btnRootMode->setEnabled( false ); + } setQuickHelp( mod->quickHelp() ); setAboutData( const_cast(mod->aboutData()) ); +} +TQString TDECModuleContainer::handbookSection() const +{ + return d->handbookSection; } void TDECModuleContainer::runAsRoot() diff --git a/tdeutils/tdecmodulecontainer.h b/tdeutils/tdecmodulecontainer.h index d4af182b4..6d6717370 100644 --- a/tdeutils/tdecmodulecontainer.h +++ b/tdeutils/tdecmodulecontainer.h @@ -118,6 +118,12 @@ class TDEUTILS_EXPORT TDECModuleContainer : public TDECModule */ void defaults(); + /** + * Reimplemented for internal purposes. + * @internal + */ + virtual TQString handbookSection() const; + protected: /** -- cgit v1.2.1