int main(int argc, char **argv)
{
    KAboutData about("khotnewstuff", 0, ki18n("KHotNewStuff"), "0.4");
    about.setProgramIconName("get-hot-new-stuff");
    KCmdLineArgs *args;

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

    KCmdLineOptions op;
    op.add("+filename", ki18n("Name of .knsrc file to use"));
    op.add("+filename", ki18n("Name of file to upload"));
    KCmdLineArgs::addCmdLineOptions(op);
    args = KCmdLineArgs::parsedArgs();

    KApplication i;
    
    if (args->count() > 0) {
        KNS3::UploadDialog dialog(args->arg(0));
        if (args->count() > 1) {
            dialog.setUploadFile(KUrl(args->arg(1)));
        }
        dialog.exec();
    }
    else
    {
        args->usage();
        return -1;
    }
    return 0;
}
Beispiel #2
0
int main(int argc, char **argv)
{
    KAboutData aboutData("kstartperf", 0, ki18n("KStartPerf"),
	    "1.0", ki18n("Measures start up time of a KDE application"),
	    KAboutData::License_Artistic,
	    ki18n("Copyright (c) 2000 Geert Jansen and libkmapnotify authors"));
    aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
	    "*****@*****.**", "http://www.stack.nl/~geertj/");

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

    KCmdLineOptions options;
    options.add("+command", ki18n("Specifies the command to run"));
    options.add("!+[args]", ki18n("Arguments to 'command'"));
    KCmdLineArgs::addCmdLineOptions(options);
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    KComponentData componentData( &aboutData );
    QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

    // Check arguments

    if (args->count() == 0)
    {
	fprintf(stderr, "No command specified!\n");
	fprintf(stderr, "usage: kstartperf command [arguments]\n");
	exit(1);
    }

    // Build command

    char cmd[1024];
    snprintf(cmd, sizeof(cmd), "LD_PRELOAD=%s %s", 
             qPrintable( libkstartperf() ), qPrintable(args->arg(0)));
    for (int i=1; i<args->count(); i++)
    {
	strcat(cmd, " ");
	strcat(cmd, args->arg(i).toLocal8Bit());
    }

    // Put the current time in the environment variable `KSTARTPERF'

    struct timeval tv;
    if (gettimeofday(&tv, 0L) != 0)
    {
	perror("gettimeofday()");
	exit(1);
    }
    char env[100];
    sprintf(env, "KSTARTPERF=%ld:%ld", tv.tv_sec, tv.tv_usec);
    putenv(env);

    // And exec() the command

    execl("/bin/sh", "sh", "-c", cmd, (void *)0);

    perror("execl()");
    exit(1);
}
Beispiel #3
0
int main (int argc, char **argv)
{
  KCmdLineOptions options;
  options.add("+[directory ...]", ki18n("Directory(ies) to watch"));

  KCmdLineArgs::init(argc, argv, "kdirwatchtest", 0, ki18n("KDirWatchTest"),
		     "1.0", ki18n("Test for KDirWatch"));
  KCmdLineArgs::addCmdLineOptions( options );
  KCmdLineArgs::addStdCmdLineOptions();

  QCoreApplication a(argc, argv);
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  myTest testObject;

  KDirWatch *dirwatch1 = KDirWatch::self();
  KDirWatch *dirwatch2 = new KDirWatch;

  testObject.connect(dirwatch1, SIGNAL(dirty(QString)), SLOT(dirty(QString)) );
  testObject.connect(dirwatch1, SIGNAL(created(QString)), SLOT(created(QString)) );
  testObject.connect(dirwatch1, SIGNAL(deleted(QString)), SLOT(deleted(QString)) );

  if (args->count() >0) {
    for(int i = 0; i < args->count(); i++) {
      kDebug() << "Watching: " << args->arg(i);
      dirwatch2->addDir( args->arg(i));
    }
  }

  QString home = QString(getenv ("HOME")) + '/';
  QString desk = home + "Desktop/";
  kDebug() << "Watching: " << home;
  dirwatch1->addDir(home);
  kDebug() << "Watching file: " << home << "foo ";
  dirwatch1->addFile(home+"foo");
  kDebug() << "Watching: " << desk;
  dirwatch1->addDir(desk);
  QString test = home + "test/";
  kDebug() << "Watching: (but skipped) " << test;
  dirwatch1->addDir(test);

  dirwatch1->startScan();
  dirwatch2->startScan();

  if(!dirwatch1->stopDirScan(home))
      kDebug() << "stopDirscan: " << home << " error!";
  if(!dirwatch1->restartDirScan(home))
      kDebug() << "restartDirScan: " << home << "error!";
  if (!dirwatch1->stopDirScan(test))
     kDebug() << "stopDirScan: error";

  KDirWatch::statistics();

  delete dirwatch2;

  KDirWatch::statistics();

  return a.exec();
}
Beispiel #4
0
int main(int argc, char **argv) {
	static KCmdLineOptions options[] = {
		{"show", I18N_NOOP("Show window on startup"), 0},
		{"kwalletd", I18N_NOOP("For use by kwalletd only"), 0},
		{"+name", I18N_NOOP("A wallet name"), 0},
		KCmdLineLastOption
	};

	KAboutData about("kwalletmanager", I18N_NOOP("KDE Wallet Manager"), "1.1",
		I18N_NOOP("KDE Wallet Management Tool"),
		KAboutData::License_GPL,
		I18N_NOOP("(c) 2003,2004 George Staikos"), 0,
		"http://www.kde.org/");

	about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "*****@*****.**");
	about.addAuthor("Isaac Clerencia", I18N_NOOP("Developer"), "*****@*****.**");

	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions(options);

	if (!KUniqueApplication::start()) {
		return 0;
	}

	MyApp a;

	KWalletManager wm;
	wm.setCaption(i18n("KDE Wallet Manager"));

	a.setMainWidget(&wm);

	KGlobal::dirs()->addResourceType("kwallet", "share/apps/kwallet");

	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	if (args->isSet("show")) {
		wm.show();
	}

	if (args->isSet("kwalletd")) {
		wm.kwalletdLaunch();
	}

	for (int i = 0; i < args->count(); ++i) {
		QString fn = QFileInfo(args->arg(i)).absFilePath();
		KMimeType::Ptr ptr;
		if (QFile::exists(fn) &&
			(ptr = KMimeType::findByFileContent(fn)) &&
			ptr->is("application/x-kde-wallet")) {
			wm.openWalletFile(fn);
		} else {
			wm.openWallet(args->arg(i));
		}
	}
	args->clear();
	return a.exec();
}
Beispiel #5
0
int main(int argc, char **argv)
{
    KAboutData about(QByteArray("microbe"), QByteArray("languages"), ki18n("Microbe"),
                     QByteArray(version), ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2004-2005, The KTechLab developers"),
                     KLocalizedString(), QByteArray("http://ktechlab.org"),
                     QByteArray("*****@*****.**") );
    about.addAuthor( ki18n("Daniel Clarke"), KLocalizedString(),
                     QByteArray("*****@*****.**") );
    about.addAuthor( ki18n("David Saxton"), KLocalizedString(),
                     QByteArray("*****@*****.**") );
    about.addAuthor( ki18n("Modified to add pic 16f877,16f627 and 16f628 by George John"),
                     KLocalizedString(), QByteArray("*****@*****.**") );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineOptions o;
    o.add( QByteArray("show-source"),
           ki18n( "Show source code lines in assembly output") );
    o.add( QByteArray("nooptimize"),
           ki18n( "Do not attempt optimization of generated instructions.") );
    o.add( QByteArray("+[Input URL]"),
           ki18n( "Input filename" ) );
    o.add( QByteArray("+[Output URL]"),
           ki18n( "Output filename" ) );

    KCmdLineArgs::addCmdLineOptions(o);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->count() == 2 )
    {
        Microbe mb;
//      QString s = mb.compile( args->arg(0), args->isSet("show-source"), args->isSet("optimize"));

        QString s = mb.compile( args->arg(0), args->isSet("optimize"));

        QString errorReport = mb.errorReport();

        if ( !errorReport.isEmpty() )
        {
            kError() << errorReport;
            return 1; // If there was an error, don't write the output to file.
        }

        else
        {
            QFile outFile(args->arg(1));
            outFile.open(QIODevice::WriteOnly);
            QDataStream out(&outFile);
            out << s;
            return 0;
        }
    }
    else args->usage();
}
Beispiel #6
0
int main(int argc, char *argv[])
{
  KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KXSConfig"), description, version);

  KCmdLineArgs::addCmdLineOptions(options);

  KApplication app;

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  if(args->count()==0)
    exit(1);

  /* We must read exactly the same resources as xscreensaver.
     That means we must have both the same progclass *and* progname,
     at least as far as the resource database is concerned.  So,
     put "xscreensaver" in argv[0] while initializing Xt.
   */
  const char *dummyargs[] = { "xscreensaver" };
  int dummyargc = 1;
  progname = dummyargs[0];

  // Teach Xt to use the Display that TQt has already opened.
  XtToolkitInitialize ();
  XtAppContext xtApp = XtCreateApplicationContext ();
  Display *dpy = qt_xdisplay();
  XtAppSetFallbackResources (xtApp, const_cast<char**>(defaults));
  XtDisplayInitialize (xtApp, dpy, progname, progclass, 0, 0,
                       &dummyargc,
                       const_cast<char**>(dummyargs));
  Widget toplevel_shell = XtAppCreateShell (progname, progclass,
	  applicationShellWidgetClass,
	  dpy, 0, 0);
  dpy = XtDisplay (toplevel_shell);
  db = XtDatabase (dpy);
  XtGetApplicationNameAndClass (dpy, const_cast<char**>(&progname),
                                const_cast<char**>(&progclass));

  TQString name = TQString::fromLocal8Bit(args->arg(args->count() - 1));
  KXSConfigDialog *dialog=new KXSConfigDialog(args->arg(0), name);
  if ( dialog->create() ) {
      dialog->show();
      app.setMainWidget(dialog);
      app.exec();
  } else {
      KMessageBox::sorry(0,
	      i18n("No configuration available for %1").tqarg(name),
	      name );
  }

  delete dialog;
}
Beispiel #7
0
 virtual int newInstance()
 {
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (args->count() > 0)
    {
        menuEdit->selectMenu(args->arg(0));
        if (args->count() > 1)
        {
            menuEdit->selectMenuEntry(args->arg(1));
        }
    }
    args->clear();
    return KUniqueApplication::newInstance();
 }
