Add handbookSection method to TDECModuleContainer

This relates to Bug 1850
pull/16/head
Timothy Pearson 10 years ago
parent 54aa2cd493
commit 9a6735bb63

@ -60,6 +60,7 @@ class TDECModuleContainer::TDECModuleContainerPrivate
KPushButton *btnRootMode; KPushButton *btnRootMode;
TQHBoxLayout *btnLayout; TQHBoxLayout *btnLayout;
TQVBoxLayout *topLayout; TQVBoxLayout *topLayout;
TQString handbookSection;
}; };
@ -134,10 +135,14 @@ void TDECModuleContainer::addModule( const TQString& module )
return; return;
} }
if( !TDECModuleLoader::testModule( module )) if( !TDECModuleLoader::testModule( module )) {
return; return;
}
TDECModuleProxy* proxy = new TDECModuleProxy( module, false, d->tabWidget, module.latin1()); TDECModuleProxy* proxy = new TDECModuleProxy( module, false, d->tabWidget, module.latin1());
if (allModules.count() < 1) {
d->handbookSection = proxy->handbookSection();
}
allModules.append( proxy ); allModules.append( proxy );
d->tabWidget->addTab( proxy, TQIconSet(TDEGlobal::iconLoader()->loadIcon( 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(); d->buttons = d->buttons | proxy->realModule()->buttons();
/* If we should add an Administrator Mode button */ /* If we should add an Administrator Mode button */
if ( proxy->moduleInfo().needsRootPrivileges() ) if ( proxy->moduleInfo().needsRootPrivileges() ) {
d->hasRootKCM=true; d->hasRootKCM=true;
}
} }
void TDECModuleContainer::tabSwitched( TQWidget * module ) void TDECModuleContainer::tabSwitched( TQWidget * module )
{ {
if ( !d->hasRootKCM ) TDECModuleProxy* mod = (TDECModuleProxy *) module;
d->handbookSection = mod->handbookSection();
if ( !d->hasRootKCM ) {
return; return;
}
/* Not like this. Not like this. */ /* Not like this. Not like this. */
disconnect( d->btnRootMode, 0, 0, 0 ); disconnect( d->btnRootMode, 0, 0, 0 );
/* Welcome to the real world huh baby? */ /* 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 ); d->btnRootMode->setEnabled( true );
connect( d->btnRootMode, TQT_SIGNAL( clicked() ), connect( d->btnRootMode, TQT_SIGNAL( clicked() ),
TQT_SLOT( runAsRoot() )); TQT_SLOT( runAsRoot() ));
connect( mod, TQT_SIGNAL( childClosed() ), connect( mod, TQT_SIGNAL( childClosed() ),
TQT_SLOT ( rootExited() )); TQT_SLOT ( rootExited() ));
} }
else else {
d->btnRootMode->setEnabled( false ); d->btnRootMode->setEnabled( false );
}
setQuickHelp( mod->quickHelp() ); setQuickHelp( mod->quickHelp() );
setAboutData( const_cast<TDEAboutData*>(mod->aboutData()) ); setAboutData( const_cast<TDEAboutData*>(mod->aboutData()) );
}
TQString TDECModuleContainer::handbookSection() const
{
return d->handbookSection;
} }
void TDECModuleContainer::runAsRoot() void TDECModuleContainer::runAsRoot()

@ -118,6 +118,12 @@ class TDEUTILS_EXPORT TDECModuleContainer : public TDECModule
*/ */
void defaults(); void defaults();
/**
* Reimplemented for internal purposes.
* @internal
*/
virtual TQString handbookSection() const;
protected: protected:
/** /**

Loading…
Cancel
Save