add more spacing
[personal-kdebase.git] / workspace / ksmserver / tests / test.cpp
blob4680b6e8a7c73fd7bd214c8f87c80e83ee77e09c
1 #include "shutdowndlg.h"
2 #include <kcmdlineargs.h>
3 #include <kaboutdata.h>
4 #include <kapplication.h>
5 #include <kiconloader.h>
6 #include <kworkspace.h>
8 int
9 main(int argc, char *argv[])
11 KAboutData about("kapptest", 0, ki18n("kapptest"), "version");
12 KCmdLineArgs::init(argc, argv, &about);
14 KCmdLineOptions options;
15 options.add("t");
16 options.add("type <name>", ki18n("The type of shutdown to emulate: Default, None, Reboot, Halt or Logout"), "None");
17 KCmdLineArgs::addCmdLineOptions(options);
19 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
21 KApplication a;
22 KIconLoader::global()->addAppDir("ksmserver");
23 KSMShutdownFeedback::start();
25 QString sdtypeOption = args->getOption("type").toLower();
27 KWorkSpace::ShutdownType sdtype = KWorkSpace::ShutdownTypeNone;
28 if (sdtypeOption == "default") {
29 sdtype = KWorkSpace::ShutdownTypeDefault;
30 } else if (sdtypeOption == "reboot") {
31 sdtype = KWorkSpace::ShutdownTypeReboot;
32 } else if (sdtypeOption == "halt") {
33 sdtype = KWorkSpace::ShutdownTypeReboot;
34 } else if (sdtypeOption == "logout") {
35 sdtype = KWorkSpace::ShutdownTypeReboot;
38 QString bopt;
39 (void)KSMShutdownDlg::confirmShutdown( true, sdtype, bopt );
40 /* (void)KSMShutdownDlg::confirmShutdown( false, sdtype, bopt ); */
42 KSMShutdownFeedback::stop();