/*! * Sets the PSMAutoValue, a boolean that sets if the device should go into power * save mode automatically. This function only changes a value in the GConf * database. */ void BatteryBusinessLogic::setPSMAutoValue ( bool toggle) { MGConfItem PSMAutoKey (psm_auto_key); PSMAutoKey.set (toggle); }
void Ut_CReporterCoreRegistry::testCoreLocationsUpdatedEmission() { QSignalSpy coreLocationsUpdatedSpy(CReporterCoreRegistry::instance(), SIGNAL(coreLocationsUpdated())); MGConfItem *conf = gMGConfItems["/system/osso/af/mmc-cover-open"]; conf->set(QVariant(true)); QTest::qWait( 5100 ); QCOMPARE( coreLocationsUpdatedSpy.count(), 1 ); }
/*! * Sets used power saving option, available are: set power saving off/on * or use a threshold to enable setting saving mode automatically */ void BatteryBusinessLogic::setPSMOption (PowerSaveOpt saveOption) { bool ret = false; MGConfItem PSMAutoKey (psm_auto_key); if (saveOption == PSMAutoAutomatic) { PSMAutoKey.set (true); ret = m_devicemode->setPSMState (MeeGo::QmDeviceMode::PSMStateOff); } else { #ifdef HAVE_QMSYSTEM ret = m_devicemode->setPSMState ( saveOption == PSMAutoOn ? MeeGo::QmDeviceMode::PSMStateOn : MeeGo::QmDeviceMode::PSMStateOff); PSMAutoKey.set (false); if (ret) { m_PowerSaveMode = (saveOption == PSMAutoOn); } #else /* * FIXME: To implement the setting of the power save mode without the help * of the QmSystem library. */ #endif } if (ret) { // Change succeed, we don't need to wait for QmSystem reply, we can emit // the PSMValueChanged asap to update the UI. emit updateUIonPowerSaveModeChange (saveOption); } else { SYS_WARNING ("Failed to set PSM mode to %s", saveOption == PSMAutoOn ? "QmDeviceMode::PSMStateOn" : "QmDeviceMode::PSMStateOff"); } }