Exemplo n.º 1
0
int main(int argc, char *argv[])
{
	KAboutData aboutData( 	"qCheckGMail",
				0,
				ki18n( "qCheckGMail" ),
				"1.0.0",
				ki18n( "a qt based gmail checker" ),
				KAboutData::License_GPL_V2,
				ki18n( "(c)2013,ink Francis\nemail:[email protected]" ),
				ki18n( "*****@*****.**" ),
				"(c)2013,ink Francis\nemail:[email protected]",
				"https://github.com/mhogomchungu/qCheckGMail/issues" );

	KCmdLineArgs::init( argc,argv,&aboutData );

	KCmdLineOptions options;
	options.add( "a",ki18n( "auto start application" ) ) ;
	KCmdLineArgs::addCmdLineOptions( options ) ;
	KUniqueApplication::addCmdLineOptions();

	if( KCmdLineArgs::allArguments().contains( "-a" ) ){
		if( configurationoptionsdialog::autoStartEnabled() ){
			return startApp() ;
		}else{
			return qCheckGMail::autoStartDisabled() ;
		}
	}else{
		return startApp() ;
	}
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
    if (argc == 3)
    {
        if (QString("--detached") == argv[1])
        {
            QProcess::startDetached(pluginDir() + appName + " --standalone " + argv[2]);
            return EXIT_SUCCESS;
        }
        else if (QString("--standalone") == argv[1])
        {
            if (QString("openoffice.org") ==  argv[2] || QString("msoffice") == argv[2])
            {
                return startApp(argc, argv, argv[1]);
            }
            else
            {
                printHelp();
                return EXIT_SUCCESS;
            }
        }

    }
    else if (argc == 1)
    {
        return startApp(argc, argv, "openoffice.org");
    }
    else
    {
        printHelp();
        return EXIT_SUCCESS;
    }
}
Exemplo n.º 3
0
void Application::socketError(QLocalSocket::LocalSocketError e) {
	if (closing) {
		DEBUG_LOG(("Application Error: could not write show command, error %1, quiting..").arg(e));
		return App::quit();
	}

	if (e == QLocalSocket::ServerNotFoundError) {
		DEBUG_LOG(("Application Info: this is the only instance of Telegram, starting server and app.."));
	} else {
		DEBUG_LOG(("Application Info: socket connect error %1, starting server and app..").arg(e));
	}
	socket.close();

	psCheckLocalSocket(serverName);
  
	if (!server.listen(serverName)) {
		DEBUG_LOG(("Application Error: failed to start listening to %1 server").arg(serverName));
		return App::quit();
	}

	if (!cNoStartUpdate() && psCheckReadyUpdate()) {
		cSetRestartingUpdate(true);
		DEBUG_LOG(("Application Info: installing update instead of starting app.."));
		return App::quit();
	}

	startApp();
}
void AppsPageComponent::startOrFocusApp(AppIconButton* appButton) {
  if (debounce) return;
  
  bool shouldStart = true;
  int appIdx = runningAppsByButton[appButton];
  bool hasLaunched = runningApps[appIdx] != nullptr;
  String windowId;
  
  if(hasLaunched) {
    const auto shellWords = split(appButton->shell, " ");
    const auto& cmdName = shellWords[0];
    StringArray findCmd{"xdotool", "search", "--all", "--limit", "1", "--class", cmdName.toRawUTF8()};
    ChildProcess findWindow;
    findWindow.start(findCmd);
    findWindow.waitForProcessToFinish(1000);
    windowId = findWindow.readAllProcessOutput().trimEnd();
    
    // does xdotool find a window id? if so, we shouldn't start a new one
    shouldStart = (windowId.length() > 0) ? false : true;
  }
  
  if (shouldStart) {
    startApp(appButton);
  }
  else {
    focusApp(appButton, windowId);
  }
  
};
Exemplo n.º 5
0
int LightSpeed::AppBase::main_entry( int argc, wchar_t *argv[], ConstStrW pathname)
{
	AutoArray<ConstStrW> params;
	params.reserve(argc);
	for (int i = 0; i < argc; i++)
		params.add(ConstStrW(argv[i]));		
	appPathname = pathname;
	return startApp(Args(params));
}
Exemplo n.º 6
0
int LightSpeed::AppBase::main_entry( int argc, char *argv[], ConstStrW pathname)
{
	AutoArray<String> params;
	AutoArray<ConstStrW> wparams;
	params.reserve(argc);
	for (int i = 0; i < argc; i++)
		params.add(String(argv[i]));

	wparams.append(params);
	appPathname = pathname;
	return startApp(Args(wparams));
}
void MainWindow::createStartAppDialog() {
    startAppDialog = new QDialog( this );
    startAppDialog->setObjectName( "main startapp" );
    startAppDialog->setWindowTitle( "Start new application" );

    // main layout
    QVBoxLayout *layout = new QVBoxLayout( startAppDialog );
    layout->setObjectName("main find");

    // group box with title
    QGroupBox *groupBox = new QGroupBox();
    groupBox->setObjectName("main start app group");
    groupBox->setTitle( "Start Application:" );

    // groupBox layout
    QGridLayout *groupBoxLayout = new QGridLayout( groupBox );
    groupBoxLayout->setObjectName("main start app group");


    // widgets
    startAppDialogTextLineEdit = new QLineEdit(this);

    startAppDialogWithTestability = new QCheckBox( "With -&testability argument" );
    startAppDialogWithTestability->setObjectName("main startapp withtestability");
    startAppDialogWithTestability->setCheckState( Qt::Checked );

    startAppDialogStartButton = new QPushButton( "&Start", this );
    startAppDialogStartButton->setObjectName("main startapp start");
    startAppDialogStartButton->setDisabled(true);
    startAppDialogStartButton->setDefault( false );
    startAppDialogStartButton->setAutoDefault( false );

    startAppDialogCloseButton = new QPushButton( "&Close", this );
    startAppDialogCloseButton->setObjectName("main startapp close");
    startAppDialogCloseButton->setDefault( false );
    startAppDialogCloseButton->setAutoDefault( false );

    // layout placement

    groupBoxLayout->addWidget( startAppDialogTextLineEdit, 0, 0, 1, 3);
    groupBoxLayout->addWidget( startAppDialogWithTestability, 1, 0);
    groupBoxLayout->addWidget( startAppDialogStartButton, 1, 1);
    groupBoxLayout->addWidget( startAppDialogCloseButton, 1, 2 );

    layout->addWidget( groupBox );

    // signals to slots

    connect( startAppDialogTextLineEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( startAppDialogEnableStartButton(const QString &) ) );
    connect( startAppDialogTextLineEdit, SIGNAL( returnPressed() ), this, SLOT( startAppDialogReturnPress() ) );
    connect( startAppDialogStartButton, SIGNAL( clicked() ), this, SLOT( startApp() ) );
    connect( startAppDialogCloseButton, SIGNAL( clicked() ), this, SLOT( closeStartAppDialog() ) );
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Configuration::getInstance()->mainWindow = new Output();
    Output *w = static_cast<Output*>(Configuration::getInstance()->mainWindow); 
//    w.show();
    SplashScreen *splash = new SplashScreen(4000);
    splash->show();
    qDebug()<<w;
    
    Q_ASSERT(SIEmethods::mW);
    
    splash->connect(splash,SIGNAL(startApp()),w,SLOT(start()));
  return a.exec();
}
Exemplo n.º 9
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    for(int i =0 ; i< argc ; i++)
    {
        QString arg(argv[i]);
        if(arg == "rotate" || arg == "-rotate" || arg == "-r")
        {
            //CHECK Value
            if(i < argc-1)
            {
                QString value(argv[i+1]);
                bool success;
                int v = value.toInt(&success);
                if(success){
                    QTransform trans;
                    trans.translate(180,120);
                    trans.rotate(v);
                    trans.translate(-180,-120);
                    Configuration::getInstance()->transform = trans;
                }else
                {
                    qDebug() <<"WARNING: Invalid value for rotate";
                }
            }else
            {
                qDebug()<<"WARNING: You must provide an angle (degrees) after rotate";
            }
        }
    }
    QApplication::setOverrideCursor(Qt::BlankCursor);

    Output *w = new Output(24);
    qDebug()<<w->cursor().pos();
    w->cursor().setPos(320,240);
    SplashScreen *splash = new SplashScreen(3000);

    QFile bold(":fonts/Bold");
    bold.open(QIODevice::ReadOnly);
    int id = QFontDatabase::addApplicationFontFromData(bold.readAll());
    QFont f(QFontDatabase::applicationFontFamilies(id).first());
    QApplication::setFont(f);
    splash->showFullScreen();
    splash->connect(splash,SIGNAL(startApp()),w,SLOT(start()));

  return a.exec();
}
Exemplo n.º 10
0
int main(int argc, char *argv[])
{
    // FIXME: this can be considered a poor man's solution, as it's not
    // directly obvious to a gui user. :)
    // anyway, i vote against removing it even when we have a proper gui
    // implementation.  -- ossi
    const char *duser = ::getenv("ADMIN_ACCOUNT");
    if (duser && duser[0])
        options[3].def = duser;

    KAboutData aboutData("kdesu", I18N_NOOP("KDE su"),
            Version, I18N_NOOP("Runs a program with elevated privileges."),
            KAboutData::License_Artistic,
            "Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio");
    aboutData.addAuthor("Geert Jansen", I18N_NOOP("Maintainer"),
            "*****@*****.**", "http://www.stack.nl/~geertj/");
    aboutData.addAuthor("Pietro Iglio", I18N_NOOP("Original author"),
            "*****@*****.**");

    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication::disableAutoDcopRegistration();
    // kdesu doesn't process SM events, so don't even connect to ksmserver
    QCString session_manager = getenv( "SESSION_MANAGER" );
    unsetenv( "SESSION_MANAGER" );
    KApplication app;
    // but propagate it to the started app
    if (session_manager.data())
    {
        setenv( "SESSION_MANAGER", session_manager.data(), 1 );
    }
    
    {
        KStartupInfoId id;
        id.initId( kapp->startupId());
        id.setupStartupEnv(); // make DESKTOP_STARTUP_ID env. var. available again
    }

    int result = startApp();

    if (result == 127)
    {
        KMessageBox::sorry(0, i18n("Command '%1' not found.").arg(command));
    }

    return result;
}
Exemplo n.º 11
0
int main( int argc, char** argv )
{
    if (( argc < 2) || (argv[1][0] == '-' )) {
        fprintf( stderr, "Usage: dcopstart <application> [url1] [url2] ...\n" );
        exit(0);
    }

    DCOPClient client;
    client.attach();
    dcop = &client;

    QCString app;
    QCString objid;
    QCString function;
    /*char **args = 0;*/
    startApp( argv[1], argc - 2, (const char**)&argv[2] );

    return 0;
}
Exemplo n.º 12
0
CinemaProgress::CinemaProgress()
	: QObject()
	, startAppTimer_(0)
{
	startAppTimer_ = new QTimer(this);
	connect(startAppTimer_, SIGNAL(timeout()), SLOT(startApp()));
	startAppTimer_->setInterval(500);
	startAppTimer_->setSingleShot(true);

	cinemas_ = new CinemaList();
	cinemas_->setCanInitFromWeb(true);
	connect(cinemas_, SIGNAL(progressChanged()), SLOT(progressChanged()));
	QTimer::singleShot(100, cinemas_, SLOT(init()));

	progress_ = new QProgressDialog(trUtf8("Загружаю кинотеатры..."), trUtf8("Отмена"), 0, 0);
	connect(progress_, SIGNAL(canceled()), SLOT(cancel()));
	// progress_->setParent(this);
	progress_->setWindowModality(Qt::WindowModal);
	progress_->show();
}
Exemplo n.º 13
0
int main(void) {
	HAL_Init();

	led_all_init();
	SystemClock_Config();

	if (BSP_ACCELERO_Init() != ACCELERO_OK) {
		Error_Handler();
	}
	BSP_ACCELERO_Click_ITConfig();
	TIM_LED_Config();

	isLooping = 1;
	ledState = LEDS_OFF;

	BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI);

	// Link the USB Host disk I/O driver
	if (FATFS_LinkDriver(&USBH_Driver, usbDrivePath) == 0) {
		USBH_Init(&hUSBHost, usbUserProcess, 0);
		USBH_RegisterClass(&hUSBHost, USBH_MSC_CLASS);
		USBH_Start(&hUSBHost);

		while (1) {
			switch (appState) {
			case APP_START:
				startApp();
				break;
			case APP_IDLE:
			default:
				break;
			}
			USBH_Process(&hUSBHost);
		}
	}

	while (1) {
	}
}
Exemplo n.º 14
0
Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
    serverName(psServerPrefix() + cGUIDStr()), closing(false),
	updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) {

	DEBUG_LOG(("Application Info: creation.."));

	QByteArray d(QDir((cPlatform() == dbipWindows ? cExeDir() : cWorkingDir()).toLower()).absolutePath().toUtf8());
	char h[33] = { 0 };
	hashMd5Hex(d.constData(), d.size(), h);
	serverName = psServerPrefix() + h + '-' + cGUIDStr();

	if (mainApp) {
		DEBUG_LOG(("Application Error: another Application was created, terminating.."));
		exit(0);
	}
	mainApp = this;

	installEventFilter(new _DebugWaiter(this));

#if defined Q_OS_LINUX || defined Q_OS_LINUX64
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/NanumMyeongjo-Regular.ttf"));
#endif
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf"));

	float64 dpi = primaryScreen()->logicalDotsPerInch();
	if (dpi <= 108) { // 0-96-108
		cSetScreenScale(dbisOne);
	} else if (dpi <= 132) { // 108-120-132
		cSetScreenScale(dbisOneAndQuarter);
	} else if (dpi <= 168) { // 132-144-168
		cSetScreenScale(dbisOneAndHalf);
	} else { // 168-192-inf
		cSetScreenScale(dbisTwo);
	}

    if (devicePixelRatio() > 1) {
        cSetRetina(true);
        cSetRetinaFactor(devicePixelRatio());
        cSetIntRetinaFactor(int32(cRetinaFactor()));
    }

	if (!cLangFile().isEmpty()) {
		LangLoaderPlain loader(cLangFile());
		if (!loader.errors().isEmpty()) {
			LOG(("Lang load errors: %1").arg(loader.errors()));
		} else if (!loader.warnings().isEmpty()) {
			LOG(("Lang load warnings: %1").arg(loader.warnings()));
		}
	}

	Local::start();
	style::startManager();
	anim::startManager();
	historyInit();

	DEBUG_LOG(("Application Info: inited.."));

    window = new Window();

	psInstallEventFilter();

	connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
	connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
	connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError)));
	connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64)));
	connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading()));
	connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected()));
	connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication()));
	connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck()));
	connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
	connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
	connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
	connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
	writeUserConfigTimer.setSingleShot(true);

	connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions()));

	if (cManyInstance()) {
		startApp();
	} else {
        DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName));
		socket.connectToServer(serverName);
	}
}
Exemplo n.º 15
0
Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
    serverName(psServerPrefix() + cGUIDStr()), closing(false),
	updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) {
	if (mainApp) {
		DEBUG_LOG(("Application Error: another Application was created, terminating.."));
		exit(0);
	}
	mainApp = this;

	installEventFilter(new _DebugWaiter(this));

    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf"));
    QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf"));

	float64 dpi = primaryScreen()->logicalDotsPerInch();
	if (dpi <= 108) { // 0-96-108
		cSetScreenScale(dbisOne);
	} else if (dpi <= 132) { // 108-120-132
		cSetScreenScale(dbisOneAndQuarter);
	} else if (dpi <= 168) { // 132-144-168
		cSetScreenScale(dbisOneAndHalf);
	} else { // 168-192-inf
		cSetScreenScale(dbisTwo);
	}

    if (devicePixelRatio() > 1) {
        cSetRetina(true);
        cSetRetinaFactor(devicePixelRatio());
        cSetIntRetinaFactor(int32(cRetinaFactor()));
    }

	if (!cLangFile().isEmpty()) {
		LangLoaderPlain loader(cLangFile());
		if (!loader.errors().isEmpty()) {
			LOG(("Lang load errors: %1").arg(loader.errors()));
		} else if (!loader.warnings().isEmpty()) {
			LOG(("Lang load warnings: %1").arg(loader.warnings()));
		}
	}

	style::startManager();
	anim::startManager();
	historyInit();

    window = new Window();

    psInstallEventFilter();

	updateCheckTimer.setSingleShot(true);

	connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
	connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
	connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError)));
	connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64)));
	connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading()));
	connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected()));
	connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication()));
	connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck()));
	connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
	connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
	connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
	writeUserConfigTimer.setSingleShot(true);

    if (cManyInstance()) {
		startApp();
	} else {
        DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName));
		socket.connectToServer(serverName);
	}
}
Exemplo n.º 16
0
int main( int argc, char** argv)
{
   int nRC= 0;
	struct sigaction sigint;
   const char *rendererModule= 0;
   const char *displayName= 0;
   const char *nestedDisplayName= 0;
   bool error= false;
   int len, value, width=-1, height=-1;
   AppCtx *appCtx= 0;
   WstCompositor *wctx;

   appCtx= initApp();
   if ( !appCtx )
   {
      printf("unable to initialize app infrastructure\n");
      nRC= -1;
      goto exit;
   }

   wctx= WstCompositorCreate();
   if ( !wctx )
   {
      printf("unable to create compositor instance\n");
      nRC= -1;
      goto exit;
   }
   
   if ( !WstCompositorSetTerminatedCallback( wctx, compositorTerminated, appCtx ) )
   {
      error= true;
      goto exit;
   }
   
   if ( !WstCompositorSetInvalidateCallback( wctx, compositorInvalidate, appCtx ) )
   {
      error= true;
      goto exit;
   }
   
   if ( !WstCompositorSetDispatchCallback( wctx, compositorDispatch, appCtx ) )
   {
      error= true;
      goto exit;
   }

   for( int i= 1; i < argc; ++i )
   {
      len= strlen(argv[i]);
      if ( (len == 10) && !strncmp( (const char*)argv[i], "--renderer", len) )
      {
         if ( i < argc-1 )
         {
            ++i;
            rendererModule= argv[i];
            
            if ( !WstCompositorSetRendererModule( wctx, rendererModule) )
            {
               error= true;
               break;
            }
         }
      }
      else
      if ( (len == 11) && !strncmp( (const char*)argv[i], "--framerate", len) )
      {
         if ( i < argc-1 )
         {
            int frameRate;
            
            ++i;
            frameRate= atoi(argv[i]);
            if ( frameRate > 0 )
            {
               if ( !WstCompositorSetFrameRate( wctx, frameRate ) )
               {
                  error= true;
                  break;
               }
            }
         }
      }
      else
      if ( (len == 9) && !strncmp( (const char*)argv[i], "--display", len) )
      {
         if ( i < argc-1)
         {
            ++i;
            displayName= argv[i];

            if ( !WstCompositorSetDisplayName( wctx, displayName) )
            {
               error= true;
               break;
            }
         }
      }
      else
      if ( (len == 10) && !strncmp( (const char*)argv[i], "--embedded", len) )
      {
         if ( !WstCompositorSetIsEmbedded( wctx, true) )
         {
            error= true;
            break;
         }
         appCtx->isEmbedded= true;
      }
      else
      if ( (len == 10) && !strncmp( (const char*)argv[i], "--repeater", len) )
      {
         if ( !WstCompositorSetIsRepeater( wctx, true) )
         {
            error= true;
            break;
         }
      }
      else
      if ( (len == 8) && !strncmp( (const char*)argv[i], "--nested", len) )
      {
         if ( !WstCompositorSetIsNested( wctx, true) )
         {
            error= true;
            break;
         }
      }
      else
      if ( (len == 15) && !strncmp( (const char*)argv[i], "--nestedDisplay", len) )
      {
         if ( i < argc-1)
         {
            ++i;
            nestedDisplayName= argv[i];

            if ( !WstCompositorSetNestedDisplayName( wctx, nestedDisplayName) )
            {
               error= true;
               break;
            }
         }
      }
      else
      if ( (len == 13) && !strncmp( (const char*)argv[i], "--nestedInput", len) )
      {
         if ( !WstCompositorSetKeyboardNestedListener( wctx, &keyboardListener, NULL) )
         {
            error= true;
            break;
         }
         if ( !WstCompositorSetPointerNestedListener( wctx, &pointerListener, NULL) )
         {
            error= true;
            break;
         }
      }
      else
      if ( (len == 7) && !strncmp( argv[i], "--width", len) )
      {
         if ( i+1 < argc )
         {
            ++i;
            value= atoi(argv[i]);
            if ( value > 0 )
            {
               width= value;
            }
         }
      }
      else
      if ( (len == 8) && !strncmp( argv[i], "--height", len) )
      {
         if ( i+1 < argc )
         {
            ++i;
            value= atoi(argv[i]);
            if ( value > 0 )
            {
               height= value;
            }
         }
      }
      #if defined (WESTEROS_PLATFORM_EMBEDDED)
      else
      if ( (len == 14) && !strncmp( argv[i], "--enableCursor", len) )
      {
         appCtx->showCursor= true;      
      }
      #endif
      else
      if ( (len == 2) && !strncmp( (const char*)argv[i], "-?", len) )
      {
         showUsage();
         goto exit;
      }
   }
   
   if ( !error )
   {
      #if defined (WESTEROS_PLATFORM_EMBEDDED)
      if  ( !appCtx->showCursor )
      {
         if ( !WstCompositorSetAllowCursorModification( wctx, true ) )
         {
            error= true;
            goto exit;
         }
      }
      #endif
      
      if ( (width > 0) && (height > 0) )
      {
         if ( !WstCompositorSetNestedSize( wctx, width, height) )
         {
            error= true;
            goto exit;
         }
      }

      if ( !rendererModule )
      {
         printf("missing renderer module: use --renderer <module>\n");
         nRC= -1;
         goto exit;
      }
      
      if ( !error )
      {
         if ( !startApp( appCtx, wctx ) )
         {
            printf("error starting application infrastructure, continuing but expect trouble\n" );
         }
      
         g_running= true;
         if ( !(error= !WstCompositorStart( wctx )) )
         {
	         sigint.sa_handler = signalHandler;
	         sigemptyset(&sigint.sa_mask);
	         sigint.sa_flags = SA_RESETHAND;
	         sigaction(SIGINT, &sigint, NULL);

            while( g_running )
            {
               usleep( 10000 );
            }
            
            WstCompositorStop( wctx );
         }
      }
   }
      
exit:

   if ( appCtx )
   {
      termApp( appCtx );
   }
   
   if ( wctx )
   {
      if ( error )
      {
         const char *detail= WstCompositorGetLastErrorDetail( wctx );
         printf("Compositor error: (%s)\n", detail );
      }
      
      WstCompositorDestroy( wctx );
   }

   return nRC;   
}
void
NothingPlayingWidget::oniTunesClicked()
{
    startApp( "/iTunes/iTunes.exe" );
}
Exemplo n.º 18
0
int main(int argc, char *argv[])
{
    // FIXME: this can be considered a poor man's solution, as it's not
    // directly obvious to a gui user. :)
    // anyway, i vote against removing it even when we have a proper gui
    // implementation.  -- ossi

    QByteArray duser = qgetenv("ADMIN_ACCOUNT");
    if (duser.isEmpty())
        duser = "******";

    KAboutData aboutData("kdesu", 0, ki18n("KDE su"),
            Version, ki18n("Runs a program with elevated privileges."),
            KAboutData::License_Artistic,
            ki18n("Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio"));
    aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
            "*****@*****.**", "http://www.stack.nl/~geertj/");
    aboutData.addAuthor(ki18n("Pietro Iglio"), ki18n("Original author"),
            "*****@*****.**");
    aboutData.setProgramIconName("dialog-password");

    KCmdLineArgs::init(argc, argv, &aboutData);

    // NOTE: if you change the position of the -u switch, be sure to adjust it
    // at the beginning of main()
    KCmdLineOptions options;
    options.add("!+command", ki18n("Specifies the command to run as separate arguments"));
    options.add("c <command>", ki18n("Specifies the command to run as one string"));
    options.add("f <file>", ki18n("Run command under target uid if <file> is not writable"));
    options.add("u <user>", ki18n("Specifies the target uid"), duser);
    options.add("n", ki18n("Do not keep password"));
    options.add("s", ki18n("Stop the daemon (forgets all passwords)"));
    options.add("t", ki18n("Enable terminal output (no password keeping)"));
    options.add("p <prio>", ki18n("Set priority value: 0 <= prio <= 100, 0 is lowest"), "50");
    options.add("r", ki18n("Use realtime scheduling"));
    options.add("noignorebutton", ki18n("Do not display ignore button"));
    options.add("i <icon name>", ki18n("Specify icon to use in the password dialog"));
    options.add("d", ki18n("Do not show the command to be run in the dialog"));
