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


C++ KConfig::reparseConfiguration方法代码示例

本文整理汇总了C++中KConfig::reparseConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfig::reparseConfiguration方法的具体用法?C++ KConfig::reparseConfiguration怎么用?C++ KConfig::reparseConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KConfig的用法示例。


在下文中一共展示了KConfig::reparseConfiguration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readSettings

void Pager::readSettings()
{
    KConfig *config = kapp->getConfig();
    config->reparseConfiguration();
    config->setGroup("GUI Settings");

    // Size
    QString entry = config->readEntry("Size", "100 100");
    QTextStream str(entry, IO_ReadOnly);
    int w, h;
    str >> w >> h;
    entry.sprintf("%d %d",w,h);
    config->writeEntry("Size", entry);
    resize(w,h);

    // Geometry
    entry = config->readEntry("Geometry", PosStrings[0]);
    position = Costumized;
    for (int i=0; i<5;i++)
      if (entry == PosStrings[i])
        position = (Position)i;
    
    if (position == Costumized) {
      QTextStream s(entry, IO_ReadOnly);
      s >> posx >> posy;
      entry.sprintf("%d %d",posx, posy);
    }
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:27,代码来源:pager.cpp

示例2: enableAutoStart

/******************************************************************************
* DCOP call to set autostart at login on or off.
*/
void ADConfigData::enableAutoStart(bool on)
{
    kdDebug(5900) << "ADConfigData::enableAutoStart(" << on << ")\n";
    KConfig *config = KGlobal::config();
    config->reparseConfiguration();
    config->setGroup(QString::fromLatin1(DAEMON_AUTOSTART_SECTION));
    config->writeEntry(QString::fromLatin1(DAEMON_AUTOSTART_KEY), on);
    config->sync();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:12,代码来源:adconfigdata.cpp

示例3: shutdown

void KSMServer::shutdown( KApplication::ShutdownConfirm confirm,
    KApplication::ShutdownType sdtype, KApplication::ShutdownMode sdmode )
{
    pendingShutdown.stop();
    if( dialogActive )
        return;
    if( state >= Shutdown ) // already performing shutdown
        return;
    if( state != Idle ) // performing startup
    {
    // perform shutdown as soon as startup is finished, in order to avoid saving partial session
        if( !pendingShutdown.isActive())
        {
            pendingShutdown.start( 1000 );
            pendingShutdown_confirm = confirm;
            pendingShutdown_sdtype = sdtype;
            pendingShutdown_sdmode = sdmode;
        }
        return;
    }

    KConfig *config = KGlobal::config();
    config->reparseConfiguration(); // config may have changed in the KControl module

    config->setGroup("General" );
    bool logoutConfirmed =
        (confirm == KApplication::ShutdownConfirmYes) ? false :
       (confirm == KApplication::ShutdownConfirmNo) ? true :
                  !config->readBoolEntry( "confirmLogout", true );
    bool maysd = false;
    if (config->readBoolEntry( "offerShutdown", true ) && DM().canShutdown())
        maysd = true;
    if (!maysd) {
        if (sdtype != KApplication::ShutdownTypeNone &&
            sdtype != KApplication::ShutdownTypeDefault &&
            logoutConfirmed)
            return; /* unsupported fast shutdown */
        sdtype = KApplication::ShutdownTypeNone;
    } else if (sdtype == KApplication::ShutdownTypeDefault)
        sdtype = (KApplication::ShutdownType)
                 config->readNumEntry( "shutdownType", (int)KApplication::ShutdownTypeNone );
    if (sdmode == KApplication::ShutdownModeDefault)
        sdmode = KApplication::ShutdownModeInteractive;

    dialogActive = true;
    QString bopt;
    if ( !logoutConfirmed ) {
        KSMShutdownFeedback::start(); // make the screen gray
        logoutConfirmed =
            KSMShutdownDlg::confirmShutdown( maysd, sdtype, bopt );
        // ###### We can't make the screen remain gray while talking to the apps,
        // because this prevents interaction ("do you want to save", etc.)
        // TODO: turn the feedback widget into a list of apps to be closed,
        // with an indicator of the current status for each.
        KSMShutdownFeedback::stop(); // make the screen become normal again
    }

    if ( logoutConfirmed ) {

	shutdownType = sdtype;
	shutdownMode = sdmode;
	bootOption = bopt;

        // shall we save the session on logout?
        saveSession = ( config->readEntry( "loginMode", "restorePreviousLogout" ) == "restorePreviousLogout" );

        if ( saveSession )
            sessionGroup = QString("Session: ") + SESSION_PREVIOUS_LOGOUT;

        // Set the real desktop background to black so that exit looks
        // clean regardless of what was on "our" desktop.
        kapp->desktop()->setBackgroundColor( Qt::black );
        state = Shutdown;
        wmPhase1WaitingCount = 0;
        saveType = saveSession?SmSaveBoth:SmSaveGlobal;
	performLegacySessionSave();
        startProtection();
        for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
            c->resetState();
            // Whoever came with the idea of phase 2 got it backwards
            // unfortunately. Window manager should be the very first
            // one saving session data, not the last one, as possible
            // user interaction during session save may alter
            // window positions etc.
            // Moreover, KWin's focus stealing prevention would lead
            // to undesired effects while session saving (dialogs
            // wouldn't be activated), so it needs be assured that
            // KWin will turn it off temporarily before any other
            // user interaction takes place.
            // Therefore, make sure the WM finishes its phase 1
            // before others a chance to change anything.
            // KWin will check if the session manager is ksmserver,
            // and if yes it will save in phase 1 instead of phase 2.
            if( isWM( c )) {
                ++wmPhase1WaitingCount;
                SmsSaveYourself( c->connection(), saveType,
                             true, SmInteractStyleAny, false );
            }

        }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: shutdown

void KSMServer::shutdown(KApplication::ShutdownConfirm confirm, KApplication::ShutdownType sdtype, KApplication::ShutdownMode sdmode)
{
    pendingShutdown.stop();
    if(dialogActive)
        return;
    if(state >= Shutdown) // already performing shutdown
        return;
    if(state != Idle) // performing startup
    {
        // perform shutdown as soon as startup is finished, in order to avoid saving partial session
        if(!pendingShutdown.isActive())
        {
            pendingShutdown.start(1000);
            pendingShutdown_confirm = confirm;
            pendingShutdown_sdtype = sdtype;
            pendingShutdown_sdmode = sdmode;
        }
        return;
    }

    KConfig *config = KGlobal::config();
    config->reparseConfiguration(); // config may have changed in the KControl module

    config->setGroup("General");
    bool logoutConfirmed = (confirm == KApplication::ShutdownConfirmYes) ? false : (confirm == KApplication::ShutdownConfirmNo)
                                                                                       ? true
                                                                                       : !config->readBoolEntry("confirmLogout", true);

    bool mayShutdown = (config->readBoolEntry("offerShutdown", true) && DM().canShutdown());
    bool maySuspend = config->readBoolEntry("offerSuspend", true);
    bool mayHibernate = config->readBoolEntry("offerHibernate", true);
    bool lockBeforeSuspendHibernate = config->readBoolEntry("lockBeforeSuspendHibernate", true);

    // FIXME At this moment we can't query for SuspendAllowed/HibernateAllowed because
    //       we haven't support for ConsoleKit yet

    // query upower for suspend/hibernate capability
    QDBusConnection dbusConnection;
    if(maySuspend || mayHibernate)
    {

        dbusConnection = QDBusConnection::addConnection(QDBusConnection::SystemBus);

        if(dbusConnection.isConnected())
        {

            // can suspend?
            if(maySuspend)
            {
#ifdef WITH_LOGIND
                QDBusMessage dbusMessage = QDBusMessage::methodCall(DBUS_UPOWER_SERVICE, DBUS_UPOWER_PATH, DBUS_UPOWER_INTERFACE, "CanSuspend");
#else
                QDBusMessage dbusMessage = QDBusMessage::methodCall(DBUS_UPOWER_SERVICE, DBUS_UPOWER_PATH, DBUS_PROPERTIES_INTERFACE, "Get");
                dbusMessage << QDBusData::fromString(DBUS_UPOWER_INTERFACE) << QDBusData::fromString("CanSuspend");
#endif

                QDBusMessage dbusReply = dbusConnection.sendWithReply(dbusMessage);

                if(dbusReply.type() == QDBusMessage::ReplyMessage && dbusReply.count() == 1)
#ifdef WITH_LOGIND
                    maySuspend = ("yes" == dbusReply[0].toString());
#else
                    maySuspend = dbusReply[0].toVariant().value.toBool();
#endif
                else
                {
                    maySuspend = false;
                    kdDebug() << "[dbus/upower] CanSuspend: " << dbusConnection.lastError().message() << "\n";
                }
            }

            // can hibernate?
            if(mayHibernate)
            {
#ifdef WITH_LOGIND
                QDBusMessage dbusMessage = QDBusMessage::methodCall(DBUS_UPOWER_SERVICE, DBUS_UPOWER_PATH, DBUS_UPOWER_INTERFACE, "CanHibernate");
#else
                QDBusMessage dbusMessage = QDBusMessage::methodCall(DBUS_UPOWER_SERVICE, DBUS_UPOWER_PATH, DBUS_PROPERTIES_INTERFACE, "Get");
                dbusMessage << QDBusData::fromString(DBUS_UPOWER_INTERFACE) << QDBusData::fromString("CanHibernate");
#endif

                QDBusMessage dbusReply = dbusConnection.sendWithReply(dbusMessage);

                if(dbusReply.type() == QDBusMessage::ReplyMessage && dbusReply.count() == 1)
#ifdef WITH_LOGIND
                    mayHibernate = ("yes" == dbusReply[0].toString());
#else
                    mayHibernate = dbusReply[0].toVariant().value.toBool();
#endif
                else
                {
                    mayHibernate = false;
                    kdDebug() << "[dbus/upower] CanHibernate: " << dbusConnection.lastError().message() << "\n";
                }
            }
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:95,代码来源:shutdown.cpp


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