예제 #1
0
int main(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, "testkhtml", 0, ki18n("Testkhtml"), "1.0",
            ki18n("a basic web browser using the KHTML library"));

    KCmdLineOptions options;
    options.add("+file", ki18n("url to open"));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (args->count() == 0)
    {
        KCmdLineArgs::usage();
        ::exit( 1 );
    }

    TestKHTML *test = new TestKHTML;
    if (args->url(0).url().right(4).toLower() == ".xml")
    {
        KParts::OpenUrlArguments args(test->doc()->arguments());
        args.setMimeType("text/xml");
        test->doc()->setArguments(args);
    }

    test->openUrl(args->url(0));
    test->show();

    return app.exec();
}
예제 #2
0
int KOrganizerApp::newInstance()
{
  kdDebug(5850) << "KOApp::newInstance()" << endl;
  static bool first = true;
  if ( isRestored() && first ) {
     KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
     if ( korg ) {
       KOrg::StdCalendar::self()->load();
       korg->view()->updateCategories();
       korg->view()->updateView();
     }
     first = false;
     return 0;
  }
  first = false;

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  KOGlobals::self()->alarmClient()->startDaemon();

  // No filenames given => all other args are meaningless, show main Window
  if ( args->count() <= 0 ) {
    processCalendar( KURL() );
    return 0;
  }
  
  // If filenames wer given as arguments, load them as calendars, one per window.
  if ( args->isSet( "open" ) ) {
    for( int i = 0; i < args->count(); ++i ) {
      processCalendar( args->url( i ) );
    }
  } else {
    // Import, merge, or ask => we need the resource calendar window anyway.
    processCalendar( KURL() );
    KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
    if ( !korg ) {
      kdError() << "Unable to find default calendar resources view." << endl;
      return -1;
    }
    // Check for import, merge or ask
    if ( args->isSet( "import" ) ) {
      for( int i = 0; i < args->count(); ++i ) {
        korg->actionManager()->addResource( args->url( i ) );
      }
    } else if ( args->isSet( "merge" ) ) {
      for( int i = 0; i < args->count(); ++i ) {
        korg->actionManager()->mergeURL( args->url( i ).url() );
      }
    } else {
      for( int i = 0; i < args->count(); ++i ) {
        korg->actionManager()->importCalendar( args->url( i ) );
      }
    }
  }

  kdDebug(5850) << "KOApp::newInstance() done" << endl;

  return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: KDE/kmplayer
extern "C" KDE_EXPORT int kdemain (int argc, char *argv[]) {
    setsid ();

    KAboutData aboutData ("kmplayer", 0, ki18n("KMPlayer"),
            KMPLAYER_VERSION_STRING,
            ki18n ("Media player."),
            KAboutData::License_GPL,
            ki18n ("(c) 2002-2009, Koos Vriezen"),
            KLocalizedString(),
            I18N_NOOP ("http://kmplayer.kde.org"));
    aboutData.addAuthor(ki18n("Koos Vriezen"), ki18n("Maintainer"),"*****@*****.**");
    KCmdLineArgs::init (argc, argv, &aboutData);
    KCmdLineOptions options;
    options.add ("+[File]", ki18n ("file to open"));
    KCmdLineArgs::addCmdLineOptions (options);

    KMPlayer::Ids::init();

    KApplication app;
    QPointer <KMPlayerApp> kmplayer;

    if (app.isSessionRestored ()) {
        RESTORE (KMPlayerApp);
    } else {
        kmplayer = new KMPlayerApp ();
        kmplayer->show();

        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        KUrl url;
        if (args->count () == 1)
            url = args->url (0);
        if (args->count () > 1)
            for (int i = 0; i < args->count (); i++) {
                KUrl url = args->url (i);
                if (url.url ().indexOf ("://") < 0)
                    url = KUrl (QFileInfo (url.url ()).absoluteFilePath ());
                if (url.isValid ())
                    kmplayer->addUrl (url);
            }
        kmplayer->openDocumentFile (url);
        args->clear ();
    }
    int retvalue = app.exec ();

    delete kmplayer;

    KMPlayer::Ids::reset();

    return retvalue;
}
예제 #4
0
bool ClientApp::doCopy( int firstArg )
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    int argc = args->count();
    KUrl::List srcLst;
    for ( int i = firstArg; i <= argc - 2; i++ )
      srcLst.append( args->url(i) );
    KIO::Job * job = KIO::copy( srcLst, args->url(argc - 1), s_jobFlags );
    if ( !s_interactive )
        job->setUiDelegate( 0 );
    connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
    this->exec();
    return m_ok;
}
예제 #5
0
SvnHelper::SvnHelper():KApplication() {
	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
#ifdef Q_WS_X11
	m_id=KWindowSystem::activeWindow();
	KWindowSystem::activateWindow(m_id);
#else
	m_id = 0;
#endif

	KUrl::List list;
	for ( int i = 0 ; i < args->count() ; i++ )
		list << args->url(i);

	if (args->isSet("u")) {
		kDebug(7128) << "update " << list;
		const KUrl servURL("svn+http://this_is_a_fake_URL_and_this_is_normal/");
		//FIXME when 1.2 is out (move the loop inside kio_svn's ::update)
		for ( QList<KUrl>::const_iterator it = list.constBegin(); it != list.constEnd() ; ++it ) {
			QByteArray parms;
			QDataStream s( &parms, QIODevice::WriteOnly );
			int cmd = 2;
			int rev = -1;
			kDebug(7128) << "updating : " << (*it).prettyUrl();
			s << cmd << *it << rev << QString( "HEAD" );
			KIO::SimpleJob * job = KIO::special(servURL, parms);
			connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
			KIO::NetAccess::synchronousRun( job, 0 );
		}
	} else if (args->isSet("c")) {
예제 #6
0
int main(int argc, char *argv[])
{

	KAboutData aboutData( "kmouth", I18N_NOOP("KMouth"),
		KMOUTH_VERSION, description, KAboutData::License_GPL,
		"(c) 2002/2003, Gunnar Schmi Dt", 0, "http://www.schmi-dt.de/kmouth/index.en.html", "*****@*****.**");
	aboutData.addAuthor("Gunnar Schmi Dt",0, "*****@*****.**");
	KCmdLineArgs::init( argc, argv, &aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

	aboutData.addCredit("Olaf Schmidt", I18N_NOOP("Tips, extended phrase books"), 0, 0);
  KApplication app;

  if (app.isRestored())
  {
    RESTORE(KMouthApp);
  }
  else
  {
    KMouthApp *kmouth = new KMouthApp();
    if (!kmouth->configured())
       return 0;

    kmouth->show();

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

		if (args->count())
		{
        kmouth->openDocumentFile(args->url(0));
		}
		args->clear();
  }
  return app.exec();
}
예제 #7
0
int main(int argc, char ** argv)
{
    KCmdLineOptions options;
    options.add("+URL1", ki18n("The first URL to play"));
    options.add("+URL2", ki18n("The second URL to play"));

    KAboutData about("crossfade", 0, ki18n("Phonon Crossfade Example"),
            "1.0", KLocalizedString(),
            KAboutData::License_LGPL);
    about.addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "*****@*****.**");
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;
    KUrl url1;
    KUrl url2;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (args->count() == 2)
    {
        url1 = args->url(0);
        url2 = args->url(1);
        if (url1.isValid() && url2.isValid())
        {
            Crossfader xfader(url1, url2);
            return app.exec();
        }
    }
    return 1;
}
예제 #8
0
int main(int argc, char* argv[])
{
    PLEAboutData aboutData;
    aboutData.setAppName("photolayoutseditor");
    aboutData.setCatalogName("kipiplugin_photolayoutseditor");

    KCmdLineArgs::init(argc,argv,&aboutData);
    KCmdLineOptions options;
    options.add("+file", ki18n("Input file"));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;
    aboutData.setProgramLogo(KIcon("photolayoutseditor"));

    PhotoLayoutsEditor* w = PhotoLayoutsEditor::instance(0);
    w->setAttribute(Qt::WA_DeleteOnClose, true);

    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
    if (args->count())
    {
        KUrl url = args->url(0);
        if (url.isValid())
            w->open(url);
    }

    w->show();

    int result = app.exec();

    return result;
}
예제 #9
0
int main( int argc, char* argv[] )
{
   PMShell* shell = 0;

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

   KApplication app;

   KCmdLineArgs* args = KCmdLineArgs::parsedArgs( );

   if( !args->isSet( "-opengl" ) )
      PMRenderManager::disableOpenGL( );
   if( !args->isSet( "-dri" ) )
      PMGLView::enableDirectRendering( false );

   if( args->count( ) > 0 )
   {
      for( int i = 0 ; i < args->count( ) ; i++ )
      {
         shell = new PMShell( args->url( i ) );
         shell->show( );
      }
   }
   else
   {
      shell = new PMShell;
      shell->show( );
   }
   args->clear();   
   return app.exec( );
}
예제 #10
0
int main(int argc, char **argv)
{
    KAboutData about("d3lphin",
                     I18N_NOOP("Dolphin"),
                     "0.9.2",
                     I18N_NOOP("File Manager"),
                     KAboutData::License_GPL,
                     "(C) 2007 Marcel Juhnke");
    about.setHomepage("https://marrat.homelinux.org/D3lphin");
    about.setBugAddress("*****@*****.**");
    about.addAuthor("Marcel Juhnke", I18N_NOOP("Maintainer and developer"), "*****@*****.**");
    about.addAuthor("Michael Austin", I18N_NOOP("Documentation"), "*****@*****.**");
    about.addAuthor("Orville Bennett", I18N_NOOP("Documentation"), "*****@*****.**");
    about.addCredit("Peter Penz", I18N_NOOP("... for the great original Dolphin"));
    about.addCredit("Cvetoslav Ludmiloff, Stefan Monov", I18N_NOOP("... for their development on the original Dolphin"));
    about.addCredit("Aaron J. Seigo", I18N_NOOP("... for the great support and the amazing patches for the orignal Dolphin"));
    about.addCredit("Patrice Tremblay, Gregor Kalisnik, Filip Brcic, Igor Stepin and Jan Mette", I18N_NOOP("... for their patches"));
    about.addCredit("Ain, Itai, Ivan, Jannick, Stephane, Patrice, Piotr, Stefano and Power On",
                    I18N_NOOP("... for their translations"));

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

    KApplication app;
    Dolphin& mainWin = Dolphin::mainWin();
    mainWin.show();

    if (app.isRestored()) {
        int n = 1;
        while (KMainWindow::canBeRestored(n)){
            Dolphin::mainWin().restore(n);
            ++n;
        }
    } else {
        KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
        if (args->count() > 0) {
            mainWin.activeView()->setURL(args->url(0));

            for (int i = 1; i < args->count(); ++i) {
                KRun::run("d3lphin", args->url(i));
            }
        }
        args->clear();
    }

    return app.exec();
}
예제 #11
0
KonfUpdate::KonfUpdate()
        : m_textStream(0), m_file(0)
{
    bool updateAll = false;
    m_oldConfig1 = 0;
    m_oldConfig2 = 0;
    m_newConfig = 0;

    m_config = new KConfig("kconf_updaterc");
    KConfigGroup cg(m_config, QString());

    QStringList updateFiles;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    m_debug = args->isSet("debug");

    m_bUseConfigInfo = false;
    if (args->isSet("check")) {
        m_bUseConfigInfo = true;
        QString file = KStandardDirs::locate("data", "kconf_update/" + args->getOption("check"));
        if (file.isEmpty()) {
            qWarning("File '%s' not found.", args->getOption("check").toLocal8Bit().data());
            log() << "File '" << args->getOption("check") << "' passed on command line not found" << endl;
            return;
        }
        updateFiles.append(file);
    } else if (args->count()) {
        for (int i = 0; i < args->count(); i++) {
            KUrl url = args->url(i);
            if (!url.isLocalFile()) {
                KCmdLineArgs::usageError(i18n("Only local files are supported."));
            }
            updateFiles.append(url.path());
        }
    } else {
        if (cg.readEntry("autoUpdateDisabled", false))
            return;
        updateFiles = findUpdateFiles(true);
        updateAll = true;
    }

    for (QStringList::ConstIterator it = updateFiles.constBegin();
            it != updateFiles.constEnd();
            ++it) {
        updateFile(*it);
    }

    if (updateAll && !cg.readEntry("updateInfoAdded", false)) {
        cg.writeEntry("updateInfoAdded", true);
        updateFiles = findUpdateFiles(false);

        for (QStringList::ConstIterator it = updateFiles.constBegin();
                it != updateFiles.constEnd();
                ++it) {
            checkFile(*it);
        }
        updateFiles.clear();
    }
}
예제 #12
0
파일: main.cpp 프로젝트: KDE/khipu
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();
}
예제 #13
0
int main(int argc, char *argv[])
{

    KAboutData aboutData( "kimagemapeditor", I18N_NOOP("KImageMapEditor"),
                          VERSION, description, KAboutData::License_GPL,
                          "(C) 2001-2008 Jan Schaefer", 0, "http://www.nongnu.org/kimagemap/", "*****@*****.**");
    aboutData.addAuthor("Jan Schaefer",0, "*****@*****.**");
    aboutData.addCredit("Joerg Jaspert",I18N_NOOP("For helping me with the Makefiles, and creating the Debian package"));
    aboutData.addCredit("Aaron Seigo and Michael",I18N_NOOP("For helping me fixing --enable-final mode"));
    aboutData.addCredit("Antonio Crevillen",I18N_NOOP("For the Spanish translation"));
    aboutData.addCredit("Fabrice Mous",I18N_NOOP("For the Dutch translation"));
    aboutData.addCredit("Germain Chazot",I18N_NOOP("For the French translation"));
    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication a;
    a.dcopClient()->registerAs(a.name());



    if (a.isRestored())
    {
        RESTORE(KimeShell);
    }
    else
    {
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if ( args->count() == 0 )
        {
            KimeShell *kimeShell = new KimeShell();
            kimeShell->setStdout(args->isSet("stdout"));
            kimeShell->readConfig();
            kimeShell->show();
            kimeShell->openLastFile();
        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++ )
            {
                KimeShell *kimeShell = new KimeShell();
                kimeShell->setStdout(args->isSet("stdout"));
                kimeShell->readConfig();
                kimeShell->show();
                kimeShell->openFile(args->url(i));
            }
        }
        args->clear();
    }

    return a.exec();
}
예제 #14
0
bool ClientApp::doList( int firstArg )
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    KUrl dir = args->url(firstArg);
    KIO::Job * job = KIO::listDir(dir, KIO::HideProgressInfo);
    if ( !s_interactive )
        job->setUiDelegate(0);
    connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
            SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
    connect(job, SIGNAL(result(KJob *)), this, SLOT(slotResult(KJob *)));
    this->exec();
    return m_ok;
}
예제 #15
0
int main(int argc, char** argv) {

    KAboutData about("kphotobook", I18N_NOOP("KPhotoBook"), version, description,
                     KAboutData::License_GPL, "(C) 2003 Michael Christen",
                     0, // free text, can contain new lines
                     "http://kphotobook.sourceforge.net",
                     "*****@*****.**");
    about.addAuthor("Michael Christen", "The master chief developer.", "*****@*****.**" );
    about.addAuthor("Thomas Christen", "One of Santa's greater helpers.\nHelps me creating icons and writing the website and the documentation.", "*****@*****.**");
    about.addAuthor("Stefan Fink", "One of Santa's little helpers.\nAdvises in design and usability questions.");
    about.addAuthor("Daniel Gerber", "One of Santa's little helpers.\nAdvises in design and usability questions.");

    about.addCredit("George W. Bush, President of the USA", "For being a stupid little git.", "*****@*****.**" );

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

    KApplication app;

    KMdi::MdiMode mdiMode = KMdi::IDEAlMode;
    if (Settings::generalViewMode() == Settings::EnumGeneralViewMode::TabPageMode) {
        mdiMode = KMdi::TabPageMode;
    }

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

        KPhotoBook* widget = new KPhotoBook(mdiMode);
        widget->show();

        // try to load last opened file
        QString lastFileName = Settings::fileSystemLastOpenedFile();
        if (!lastFileName.isEmpty()) {
            QFileInfo lastFile(lastFileName);
            widget->load(lastFile);
        }
    } else {
        int i = 0;
        for (; i < args->count(); i++) {
            QFileInfo file(args->url(i).path());
            KPhotoBook* widget = new KPhotoBook(mdiMode);
            widget->show();
            widget->load(file);
        }
    }
    args->clear();

    return app.exec();
}
예제 #16
0
파일: main.cpp 프로젝트: KDE/ksokoban
int
main (int argc, char **argv)
{
  KAboutData aboutData("ksokoban", 0, ki18n("KSokoban"),
		       version, ki18n(description), KAboutData::License_GPL,
		       ki18n("(c) 1998-2001  Anders Widell"), KLocalizedString(),
		       "http://hem.passagen.se/awl/ksokoban/");
  aboutData.addAuthor(ki18n("Anders Widell"), KLocalizedString(),
		      "*****@*****.**",
		      "http://hem.passagen.se/awl/");
  aboutData.addCredit(ki18n("David W. Skinner"),
		      ki18n("For contributing the Sokoban levels included in this game"),
		      "*****@*****.**",
		      "http://users.bentonrea.com/~sasquatch/");
  KCmdLineArgs::init(argc, argv, &aboutData);

  KCmdLineOptions options;
  options.add("+[file]", ki18n("Level collection file to load"));
  KCmdLineArgs::addCmdLineOptions(options);
//   KUniqueApplication::addCmdLineOptions();

//   if (!KUniqueApplication::start())
//     return 0;

  QApplication::setColorSpec(QApplication::ManyColor);

//   KUniqueApplication app;
  KApplication app;
//

  MainWindow *widget = new MainWindow();
  widget->show();

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  if (args->count() > 0) {
    widget->openUrl(args->url(0));
  }
  args->clear();

  QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));

  int rc = app.exec();