Beispiel #8
0
int main( int argc, char **argv )
{
  KAboutData aboutData( "testvcalexport", 0,
                        ki18n( "Part of LibKCal's test suite. Checks if export "
                               "to vCalendar still works correctly." ), "0.1" );
  KCmdLineArgs::init( argc, argv, &aboutData );

  KCmdLineOptions options;
  options.add( "verbose", ki18n( "Verbose output" ) );
  options.add( "+input", ki18n( "Name of input file" ) );
  options.add( "+output", ki18n( "Name of output file" ) );
  KCmdLineArgs::addCmdLineOptions( options );

  KComponentData componentData( &aboutData );
  //QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  if ( args->count() != 2 ) {
    args->usage( "Wrong number of arguments." );
  }

  QString input = args->arg( 0 );
  QString output = args->arg( 1 );

  QFileInfo outputFileInfo( output );
  output = outputFileInfo.absoluteFilePath();

  kDebug() << "Input file:" << input;
  kDebug() << "Output file:" << output;

  MemoryCalendar::Ptr cal( new MemoryCalendar( KDateTime::UTC ) );
  FileStorage instore( cal, input );

  if ( !instore.load() ) {
    return 1;
  }
  QString tz = cal->nonKDECustomProperty( "X-LibKCal-Testsuite-OutTZ" );
  if ( !tz.isEmpty() ) {
    cal->setViewTimeZoneId( tz );
  }

  FileStorage outstore( cal, output, new VCalFormat );
  if ( !outstore.save() ) {
    return 1;
  }

  return 0;
}
Beispiel #9
0
int main( int argc, char **argv )
{
  KAboutData aboutData( "khc_indexbuilder", 0,
                        ki18n("KHelpCenter Index Builder"),
                        HELPCENTER_VERSION,
                        ki18n("The KDE Help Center"),
                        KAboutData::License_GPL,
                        ki18n("(c) 2003, The KHelpCenter developers") );

  aboutData.addAuthor( ki18n("Cornelius Schumacher"), KLocalizedString(), "*****@*****.**" );

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

  KCmdLineOptions options;
  options.add("+cmdfile", ki18n("Document to be indexed"));
  options.add("+indexdir", ki18n("Index directory"));
  KCmdLineArgs::addCmdLineOptions( options );

  // Note: no KComponentData seems necessary
  QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  if ( args->count() != 2 ) {
    kDebug(1402) << "Wrong number of arguments.";
    return 1;
  }

  QString cmdFile = args->arg( 0 );
  QString indexDir = args->arg( 1 );

  kDebug(1402) << "cmdFile: " << cmdFile;
  kDebug(1402) << "indexDir: " << indexDir;

  QFile file( indexDir + "/testaccess" );
  if ( !file.open( QIODevice::WriteOnly ) || !file.putChar( ' ' ) ) {
    kDebug(1402) << "access denied";
    return 2;
  } else {
    kDebug(1402) << "can access";
    file.remove();
  }

  IndexBuilder builder(cmdFile);

  QTimer::singleShot(0, &builder, SLOT(buildIndices()));

  return app.exec();
}
Beispiel #10
0
    int KDE_EXPORT kdemain( int argc, char **argv )
    {
        // KApplication is necessary to use other ioslaves
        putenv(strdup("SESSION_MANAGER="));
        KCmdLineArgs::init(argc, argv, "kio_media", 0, 0, 0, 0);
        KCmdLineArgs::addCmdLineOptions( options );
        KApplication app( false, false );
        // We want to be anonymous even if we use DCOP
        app.dcopClient()->attach();

        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        MediaProtocol slave( args->arg(0), args->arg(1), args->arg(2) );
        slave.dispatchLoop();
        return 0;
    }
