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 )