Пример #1
0
void QX::launch_clicked()
{
    int sel = GetClickedId();
    if (sel<0) return;

    DesktopEntry entry = scanner->entries[sel];
    QString appname = entry.file;

    ProfileManager *mngr = new ProfileManager();
    AppProfile prof = mngr->GetAppProfile(appname);
    delete mngr;

#ifdef QTOPIA
    if (prof.antiDim)
    {
        powerConstraint = QtopiaApplication::Disable;
    }
    else if (prof.antiSuspend)
    {
        powerConstraint = QtopiaApplication::DisableSuspend;
    }

    if (prof.gps)
        gpsPower("1");
#endif

    if (prof.init != "")
        system(prof.init.toUtf8().data());

    //if (prof.qvga) { }

    QString cmd = entry.exec;

    if ((prof.wm) || (prof.kbd))
    {
        QString script = "/tmp/.QX_app_launcher.sh";
        QFile f(script);
        if (f.open(QIODevice::WriteOnly))
        {
            f.write("matchbox-window-manager &\n");
            f.write("sleep 5\n");
            if (prof.kbd)
                f.write("matchbox-keyboard &\n");
            f.write(entry.exec.toUtf8());
            f.close();
        }
        cmd = "sh " + script;
    }

    QString applabel = "<b>"+entry.name+"</b><br/>"+entry.exec;
    runApp(cmd, applabel, prof.rotate);
}