Beispiel #11
0
int KDE_EXPORT kdemain(int argc, char **argv)
{
    // KInstance instance( "kio_trash" );
    // KApplication is necessary to use kio_file
    putenv(strdup("SESSION_MANAGER="));
    KApplication::disableAutoDcopRegistration();
    KCmdLineArgs::init(argc, argv, "kio_trash", 0, 0, 0, 0);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app(false, false);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    TrashProtocol slave(args->arg(0), args->arg(1), args->arg(2));
    slave.dispatchLoop();
    return 0;
}
Beispiel #12
0
int Application::newInstance()
{
    KUniqueApplication::newInstance();

    // Open the basket archive or template file supplied as argument:
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (args && args->count() >= 1) {
        QString fileName = args->arg(args->count() - 1);

        if (QFile::exists(fileName)) {
            QFileInfo fileInfo(fileName);
            if (fileInfo.absoluteFilePath().contains(Global::basketsFolder())) {
                QString folder = fileInfo.absolutePath().split("/").last();
                folder.append("/");
                BNPView::s_basketToOpen = folder;
                QTimer::singleShot(100, Global::bnpView, SLOT(delayedOpenBasket()));
            } else if (!fileInfo.isDir()) { // Do not mis-interpret data-folder param!
                // Tags are not loaded until Global::bnpView::lateInit() is called.
                // It is called 0ms after the application start.
                BNPView::s_fileToOpen = fileName;
                QTimer::singleShot(100, Global::bnpView, SLOT(delayedOpenArchive()));
//              Global::bnpView->openArchive(fileName);
                args->clear();
            }
        }
    }
    return 0;
}
Beispiel #13
0
int main(int argc, char **argv)
{
    const char *version = "0.5";
    KLocalizedString description = ki18n("Unit test for .netrc and kionetrc parser.");
    KCmdLineOptions options;
    options.add("+command", ki18n("[url1,url2 ,...]"));

    KCmdLineArgs::init( argc, argv, "kionetrctest", 0, ki18n("KIO-netrc-test"), version, description );
    KCmdLineArgs::addCmdLineOptions( options );
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    int count = args->count();
    KApplication app;

    if ( !count )
        args->usage();
    else
    {
        KUrl u;
        for( int i=0 ; i < count; i++ )
        {
            u = args->arg(i);
            if ( !u.isValid() )
            {
                kDebug() << u.url() << " is invalid! Ignoring...";
                continue;
            }
            output( u );
        }
    }
    args->clear();
    return 0;
}
int main( int argc, char *argv[] )
{
	KAboutData aboutData( "kopetewallettest", 0, ki18n("kopetewallettest"), "version" );
	KCmdLineArgs::init( argc, argv, &aboutData );

	KCmdLineOptions opts;
	opts.add("+action");
	KCmdLineArgs::addCmdLineOptions( opts );
	KApplication app( "kopetewallettest" );

	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	// must register with DCOP or async callbacks will fail
	_out << "DCOP registration returned " << app.dcopClient()->registerAs(app.name()) << endl;

	for( int i = 0; i < args->count(); ++i )
	{
		QString arg = args->arg( i );
		_out << "Processing " << arg << endl;
		if( arg == QString::fromLatin1( "open" ) ) openWalletAsync();
		if( arg == QString::fromLatin1( "close" ) ) closeWallet();
		if( arg == QString::fromLatin1( "delay" ) ) delay();
		_out << "Done." << endl;
	}

	WalletReciever *r = new WalletReciever;

	QTimer timer;
	r->connect( &timer, SIGNAL(timeout()), SLOT(timer()) );
	timer.start( 1000 );

	_out << "About to start 30 second event loop" << endl;
	QTimer::singleShot( 30000, qApp, SLOT(quit()) );
	return qApp->exec();
}
Beispiel #15
0
int
main(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, "krootimage", "kdmgreet",
                       ki18n("KRootImage"), QByteArray(),
                       ki18n("Fancy desktop background for kdm"));

    KCmdLineOptions options;
    options.add("+config", ki18n("Name of the configuration file"));
    KCmdLineArgs::addCmdLineOptions(options);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (!args->count())
        args->usage();
    KComponentData inst(KCmdLineArgs::aboutData());
    MyApplication app(args->arg(0).toLocal8Bit(),
                      KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv());
    args->clear();

    app.exec();
    app.flush();

    // Keep color resources after termination
    XSetCloseDownMode(QX11Info::display(), RetainTemporary);

    return 0;
}
int main(int argc, char **argv)
{
    KAboutData aboutData("khc_indexbuilder", I18N_NOOP("KHelpCenter Index Builder"), HELPCENTER_VERSION, I18N_NOOP("The KDE Help Center"),
                         KAboutData::License_GPL, I18N_NOOP("(c) 2003, The KHelpCenter developers"));

    aboutData.addAuthor("Cornelius Schumacher", 0, "*****@*****.**");

    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);
    KUniqueApplication::addCmdLineOptions();

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if(args->count() != 2)
    {
        kdDebug(1402) << "Wrong number of arguments." << endl;
        return 1;
    }

    QString cmdFile = args->arg(0);
    QString indexDir = args->arg(1);

    kdDebug(1402) << "cmdFile: " << cmdFile << endl;
    kdDebug(1402) << "indexDir: " << indexDir << endl;

    QFile file(indexDir + "/testaccess");
    if(!file.open(IO_WriteOnly) || file.putch(' ') < 0)
    {
        kdDebug(1402) << "access denied" << endl;
        return 2;
    }
    else
    {
        kdDebug(1402) << "can access" << endl;
        file.remove();
    }

    app.dcopClient()->registerAs("khc_indexbuilder", false);

    IndexBuilder builder(cmdFile);

    QTimer::singleShot(0, &builder, SLOT(buildIndices()));

    return app.exec();
}
Beispiel #17
0
int main(int argc, char **argv)
{
    KAboutData about("khipu", "gplacs", ki18n(I18N_NOOP("Khipu")), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2010-2012, Percy Camilo Triveño Aucahuasi"));

    about.addAuthor(ki18n("Percy Camilo Triveño Aucahuasi"), ki18n("Main developer"), "*****@*****.**");

    about.addCredit(ki18n("Punit Mehta"), ki18n("GSoC-2013 student - Persistance file support. Plot-dictionary support. Worked for application actions, command-line improvements and space filtering. Several bug fixings"), "*****@*****.**");
    about.addCredit(ki18n("Manuel Álvarez Blanco"), ki18n("Thesis mentor - Guide and supervision during project conception. Bibliographical support. Numeric Mathematics and Algorithms support"), "");
    about.addCredit(ki18n("José Ignacio Cuevas Gonzáles"), ki18n("Thesis mentor - Supervision, Product Guide, Product promotion and former Client"), "*****@*****.**");
    about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "*****@*****.**");
    about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "*****@*****.**");

    about.addCredit(ki18n("Aleix Pol Gonzalez"), ki18n("KAlgebra and Analitza parser author, both vitals for the project"));

    about.addCredit(ki18n("José Fernando Ramos Ramirez"), ki18n("First version of Famous Curves Database. Build former windows installer"), "*****@*****.**");
    about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "*****@*****.**");

    about.addCredit(ki18n("Edgar Velasquez"), ki18n("2D Improvements"));
    about.addCredit(ki18n("Jose Torres Cardenas"), ki18n("3D Improvements"));
    about.addCredit(ki18n("Elizabeth Portilla Flores"), ki18n("3D Improvements"));
    about.addCredit(ki18n("Paul Murat Landauro Minaya"), ki18n("3D Improvements"));

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

    KCmdLineOptions options;
    options.add("+[URL]", ki18n( "A Khipu-file to open" ));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    MainWindow *mainWindow = new MainWindow;

    if (app.isSessionRestored()) {
        RESTORE(MainWindow)
    } else {
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0) {
            mainWindow->checkforAutoSavedFile();
            mainWindow->show();
        } else {
            int i = 0;
            bool exit = false;
            for (; i < args->count(); i++) {
                if (i==0) {
                    if(args->arg(0)!="ignoreautosavedfile"){
                        if (!(mainWindow->openFile(args->url(0).path())))
                            exit = true;
                    }
                }
                mainWindow->show();
            }
            if (exit)
                mainWindow->deleteLater(); // can't open a khipu file, so just exit !
        }
        args->clear();
    }
    return app.exec();
}
Beispiel #18
0
int main(int argc, char **argv)
{
    KAboutData data("kwebdesktop", I18N_NOOP("KDE Web Desktop"), VERSION, I18N_NOOP("Displays an HTML page as the background of the desktop"),
                    KAboutData::License_GPL, "(c) 2000, David Faure <*****@*****.**>");
    data.addAuthor("David Faure", I18N_NOOP("developer and maintainer"), "*****@*****.**");

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

    KCmdLineArgs::addCmdLineOptions(options); // Add our own options.

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if(args->count() != 3 && args->count() != 4)
    {
        args->usage();
        return 1;
    }
    const int width = QCString(args->arg(0)).toInt();
    const int height = QCString(args->arg(1)).toInt();
    QCString imageFile = args->arg(2);
    QString url;
    if(args->count() == 4)
        url = QString::fromLocal8Bit(args->arg(3));

    KWebDesktop *webDesktop = new KWebDesktop(0, imageFile, width, height);

    if(url.isEmpty())
        url = KWebDesktopSettings::uRL();
    // Apply uri filter
    KURIFilterData uridata = url;
    KURIFilter::self()->filterURI(uridata);
    KURL u = uridata.uri();

    // Now start getting, to ensure mimetype and possible connection
    KWebDesktopRun *run = new KWebDesktopRun(webDesktop, u);

    int ret = app.exec();

    KIO::SimpleJob::removeOnHold(); // Kill any slave that was put on hold.
    delete webDesktop;
    delete run;
    // khtml::Cache::clear();

    return ret;
}
Beispiel #19
0
int main(int argc, char **argv)
{
    KAboutData aboutData("kdepasswd", 0, ki18n("KDE passwd"),
            KDE_VERSION_STRING, ki18n("Changes a UNIX password."),
            KAboutData::License_Artistic, ki18n("Copyright (c) 2000 Geert Jansen"));
    aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
            "*****@*****.**");
    aboutData.setProgramIconName( "preferences-desktop-user-password" );

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

    KCmdLineOptions options;
    options.add("+[user]", ki18n("Change password of this user"));
    KCmdLineArgs::addCmdLineOptions(options);
    KUniqueApplication::addCmdLineOptions();


    if (!KUniqueApplication::start()) {
        kDebug() << "kdepasswd is already running";
        return 2;
    }

    KUniqueApplication app;

    KUser ku;
    QString user;
    bool bRoot = ku.isSuperUser();
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->count())
        user = args->arg(0);

    /* You must be able to run "kdepasswd loginName" */
    if ( !user.isEmpty() && user!=KUser().loginName() && !bRoot)
    {
        KMessageBox::sorry(0, i18n("You need to be root to change the password of other users."));
        return 1;
    }

    QByteArray oldpass;
    if (!bRoot)
    {
        int result = KDEpasswd1Dialog::getPassword(oldpass);
        if (result != KDEpasswd1Dialog::Accepted)
            return 1;
    }

    KDEpasswd2Dialog *dlg = new KDEpasswd2Dialog(oldpass, user.toLocal8Bit());


    dlg->exec();
    if (dlg->result() == KDEpasswd2Dialog::Rejected)
        return 1;

    return 0;
}
Beispiel #20
0
void JuK::slotProcessArgs()
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QStringList files;

    for(int i = 0; i < args->count(); i++)
        files.append(args->arg(i));

    CollectionList::instance()->addFiles(files);
}
Beispiel #21
0
int main(int argc, char **argv)
{
    KAboutData aboutData("kwriteconfig", I18N_NOOP("KWriteConfig"), "1.0.0", I18N_NOOP("Write KConfig entries - for use in shell scripts"),
                         KAboutData::License_GPL, "(c) 2001 Red Hat, Inc. & Luís Pedro Coelho");
    aboutData.addAuthor("Luís Pedro Coelho", 0, "*****@*****.**");
    aboutData.addAuthor("Bernhard Rosenkraenzer", "Wrote kreadconfig on which this is based", "*****@*****.**");
    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    QString group = QString::fromLocal8Bit(args->getOption("group"));
    QString key = QString::fromLocal8Bit(args->getOption("key"));
    QString file = QString::fromLocal8Bit(args->getOption("file"));
    QCString type = args->getOption("type").lower();


    if(key.isNull() || !args->count())
    {
        KCmdLineArgs::usage();
        return 1;
    }
    QCString value = args->arg(0);

    KInstance inst(&aboutData);

    KConfig *konfig;
    if(file.isEmpty())
        konfig = new KConfig(QString::fromLatin1("kdeglobals"), false, false);
    else
        konfig = new KConfig(file, false, false);

    konfig->setGroup(group);
    if(konfig->getConfigState() != KConfig::ReadWrite || konfig->entryIsImmutable(key))
        return 2;

    if(type == "bool")
    {
        // For symmetry with kreadconfig we accept a wider range of values as true than Qt
        bool boolvalue = (value == "true" || value == "on" || value == "yes" || value == "1");
        konfig->writeEntry(key, boolvalue);
    }
    else if(type == "path")
    {
        konfig->writePathEntry(key, QString::fromLocal8Bit(value));
    }
    else
    {
        konfig->writeEntry(key, QString::fromLocal8Bit(value));
    }
    konfig->sync();
    delete konfig;
    return 0;
}
Beispiel #22
0
int main(int argc, char *argv[])
{
    KAboutData aboutData("kcemirror", I18N_NOOP("KCeMirror"), VERSION, description,
            KAboutData::License_Custom,
            "(c) 2003, Volker Christian (voc)", 0,
            "http://synce.sourceforge.net/synce/kde/",
            "*****@*****.**");
    aboutData.addAuthor("Volker Christian", 0, "*****@*****.**");
    aboutData.addCredit("Ludovic Lange",
            I18N_NOOP("is the Initiator of the SynCE-Project."),
            "*****@*****.**");
    aboutData.addCredit("David Eriksson",
            I18N_NOOP("is the current Project Manager."),
            "*****@*****.**");
    aboutData.addCredit("Ganesh Varadarajan",
            I18N_NOOP("has developed the serial-over-USB driver."),
            "*****@*****.**");
    aboutData.setLicenseText(MITlicense);

    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options );
    KApplication::addCmdLineOptions();

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    QString pdaName = args->arg(0);
    bool synce = args->isSet("synce");
    bool forceInstall = args->isSet("forceinstall");

    kdDebug(2120) << "Synce: " << synce << endl;
    kdDebug(2120) << "ForceInstall: " << forceInstall << endl;

