/*!
 * 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);
}
SocamFSWidget::SocamFSWidget (QGraphicsWidget *parent) :
        DcpWidget (parent),
        m_logic (0),
        m_MainLayout (0),
        m_TitleLabel (0),
        m_SubTitleLabel (0),
        m_logLevelsCBox (0)
{
    setReferer (DcpDisplay::None);
    setContentsMargins (0, 0, 0, 0);
    m_logic = new SocamFSBusinessLogic;

    /*
     * Lets have these configurable via gconf keys
     */
    MGConfItem eggs(EGGS_GCONF_KEY);

    if (eggs.value().toBool()) {
        m_topCloseChangeable = true;
    } else {
        
        MGConfItem tcs ("/meegotouch/settings/top_swipe_switchable");
        m_topCloseChangeable = tcs.value (false).toBool ();
    }

    initWidget ();
}
bool 
WeatherApplicationExtension::initialize(const QString &){
   QGraphicsObject* mWidget;

   box = new MyMWidget();

   /* D-BUS */
   new MeecastIf(box);
   QDBusConnection connection = QDBusConnection::sessionBus();
   bool ret = connection.registerService("com.meecast.applet");
   ret = connection.registerObject("/com/meecast/applet", box);
   EventFeedIf* client =  new EventFeedIf("com.nokia.home.EventFeed", "/eventfeed",
                                           QDBusConnection::sessionBus(), 0); 
   QObject::connect(client, SIGNAL(refreshRequested()), box, SLOT(refreshRequested()));  

   QTimer::singleShot(1000, box, SLOT(refreshRequested()));

   /* Copy wallpaper */
   if (!(QFile::exists("/home/user/.cache/com.meecast.omweather/wallpaper_MeeCast_original.png"))){
       QDir dir("/home/user/.cache/com.meecast.omweather");
       if (!dir.exists())
           dir.mkpath("/home/user/.cache/com.meecast.omweather");

       MGConfItem *wallpaperItem;
       wallpaperItem = new MGConfItem ("/desktop/meego/background/portrait/picture_filename"); 

       if (QFile::exists(wallpaperItem->value().toString()))
           QFile::copy(wallpaperItem->value().toString(),
                   "/home/user/.cache/com.meecast.omweather/wallpaper_MeeCast_original.png"); 
   }
//   box->startpredeamon();
   return true;
}
/*!
 * Reads the PSMAuto value, a boolean that sets if the device should go into
 * power save mode automatically. This method is only reads the GConf database.
 */
bool
BatteryBusinessLogic::PSMAutoValue ()
{
    MGConfItem PSMAutoKey (psm_auto_key);
    SYS_DEBUG ("value = %s", SYS_BOOL (PSMAutoKey.value ().toBool ()));
    return PSMAutoKey.value ().toBool ();
}
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 );
}
QString 
Wallpaper::logicalIdToFilePath (
        const QString    &id)
{
    QString retval = id;

    if (!id.isEmpty() && !id.startsWith (QDir::separator())) {
        MGConfItem themeItem (Wallpaper::themeNameKey);
        QString    themeName = themeItem.value().toString();

        retval = Wallpaper::themeImagePath.arg(themeName).arg(id);
    }

    SYS_DEBUG ("Returning '%s'", SYS_STR(retval));
    return retval;
}
/*!
 * 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");
    }
}
Exemple #8
0
int main(int argc, char *argv[])
{
    QScopedPointer<QGuiApplication> app (SailfishApp::application(argc, argv));
    QScopedPointer<QQuickView> view (SailfishApp::createView());

    MGConfItem partnerSpaceQml (PARTNERSPACEMANAGER_QML_DCONF);
    QString qmlFile = partnerSpaceQml.value(QString()).toString();
    if (qmlFile.isEmpty()) {
        return 1;
    }
    qDebug() << "Running partner-space launcher with" << qmlFile;

    view->setSource(QUrl(qmlFile));

    // The view is a partner window
    view->create();
    QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
    native->setWindowProperty(view->handle(), QLatin1String("CATEGORY"), QString(QLatin1String("partner")));
    view->show();

    return app->exec();
}
/*!
 * Reads the PSMAuto value, a boolean that sets if the device should go into
 * power save mode automatically. This method is only reads the GConf database.
 */
bool
BatteryBusinessLogic::PSMAutoValue ()
{
    MGConfItem PSMAutoKey (psm_auto_key);
    return PSMAutoKey.value ().toBool ();
}