当前位置: 首页>>代码示例>>C++>>正文


C++ KApplication::disableSessionManagement方法代码示例

本文整理汇总了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();
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:22,代码来源:main.cpp

示例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();

//.........这里部分代码省略.........
开发者ID:fluxer,项目名称:kde-workspace,代码行数:101,代码来源:main.cpp


注:本文中的KApplication::disableSessionManagement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。