#if KDE_VERSION < KDE_MAKE_VERSION(3,2,0) // KDE-3.1
    KApplication a(argc, argv, QCString("kcemirror"));
#else
    KApplication a;
#endif

    CeScreen *ceScreen = new CeScreen();

    QObject::connect(ceScreen, SIGNAL(pdaError()), &a, SLOT(quit()));

    if (!ceScreen->connectPda(pdaName, synce, forceInstall)) {
        kdDebug(2120) << "Could not contact PDA " << pdaName << endl;
        return -1;
    }

    a.setMainWidget(ceScreen);

    ceScreen->show();

    return a.exec();
}
Beispiel #23
0
int main(int argc, char** argv)
{
    qInstallMsgHandler(messageOutput);
    KAboutData aboutData( "duchaintokross", 0, ki18n( "duchaintokross" ),
                          "33", ki18n("Wrapper generator from C++ to Kross"), KAboutData::License_GPL,
                          ki18n( "(c) 2008, The KDevelop developers" ), KLocalizedString(), "http://www.kdevelop.org" );
    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineOptions options;
    options.add("+file", ki18n("input .cpp file"), QByteArray());
    options.add("I <includes>", ki18n("include directories for the parser (colon separated)"), QByteArray());
    options.add("i <includes>", ki18n("include directories that the generated implementation file will have (colon separated)"), QByteArray());
    options.add("b <builddir>", ki18n("build dir where the Makefile for the input is added"), QByteArray());
    options.add("F <filename>", ki18n("filename to be used for the .moc and the .h file"), QByteArray());
    options.add("D <directory>", ki18n("directory where to put the .h output"), QByteArray());
    options.add("o <output>", ki18n("directory where to put the code output"), QByteArray());
    options.add("impl", ki18n("create implementation"), QByteArray());
    options.add("verbose", ki18n("Verbose output"), QByteArray());
    KCmdLineArgs::addCmdLineOptions( options );
    
    KApplication app;
    ConsoleIDEExtension::init();
    Core::initialize(0, Core::NoUi);
    
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    KUrl::List includes;
    KUrl input;
    
    for(int i=0; i<args->count(); i++)
    {
        QString arg=args->arg(i);
        input=KUrl(arg);
    }
    
    foreach(const QString& inc, args->getOption("I").split(':'))
        includes << KUrl(inc);
    KUrl builddir(args->getOption("b"));
    QString filename(args->getOption("F"));
    QString directory(args->getOption("D"));
    QStringList toinclude(args->getOption("i").split(':'));
    QString output(args->getOption("o"));
    verbose=args->isSet("verbose");
    bool createImpl=args->isSet("impl");
    args->clear();
    
    DUChainExtractor e;
    kDebug() << input << builddir << includes << toinclude;
    e.setWriteImpl(createImpl);
    e.start(input, builddir, includes, filename, directory, toinclude, output);
    
    return app.exec();
}
Beispiel #24
0
int main( int argc, char **argv )
{
  KAboutData aboutData( "readandwrite", "Read and Write Calendar", "0.1" );
  KCmdLineArgs::init( argc, argv, &aboutData );
  KCmdLineArgs::addCmdLineOptions( options );

  KApplication app( false, false );

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  if ( args->count() != 2 ) {
    args->usage( "Wrong number of arguments." );
  }

  // use zoneinfo data from source dir
  set_zone_directory( KDETOPSRCDIR "/libkcal/libical/zoneinfo" );

  QString input = QFile::decodeName( args->arg( 0 ) );
  QString output = QFile::decodeName( args->arg( 1 ) );

  QFileInfo outputFileInfo( output );
  output = outputFileInfo.absFilePath();

  kdDebug(5800) << "Input file: " << input << endl;
  kdDebug(5800) << "Output file: " << output << endl;


  CalendarLocal cal( QString::fromLatin1("UTC") );

  if ( !cal.load( input ) ) return 1;
  QString tz = cal.nonKDECustomProperty( "X-LibKCal-Testsuite-OutTZ" );
  if ( !tz.isEmpty() ) {
    cal.setTimeZoneIdViewOnly( tz );
  }
  if ( !cal.save( output ) ) return 1;

  return 0;
}
Beispiel #25
0
int main(int argc, char *argv[]) {
	KAboutData aboutData( "rkward", I18N_NOOP ("RKWard"), version, description, KAboutData::License_GPL, "(c) 2002, 2004, 2005, 2006", 0, "http://rkward.sf.net", "*****@*****.**");
	aboutData.addAuthor ("Thomas Friedrichsmeier", I18N_NOOP ("Project leader / main developer"), 0);
	aboutData.addAuthor ("Pierre Ecochard",  I18N_NOOP ("C++ coder since 0.2.9"), 0);
	aboutData.addCredit ("Contributors in alphabetical order", 0, 0);
	aboutData.addCredit ("Philippe Grosjean", I18N_NOOP ("Several helpful comments and discussions"), 0);
	aboutData.addCredit ("Adrien d'Hardemare", I18N_NOOP ("Plugins and patches"), 0);
	aboutData.addCredit ("Yves Jacolin", I18N_NOOP ("New website"), 0);
	aboutData.addCredit ("Prasenjit Kapat", I18N_NOOP ("Several plugins"), 0);
	aboutData.addCredit ("Marco Martin", I18N_NOOP ("A cool icon"), 0);
	aboutData.addCredit ("Daniele Medri", I18N_NOOP ("RKWard logo, many suggestions, help on wording"), 0);
	aboutData.addCredit ("Stefan Roediger", I18N_NOOP ("Many plugins, suggestions, marketing, translations"), 0);
	aboutData.addCredit ("David Sibai", I18N_NOOP ("Several valuable comments, hints and patches"), 0);
	aboutData.addCredit ("Ilias Soumpasis", I18N_NOOP ("Translation, Suggestions, plugins"), 0);
	aboutData.addCredit ("Ralf Tautenhahn", I18N_NOOP ("Many comments, useful suggestions, and bug reports"), 0);
	aboutData.addCredit ("Roland Vollgraf", I18N_NOOP ("Some patches"), 0);
	aboutData.addCredit (I18N_NOOP ("Many more people on [email protected]"), I18N_NOOP ("Sorry, if we forgot to list you. Please contact us to get added"), 0);

	// before initializing the commandline args, remove the ".bin" from "rkward.bin".
	// This is so it prints "Usage rkward..." instead of "Usage rkward.bin...", etc.
	// it seems safest to keep a copy, since the shell still owns argv[0]
	char *argv_zero_copy = argv[0];
	argv[0] = qstrdup (QString (argv_zero_copy).remove (".bin").local8Bit ());
	KCmdLineArgs::init( argc, argv, &aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
	
	RKWardApplication app;
	if (app.isRestored ()) {
		RESTORE(RKWardMainWindow);	// well, whatever this is supposed to do -> TODO
	} else {
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
		RK_Debug_Level = 5 - QString (args->getOption ("debug-level")).toInt ();
		RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt (0, 2);
		qDebug ("Debug-flags as decimal: %d", RK_Debug_Flags);
		
		KURL *open_url = 0;
		if (args->count ()) {
			open_url = new KURL (args->makeURL (args->arg (0)));
		}
		args->clear();
		
		new RKWardMainWindow(open_url);
	}

	// do it!
	int status = app.exec ();
	// restore old argv[0] so the shell is happy
	argv[0] = argv_zero_copy;
	return status;
}
int main(int argc, char *argv[])
{

  KAboutData aboutData( "testrender", I18N_NOOP("TestRender"),
    0, "Program to test rendering", KAboutData::License_LGPL,"");
  KCmdLineArgs::init( argc, argv, &aboutData );
  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  if (args->count() < 3) {
    kdError() << "testrender <sourcedir> <imagesdir> <logfile>\n";
    return 0;
  }

  QString sourceDir = args->arg(0);
  QString destDir = args->arg(1);
  QString logFilename = args->arg(2);
  if (!QDir(sourceDir).exists()) {
    kdError() << "source dir \"" << sourceDir.latin1() << "\" does not exist\n";
    return 0;
  }

  if (!QDir(destDir).exists()) {
    kdError() << "dest dir \"" << destDir.latin1() << "\" does not exist\n";
    return 0;
  }


  KApplication a;
  TestRender *testrender = new TestRender(sourceDir,destDir,logFilename);
  a.setMainWidget(testrender);
  testrender->show();
//  testrender->showMaximized();
  testrender->processFiles();

  return a.exec();
}
Beispiel #27
0
int main(int argc, char** argv)
{
	QString style = "keramik";
	// KApplication app(argc, argv);
	KAboutData about("decobenchmark", "DecoBenchmark", "0.1", "kwin decoration performance tester...", KAboutData::License_LGPL, "(C) 2005 Sandro Giessl");
	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions( options );

	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	if (args->count() != 3)
		KCmdLineArgs::usage("Wrong number of arguments!");

	QString library = QString(args->arg(0) );
	QString t = QString(args->arg(1) );
	int count = QString(args->arg(2) ).toInt();

	Tests test;
	if (t == "all")
		test = AllTests;
	else if (t == "repaint")
		test = RepaintTest;
	else if (t == "caption")
		test = CaptionTest;
	else if (t == "resize")
		test = ResizeTest;
	else if (t == "recreation")
		test = RecreationTest;
	else
		KCmdLineArgs::usage("Specify a valid test!");

	DecoBenchApplication app(library, test, count);

	QTimer::singleShot(0, &app, SLOT(executeTest()));
	app.exec();
}
Beispiel #28
0
int main(int argc, char *argv[])
{
  for (int i = 0; i < argc; i++)
  {
    qDebug("argv[%d] = %s", i, argv[i]);
  }
  KAboutData aboutData( "testqtargs", 0, ki18n("testqtargs"),
    "1.0", ki18n("testqtargs"), KAboutData::License_GPL);
	
  KCmdLineOptions options;
  options.add("hello ", ki18n("Says hello"));

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

  KCmdLineArgs *qtargs = KCmdLineArgs::parsedArgs("qt");
  for (int i = 0; i < qtargs->count(); i++)
  {
    qDebug("qt arg[%d] = %s", i, qtargs->arg(i).toLocal8Bit().data());
  }

  KApplication app;

  KCmdLineArgs *kdeargs = KCmdLineArgs::parsedArgs("kde");
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  // An arg set by Qt
  if(qtargs->isSet("background"))
  {
    qDebug("arg bg = %s", qtargs->getOption("background").toLocal8Bit().data());
  }
  // An arg set by KDE
  if(kdeargs->isSet("caption"))
  {
    qDebug("arg caption = %s", kdeargs->getOption("caption").toLocal8Bit().data());
  }
  // An arg set by us.
  if(args->isSet("hello"))
  {
    qDebug("arg hello = %s", args->getOption("hello").toLocal8Bit().data());
  }
  args->clear();

  QWidget *w = new QWidget();
  w->show();

  return app.exec();
}
Beispiel #29
0
int main( int argc, char **argv )
{
  KApplication::disableAutoDcopRegistration();

  KAboutData aboutData( "testread", "vCard test reader", "0.1" );
  aboutData.addAuthor( "Cornelius Schumacher", 0, "*****@*****.**" );

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

  KApplication app( false, false );

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  if ( args->count() != 1 ) {
    std::cerr << "Missing argument" << std::endl;
    return 1;
  }

  QString inputFile( args->arg( 0 ) );

  QFile file( inputFile );
  if ( !file.open( IO_ReadOnly ) ) {
    qDebug( "Unable to open file '%s' for reading!", file.name().latin1() );
    return 1;
  }

  QString text;

  QTextStream s( &file );
  s.setEncoding( QTextStream::Latin1 );
  text = s.read();
  file.close();

  KABC::VCardConverter converter;
  KABC::Addressee::List list = converter.parseVCards( text );

  if ( args->isSet( "vcard21" ) ) {
    text = converter.createVCards( list, KABC::VCardConverter::v2_1 ); // uses version 2.1
  } else {
    text = converter.createVCards( list ); // uses version 3.0
  }

  std::cout << text.utf8();

  return 0;
}
Beispiel #30
0
int main(int argc, char **argv)
{
    KLocale::setMainCatalogue("kdelibs");
    KCmdLineArgs::init(argc, argv, "kmailservice", I18N_NOOP("KMailService"), I18N_NOOP("Mail service"), "unknown");
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication a(false, false);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if(args->count() != 1)
        return 1;

    a.invokeMailer(KURL(args->arg(0)), a.startupId(), true);

    return 0;
}