22 #include <tqstringlist.h>
23 #include <tqtabwidget.h>
24 #include <tqtooltip.h>
25 #include <tqvaluelist.h>
28 #include <kcmoduleinfo.h>
29 #include <kcmoduleloader.h>
30 #include <kcmoduleproxy.h>
34 #include <kiconloader.h>
35 #include <kpushbutton.h>
37 #include <kstdguiitem.h>
39 #include "kcmodulecontainer.h"
40 #include "kcmodulecontainer.moc"
43 class KCModuleContainer::KCModuleContainerPrivate
46 KCModuleContainerPrivate(
const TQStringList& mods )
57 TQTabWidget *tabWidget;
61 TQHBoxLayout *btnLayout;
62 TQVBoxLayout *topLayout;
74 const TQString& mods )
77 d =
new KCModuleContainerPrivate( TQStringList::split(
",", TQString(mods).remove(
" " )) );
82 const TQStringList& mods )
83 :
KCModule( parent, name ), d( new KCModuleContainerPrivate( mods ) )
88 void KCModuleContainer::init()
91 d->tabWidget =
new TQTabWidget(
this,
"tabWidget");
93 connect( d->tabWidget, TQT_SIGNAL( currentChanged( TQWidget* ) ), TQT_SLOT( tabSwitched( TQWidget* ) ));
94 d->topLayout->addWidget( d->tabWidget );
96 if ( !d->modules.isEmpty() )
99 for ( TQStringList::Iterator it = d->modules.begin(); it != d->modules.end(); ++it )
114 d->btnLayout =
new TQHBoxLayout(
this, 0, 0,
"btnLayout");
117 d->btnLayout->addWidget( d->btnRootMode );
118 d->btnLayout->addStretch();
119 d->topLayout->addLayout( d->btnLayout );
130 if ( !KService::serviceByDesktopName( module ) )
132 kdDebug(713) <<
"KCModuleContainer: module '" <<
133 module <<
"' was not found and thus not loaded" <<
endl;
162 void KCModuleContainer::tabSwitched( TQWidget * module )
164 if ( !d->hasRootKCM )
168 disconnect( d->btnRootMode, 0, 0, 0 );
175 d->btnRootMode->setEnabled(
true );
176 connect( d->btnRootMode, TQT_SIGNAL( clicked() ),
177 TQT_SLOT( runAsRoot() ));
178 connect( mod, TQT_SIGNAL( childClosed() ),
179 TQT_SLOT ( rootExited() ));
182 d->btnRootMode->setEnabled(
false );
189 void KCModuleContainer::runAsRoot()
191 if ( d->tabWidget->currentPage() )
192 ( (
KCModuleProxy *) d->tabWidget->currentPage() )->runAsRoot();
193 d->btnRootMode->setEnabled(
false );
196 void KCModuleContainer::rootExited()
198 connect( d->btnRootMode, TQT_SIGNAL( clicked() ), TQT_SLOT( runAsRoot() ));
199 d->btnRootMode->setEnabled(
true );
205 ModuleList::iterator it;
206 for ( it = list.begin() ; it !=list.end() ; ++it )
218 ModuleList::iterator it;
219 for ( it = list.begin() ; it !=list.end() ; ++it )
230 ModuleList::iterator it;
231 for ( it = list.begin() ; it !=list.end() ; ++it )
void load()
Reimplemented for internal purposes.
virtual ~KCModuleContainer()
Default destructor.
ModuleList allModules
A list of all modules which are encapsulated.
KCModuleContainer(TQWidget *parent, const char *name, const TQStringList &mods)
Creates a KCModuleContainer with tabs, each one containing one of the specified modules in mods.
ModuleList changedModules
A list containing KCModuleProxy objects which have changed and must be saved.
void finalize()
Sets this KCM's buttons and adds a AdminMode button if necessary.
void save()
Reimplemented for internal purposes.
void defaults()
Reimplemented for internal purposes.
void addModule(const TQString &module)
Adds the specified module to the tab widget.
bool needsRootPrivileges() const
TQString moduleName() const
static bool testModule(const TQString &module)
Checks whether an KCModule should be shown by running its test function.
Encapsulates a KCModule for embedding.
KCModule * realModule() const
Access to the actual module.
bool rootMode() const
Returns whether the module is running in root mode.
const KAboutData * aboutData() const
TQString quickHelp() const
const KCModuleInfo & moduleInfo() const
void setAboutData(KAboutData *about)
void setQuickHelp(const TQString &help)
static KIconLoader * iconLoader()
static KGuiItem adminMode()
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)