|
RT
不知为什么
请教达淫
[code:1]#include <qcstring.h>
#include <qapplication.h>
#include <kcmoduleloader.h>
#include <kcmultidialog.h>
#include <kdialogbase.h>
#include <kcmoduleinfo.h>
#include <kservice.h>
#include <kdebug.h>
#include <qfile.h>
static KService::Ptr locateModule(const QCString& module)
{
QString path = QFile::decodeName(module);
if (!path.endsWith(".desktop"))
path += ".desktop";
KService::Ptr service = KService::serviceByStorageId( path );
if (!service)
{
kdWarning(780) << "Could not find module '" << module << "'." << endl;
return 0;
}
if(!KCModuleLoader::testModule( module ))
{
kdDebug(780) << "According to \"" << module << "\"'s test function, it should Not be loaded." << endl;
return 0;
}
return service;
}
int main( int argc, char ** argv )
{
QApplication a( argc, argv );
KDialogBase::DialogType dtype = KDialogBase::Plain;
KCMultiDialog *dlg = new KCMultiDialog( dtype,
QString("Configure"), 0, "", true );
KService::List modules;
KService::Ptr service = locateModule(QCString("kdm"));
if( service )
{
modules.append(service);
}
for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it)
dlg->addModule(KCModuleInfo(*it));
dlg->exec();
delete dlg;
return 0;
}
[/code:1] |
|