#ifdef Q_WS_X11
    /* KDialog originally used --embed for attaching the dialog box.  However this is misleading and so we changed to --attach.
     * For consistancy, we silently map --embed to --attach */
    options.add("attach <winid>", ki18nc("Transient means that the kdesu app will be attached to the app specified by the winid so that it is like a dialog box rather than some separate program", "Makes the dialog transient for an X app specified by winid"));
    options.add("embed <winid>");
#endif
    KCmdLineArgs::addCmdLineOptions(options);

    //KApplication::disableAutoDcopRegistration();
    // kdesu doesn't process SM events, so don't even connect to ksmserver
    QByteArray session_manager = qgetenv( "SESSION_MANAGER" );
    if (!session_manager.isEmpty())
        unsetenv( "SESSION_MANAGER" );
    KApplication app;
    // but propagate it to the started app
    if (!session_manager.isEmpty())
        setenv( "SESSION_MANAGER", session_manager.data(), 1 );

    {
#ifdef Q_WS_X11
        KStartupInfoId id;
        id.initId( kapp->startupId());
        id.setupStartupEnv(); // make DESKTOP_STARTUP_ID env. var. available again
#endif
    }

    int result = startApp();

    if (result == 127)
    {
        KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
    }

    return result;
}
Exemplo n.º 19
0
int main()
{
	//Starting app. startApp() will return 0 if all went good.
	return startApp();
}
void
NothingPlayingWidget::onFoobarClicked()
{
    startApp( "/foobar2000/foobar2000.exe" );
}
void
NothingPlayingWidget::onWMPClicked()
{
    startApp( "/Windows Media Player/wmplayer.exe" );
}
void
NothingPlayingWidget::onWinampClicked()
{
    startApp( "/Winamp/winamp.exe" );
}