本文整理汇总了C++中KApplication::disableSessionManagement方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::disableSessionManagement方法的具体用法?C++ KApplication::disableSessionManagement怎么用?C++ KApplication::disableSessionManagement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::disableSessionManagement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: about
extern "C" KDE_EXPORT int kdemain(int argc, char** argv)
{
KAboutData about("cvsservice", 0, ki18n("CVS D-Bus service"), "0.1",
ki18n("D-Bus service for CVS"), KAboutData::License_LGPL,
ki18n("Copyright (c) 2002-2003 Christian Loose"));
about.addAuthor(ki18n("Christian Loose"), ki18n("Developer"),
"[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
// Don't quit if password dialog for login is closed
app.setQuitOnLastWindowClosed(false);
// This app is started automatically, no need for session management
app.disableSessionManagement();
CvsService service;
return app.exec();
}
示例2: kScreenSaverMain
int kScreenSaverMain( int argc, char** argv, KScreenSaverInterface& screenSaverInterface )
{
KLocale::setMainCatalog("libkscreensaver");
KCmdLineArgs::init(argc, argv, screenSaverInterface.aboutData());
KCmdLineOptions options;
options.add("setup", ki18n("Setup screen saver"));
options.add("window-id wid", ki18n("Run in the specified XWindow"));
options.add("root", ki18n("Run in the root XWindow"));
options.add("demo", ki18n("Start screen saver in demo mode"), "default");
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// Set a useful default icon.
app.setWindowIcon(KIcon("preferences-desktop-screensaver"));
// Disable session management so screensaver windows don't get restored on login (bug#314859)
app.disableSessionManagement();
if (!pipe(termPipe))
{
struct sigaction sa;
sa.sa_handler = termHandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGTERM, &sa, 0);
QSocketNotifier *sn = new QSocketNotifier(termPipe[0], QSocketNotifier::Read, &app);
QObject::connect(sn, SIGNAL(activated(int)), &app, SLOT(quit()));
}
#ifdef Q_WS_X11
oldXErrorHandler = XSetErrorHandler(xErrorHandler);
#endif
KCrash::setCrashHandler( crashHandler );
KGlobal::locale()->insertCatalog("klock");
KGlobal::locale()->insertCatalog("kscreensaver");
DemoWindow *demoWidget = 0;
Window saveWin = 0;
KScreenSaver *target;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("setup"))
{
QDialog *dlg = screenSaverInterface.setup();
args->clear();
dlg->exec();
delete dlg;
return 0;
}
if (args->isSet("window-id"))
{
saveWin = args->getOption("window-id").toInt();
}
#ifdef Q_WS_X11 //FIXME
if (args->isSet("root"))
{
QX11Info inf;
saveWin = RootWindow(QX11Info::display(), inf.screen());
}
#endif
if (args->isSet("demo"))
{
saveWin = 0;
}
if (saveWin == 0)
{
demoWidget = new DemoWindow();
demoWidget->setAttribute(Qt::WA_NoSystemBackground);
demoWidget->setAttribute(Qt::WA_PaintOnScreen);
demoWidget->show();
app.processEvents();
saveWin = demoWidget->winId();
}
target = screenSaverInterface.create( saveWin );
target->setAttribute(Qt::WA_PaintOnScreen);
target->show();
if (demoWidget)
{
target->installEventFilter( demoWidget );
}
args->clear();
app.exec();
//.........这里部分代码省略.........