//   delete widget;

  return rc;
}
예제 #17
0
void KopeteApplication::handleURLArgs()
{
	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//	kdDebug(14000) << k_funcinfo << "called with " << args->count() << " arguments to handle." << endl;

	if ( args->count() > 0 )
	{
		for ( int i = 0; i < args->count(); i++ )
		{
			KURL u( args->url( i ) );
			if ( !u.isValid() )
				continue;

			Kopete::MimeTypeHandler::dispatchURL( u );
		} // END for()
	} // END args->count() > 0
}
예제 #18
0
int main(int argc, char *argv[])
{
  xsltStylesheetPtr cur = NULL;
  xmlDocPtr doc, res;

  const char *params[16 + 1];
  int nbparams = 0;
  params[nbparams] = NULL;

  KAboutData aboutData( "umbodoc", 0, ki18n("Umbrello UML Modeller autonomous code generator"),
                        umbrelloVersion(), ki18n(description), KAboutData::License_GPL,
                        ki18n("(c) 2006 Gael de Chalendar (aka Kleag), (c) 2002-2006 Umbrello UML Modeller Authors"), KLocalizedString(),
                        "http://uml.sf.net/");
  aboutData.addAuthor(ki18n("Gael de Chalendar (aka Kleag)"),KLocalizedString(), "*****@*****.**");
  aboutData.addAuthor(ki18n("Umbrello UML Modeller Authors"), KLocalizedString(), "*****@*****.**");
  KCmdLineArgs::init( argc, argv, &aboutData );

  KCmdLineOptions options;
  options.add("+[File]", ki18n("File to transform"));
  options.add("xslt <url>", ki18n("The XSLT file to use"));
  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  QCStringList xsltOpt = args->getOptionList("xslt");
  if (xsltOpt.size() > 0)
  {
    QString xsltFile(xsltOpt.last());

    xmlSubstituteEntitiesDefault(1);
    xmlLoadExtDtdDefaultValue = 1;
    cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.latin1());
    doc = xmlParseFile(args->url( 0 ).url().latin1());
    res = xsltApplyStylesheet(cur, doc, params);
    xsltSaveResultToFile(stdout, res, cur);

    xsltFreeStylesheet(cur);
    xmlFreeDoc(res);
    xmlFreeDoc(doc);

    xsltCleanupGlobals();
    xmlCleanupParser();
  }
  return(0);
}
예제 #19
0
int main(int argc, char *argv[])
{
    KAboutData about("kfilereplace", I18N_NOOP("KFileReplace"), version, description,
                     KAboutData::License_GPL_V2, "(C) 2004-2005 Andras Mantia\n(C) 2004-2005 Emiliano Gulmini\n(C) 1999-2002 Francois Dupoux", I18N_NOOP("Part of the KDEWebDev module."),
                     "http://www.kdewebdev.org");

    about.addAuthor("Andras Mantia", I18N_NOOP("Shell author, KPart creator, co-maintainer"), "*****@*****.**");
    about.addAuthor("Emiliano Gulmini", I18N_NOOP("Current maintainer, code cleaner and rewriter"),"*****@*****.**");
    about.addAuthor("Francois Dupou",
                          I18N_NOOP("Original author of the KFileReplace tool"),
                          "*****@*****.**");

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

    KApplication app;

    // see if we are starting with session management
    if (app.isRestored())
    {
        RESTORE(KFileReplace);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        KFileReplace *kfr = new KFileReplace;
        kfr->show();

        if (args->count() == 0)
        {
            kfr->openURL(KURL());
        }
        else
        {
            kfr->openURL(args->url(0));
        }
        args->clear();
    }

    return app.exec();
}
예제 #20
0
파일: main.cpp 프로젝트: acpanna/coding
int main(int argc, char *argv[])
{

  KAboutData aboutData("kminimdi", I18N_NOOP("KMiniMDI"), "0.1", description, KAboutData::License_GPL, "(c) 2000, Burkhard Lehner");
  aboutData.addAuthor("Burkhard Lehner",0, "*****@*****.**");
  KCmdLineArgs::init( argc, argv, &aboutData );
  KCmdLineArgs::addCmdLineOptions(options); 

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

  KApplication a;
  KMiniEdit *kminiedit = new KMiniEdit();
  
  for (int i=0; i<args->count(); i++)
    kminiedit->loadFile(args->url(i));
  
  kminiedit->show();

  return a.exec();
}
예제 #21
0
파일: main.cpp 프로젝트: acpanna/coding
int main(int argc, char **argv)
{
  KAboutData aboutData("kminiedit", I18N_NOOP("KMiniEdit"), "0.1", description, KAboutData::License_GPL, "(c) 2000, Burkhard Lehner");
  aboutData.addAuthor("Burkhard Lehner", 0, "*****@*****.**");
  KCmdLineArgs::init(argc, argv, &aboutData);
  KCmdLineArgs::addCmdLineOptions(options);
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  
  if (args->count() > 1)
    KCmdLineArgs::usage("Only one file allowed!");
  
  KApplication a;
  KMiniEdit *kminiedit = new KMiniEdit();
  if (args->count() > 0)
    kminiedit->loadFile(args->url(0));

  kminiedit->show();

  return a.exec();
}
예제 #22
0
int main(int argc, char **argv)
{
    KAboutData about("composer", I18N_NOOP("Composer"), version, description,
                     KAboutData::License_GPL, "(C) 2007 sebastian", 0, 0, "*****@*****.**");
    about.addAuthor( "sebastian", 0, "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;

    // register ourselves as a dcop client
    app.dcopClient()->registerAs(app.name(), false);

    // see if we are starting with session management
    if (app.isRestored())
    {
        RESTORE(Composer);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0)
        {
            Composer *widget = new Composer;
            widget->show();
        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++)
            {
                Composer *widget = new Composer;
                widget->show();
                widget->load(args->url(i));
            }
        }
        args->clear();
    }

    return app.exec();
}
예제 #23
0
int main(int argc, char *argv[])
{
    KAboutData aboutData( "WebPhonon", "WebPhonon",
          ki18n("WebPhonon"), "1.4",
          ki18n("Media Player"),
          KAboutData::License_GPL,
          ki18n("Copyright (c) 2013 Zakhrov") );

    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineOptions options; //new
      options.add("+[file]", ki18n("Document to open")); //new
      KCmdLineArgs::addCmdLineOptions(options); //new


    QApplication a(argc, argv);
    QCoreApplication::setApplicationName("WebPhonon");
    MainWindow w;
    QPixmap img;
    img.load(":/splash/WebPhonon-Master-text2.png");
    QSplashScreen spl;
    spl.setPixmap(img);
    spl.show();

    QStringList cmd=a.arguments();
//    QTextStream cout(stdout);
//    cout<<argv[0]<<endl;
//    cout<<argv[1]<<endl;

//    if(!cmd.isEmpty())
//    {
//        w.cmdopen(cmd.last());
//    }
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); //new
     if(args->count()) //new
     {
       w.cmdopen(args->url(0).url()); //new
     }
    w.showMaximized();
    
    return a.exec();
}
예제 #24
0
int main(int argc, char **argv)
{
	KAboutData about("konference", I18N_NOOP("konference"), version, description,
	                 KAboutData::License_GPL, "(C) 2005 Malte Boehme", 0, 0, "*****@*****.**");
	about.addAuthor( "Malte Boehme", 0, "*****@*****.**" );
	about.addCredit( "Paul Volkaerts","MythPhone (i took the codec-, sip-, webcam- and rtp-code)", "*****@*****.**");
	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions( options );
	KUniqueApplication app;

	// see if we are starting with session management
	if (app.isRestored())
	{
		RESTORE(Konference);
	}
	else
	{
		// no session.. just start up normally
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

		if ( args->count() == 0 )
		{
			Konference *widget = new Konference;
			widget->show();
		}
		else
		{
			int i = 0;
			for (; i < args->count(); i++ )
			{
				Konference *widget = new Konference;
				widget->show();
				widget->load( args->url( i ) );
			}
		}
		args->clear();
	}

	return app.exec();
}
예제 #25
0
int main(int argc, char **argv)
{
    KAboutData aboutData("kpropertiesdialogtest", "KIO Properties Dialog Test", "1.0");
    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if(args->count() < 1)
        KCmdLineArgs::usage();
    KURL u = args->url(0);

    // This is the test for the KPropertiesDialog constructor that is now
    // documented to NOT work. Passing only a URL means a KIO::stat will happen,
    // and asking for the dialog to be modal too creates problems.
    // (A non-modal, URL-only dialog is the one kicker uses for app buttons, no problem there)
    KPropertiesDialog *dlg = new KPropertiesDialog(u, 0, 0, true /*modal*/, false /*we do exec ourselves*/);
    dlg->exec();

    return 0;
}
예제 #26
0
파일: main.cpp 프로젝트: Noughmad/Opeke
int main ( int argc, char **argv )
{
	KAboutData about ( "opeke", 0, ki18n ( "Opeke" ), version, ki18n ( description ),
	                   KAboutData::License_GPL, ki18n ( "(C) 2008 Miha Čančula" ), KLocalizedString(), 0, "*****@*****.**" );
	about.addAuthor ( ki18n ( "Miha Čančula" ), KLocalizedString(), "*****@*****.**" );
	KCmdLineArgs::init ( argc, argv, &about );

	KCmdLineOptions options;
	options.add ( "+[URL]", ki18n ( "Document to open" ) );
	KCmdLineArgs::addCmdLineOptions ( options );
	KApplication app;

	Opeke *mainwidget = new Opeke; // Main screen turn on

	// see if we are starting with session management
	if ( app.isSessionRestored() )
	{
		RESTORE ( Opeke );
	}
	else
	{
		// no session.. just start up normally
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
		if ( args->count() == 0 )
		{
			mainwidget->show();
		}
		else
		{
			mainwidget->show();
			mainwidget->openFile(args->url(0).url());
		}
		args->clear();
	}

	return app.exec();
}
예제 #27
0
int main (int argc, char *argv[])
{
  KAboutData aboutData( "html2mediawiki",
			0,
			ki18n("html2mediawiki"),
			"0.1",
			ki18n("Converts html syntax to mediawiki syntax"),
			KAboutData::License_GPL,
			ki18n("(c) 2008-2009 by Thorsten Staerk"),
			ki18n("This is html2mediawiki"),
			"http://www.staerk.de/thorsten",
			"*****@*****.**");
  KCmdLineArgs::init( argc, argv, &aboutData );
  KCmdLineOptions options; 
  options.add("+[file]", ki18n("Document to open")); 
  KCmdLineArgs::addCmdLineOptions(options); 
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  QByteArray inputfilecontent;
  KApplication app;
  if (args->count()) 
  {
    QFile inputfile(args->url(0).fileName());
    inputfile.open(QIODevice::ReadOnly);
    QString inputfilecontentqstring=QString::fromUtf8(inputfile.read(inputfile.bytesAvailable()));
    QDomDocument mydom=QDomDocument();
    mydom.setContent(tidy(inputfilecontentqstring));
    QDomNode bodynode(mydom.elementsByTagName("body").at(0));
    output(bodynode);
  }
  else 
  {
    std::cout << "html2mediawiki converts an html file to mediawiki syntax" << std::endl;
    std::cout << "html2mediawiki usage: html2mediawiki <htmlfile>" << std::endl;
    std::cout << "htmlfile must be utf-8 encoded." << std::endl;
  }
}
예제 #28
0
int main(int argc, char *argv[])
{
  KCmdLineArgs::init( argc, argv, "QMake Parser", "qmake-parser", "Parse QMake project files", "1.0.0");
    KCmdLineArgs::addCmdLineOptions(options);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if( args->count() < 1 )
    {
        KCmdLineArgs::usage(0);
    }

    int debug = 0;
    bool silent = false;

    if( args->isSet("silent") )
        silent = true;
    if( args->isSet("debug") )
        debug = 1;
    for( int i = 0 ; i < args->count() ; i++ )
    {
        QMake::ProjectAST *projectAST;
        int ret = QMake::Driver::parseFile(args->url(i).path(), &projectAST, debug);
        PrintAST pa;
        if ( ret == 0 )
            if ( !silent )
            {
                pa.processProject(projectAST);
                QString profile;
                projectAST->writeBack(profile);
                kdDebug(9024) << "QMake file written back:\n" << profile << endl;
            }
        return ret;
    }
    return 0;
}
예제 #29
0
void PrintWrapper::slotPrint()
{
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
    struct sigaction action;
#endif /* HAVE_SIGACTION && !HAVE_SIGSET*/

    // read variables from command line
    QString printer = args->getOption("d");
    QString title = args->getOption("t");
    int ncopies = QString(args->getOption("n")).toInt();
    QString job_mode = args->getOption("j");
    QString system = args->getOption("system");
    KStringList optlist = args->getOptionList("o");
    QMap< QString, QString > opts;
    KURL::List files;
    QStringList filestoprint;
    force_stdin = args->isSet("stdin");
    docopy = args->isSet("c");
    bool nodialog = !(args->isSet("dialog"));

    if(isatty(0))
    {
        kdDebug(500) << "stdin is a terminal, disabling it" << endl;
        check_stdin = false;
    }

    // parse options
    for(KStringList::ConstIterator it = optlist.begin(); it != optlist.end(); ++it)
    {
        QStringList l = QStringList::split('=', QString(*it), false);
        if(l.count() >= 1)
            opts[l[0]] = (l.count() == 2 ? l[1] : QString::null);
    }

    // read file list
    for(int i = 0; i < args->count(); i++)
        files.append(args->url(i));

    // some clean-up
    args->clear();

    // set default values if necessary
    if(job_mode == "console")
        job_output = 1;
    else if(job_mode == "none")
        job_output = 2;
    else
        job_output = 0;

    // some checking
    if(files.count() > 0)
    {
        check_stdin = false;

        if(force_stdin)
        {
            showmsg(i18n("A file has been specified on the command line. Printing from STDIN will be disabled."), 1);
            force_stdin = false;
        }
    }
    if(nodialog && files.count() == 0 && !force_stdin && !check_stdin)
    {
        errormsg(i18n("When using '--nodialog', you must at least specify one file to print or use the '--stdin' flag."));
    }

    if(check_stdin)
    { // check if there's any input on stdin
        fd_set in;
        struct timeval tm;
        tm.tv_sec = 0;
        tm.tv_usec = 0;
        FD_ZERO(&in);
        FD_SET(0, &in);
        if(select(1, &in, NULL, NULL, &tm))
        { // we have data on stdin
            if(read(0, &readchar, 1) > 0)
            {
                force_stdin = true;
                check_stdin = false;
                dataread = true;
                kdDebug(500) << "input detected on stdin" << endl;
            }
            else
            {
                force_stdin = check_stdin = false;
                kdDebug(500) << "stdin closed and empty" << endl;
            }
        }
        else
            kdDebug(500) << "no input on stdin at startup" << endl;
    }

    // force_stdin ? or also check_stdin ?
    KPrinter::ApplicationType dialog_mode = (force_stdin || nodialog ? KPrinter::StandAlone : KPrinter::StandAlonePersistent);
    KPrinter::setApplicationType(dialog_mode);
    if(!force_stdin)
        KPrinter::addStandardPage(KPrinter::FilesPage);

    KPrinter kprinter;
    if(nodialog)
    {
        KMPrinter *prt(0);
        KMManager *mgr = KMManager::self();

        mgr->printerList(false);
        if(!printer.isEmpty())
            prt = mgr->findPrinter(printer);
        else
            prt = mgr->defaultPrinter();

        if(prt == 0)
            errormsg(i18n("The specified printer or the default printer could not be found."));
        else if(!prt->autoConfigure(&kprinter))
            errormsg(i18n("Operation aborted."));
    }
    else if(!printer.isEmpty())
        kprinter.setSearchName(printer);
    kprinter.setDocName(title);
    kprinter.initOptions(opts);
    kprinter.setOption("kde-filelist", files.toStringList().join("@@"));
    kdDebug(500) << kprinter.option("kde-filelist") << endl;
    if(ncopies > 0)
        kprinter.setNumCopies(ncopies);

    if(nodialog)
        slotPrintRequested(&kprinter);
    else
    {
        dlg = KPrintDialog::printerDialog(&kprinter, 0);
        if(dlg)
        {
            connect(dlg, SIGNAL(printRequested(KPrinter *)), SLOT(slotPrintRequested(KPrinter *)));
            if(check_stdin)
            {
                notif = new QSocketNotifier(0, QSocketNotifier::Read, this);
                connect(notif, SIGNAL(activated(int)), this, SLOT(slotGotStdin()));
                kdDebug(500) << "waiting for input on stdin" << endl;
            }
            dlg->exec();
            delete dlg;
        }
        else
            errormsg(i18n("Unable to construct the print dialog."));
    }
예제 #30
0
int main(int argc, char** argv)
{
  KAboutData about ("kdvi", I18N_NOOP("KDVI"), "1.4",
                    description, KAboutData::License_GPL,
                    "Markku Hinhala, Stephan Kebekus",
                    I18N_NOOP("This program displays Device Independent (DVI) files which are produced by the TeX typesetting system.\n"
                    "This KDVI version is based on original code from KDVI version 0.43 and xdvik."));

  about.addAuthor ("Stefan Kebekus",
                   I18N_NOOP("Current Maintainer."),
                   "*****@*****.**",
                   "http://www.mi.uni-koeln.de/~kebekus");

  about.addAuthor ("Markku Hinhala", I18N_NOOP("Author of kdvi 0.4.3"));
  about.addAuthor ("Nicolai Langfeldt", I18N_NOOP("Maintainer of xdvik"));
  about.addAuthor ("Paul Vojta", I18N_NOOP("Author of xdvi"));
  about.addCredit ("Philipp Lehmann", I18N_NOOP("Testing and bug reporting."));
  about.addCredit ("Wilfried Huss", I18N_NOOP("Re-organisation of source code."));

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

  // see if we are starting with session management
  if (app.isRestored())
  {
    RESTORE(KViewShell);
  }
  else
  {
    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();

    if (args->isSet("unique"))
    {
      // With --unique, we need 2 arguments.
      if (args->count() < 1) 
      {
        args->usage();
        exit(-1);
      }

      // Find the fully qualified file name of the file we are
      // loading. Complain, if we are given a URL which does not point
      // to a local file.
      KURL url(args->url(0));

      if (!url.isValid()) 
      {
        kdError(4300) << QString(I18N_NOOP("The URL %1 is not well-formed.")).arg(args->arg(0)) << endl;
        return -1;
      }

      if (!url.isLocalFile()) 
      {
        kdError(4300) << QString(I18N_NOOP("The URL %1 does not point to a local file. You can only specify local "
             "files if you are using the '--unique' option.")).arg(args->arg(0)) << endl;
        return -1;
      }

      QString qualPath = QFileInfo(url.path()).absFilePath();

      app.dcopClient()->attach();
      // We need to register as "kviewshell" to stay compatible with existing DCOP-skripts.
      QCString id = app.dcopClient()->registerAs("unique-kviewshell");
      if (id.isNull())
        kdError(4300) << "There was an error using dcopClient()->registerAs()." << endl;
      QCStringList apps = app.dcopClient()->registeredApplications();
      for ( QCStringList::Iterator it = apps.begin(); it != apps.end(); ++it ) 
      {
        if ((*it).find("kviewshell") == 0) 
        {
          QByteArray data, replyData;
          QCString replyType;
          QDataStream arg(data, IO_WriteOnly);
          bool result;
          arg << qualPath.stripWhiteSpace();
          if (!app.dcopClient()->call( *it, "kmultipage", "is_file_loaded(QString)", data, replyType, replyData))
            kdError(4300) << "There was an error using DCOP." << endl;
          else 
          {
            QDataStream reply(replyData, IO_ReadOnly);
            if (replyType == "bool") 
            {
              reply >> result;
              if (result == true) 
              {
                if (app.dcopClient()->send( *it, "kmultipage", "jumpToReference(QString)", url.ref()) == true)
                {
                  app.dcopClient()->detach();
                  return 0;
                }
              }
            }
            else
              kdError(4300) << "The DCOP function 'doIt' returned an unexpected type of reply!";
          }
        }
      }