当前位置: 首页>>代码示例>>C++>>正文


C++ KApplication::isSessionRestored方法代码示例

本文整理汇总了C++中KApplication::isSessionRestored方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::isSessionRestored方法的具体用法?C++ KApplication::isSessionRestored怎么用?C++ KApplication::isSessionRestored使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KApplication的用法示例。


在下文中一共展示了KApplication::isSessionRestored方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    QScopedPointer<KAboutData> aboutData(
        Gwenview::createAboutData(
            "gwenview",       /* appname */
            0,                /* catalogName */
            ki18n("Gwenview") /* programName */
        ));
    aboutData->setShortDescription(ki18n("An Image Viewer"));

    KCmdLineArgs::init(argc, argv, aboutData.data());

    KCmdLineOptions options;
    options.add("f", ki18n("Start in fullscreen mode"));
    options.add("s", ki18n("Start in slideshow mode"));
    options.add("+[file or folder]", ki18n("A starting file or folder"));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;
    Gwenview::ImageFormats::registerPlugins();

    // startHelper must live for the whole life of the application
    StartHelper startHelper;
    if (app.isSessionRestored()) {
        kRestoreMainWindows<Gwenview::MainWindow>();
    } else {
        startHelper.createMainWindow();
    }
    return app.exec();
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: main

int main(int argc, char *argv[])
{
    KAboutData aboutData(
        "gwenview",        /* appname */
        0,                 /* catalogName */
        ki18n("Gwenview"), /* programName */
        GWENVIEW_VERSION); /* version */
    aboutData.setShortDescription(ki18n("An Image Viewer"));
    aboutData.setLicense(KAboutData::License_GPL);
    aboutData.setCopyrightStatement(ki18n("Copyright 2000-2010 Aurélien Gâteau"));
    aboutData.addAuthor(
        ki18n("Aurélien Gâteau"),
        ki18n("Main developer"),
        "[email protected]");

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

    KCmdLineOptions options;
    options.add("f", ki18n("Start in fullscreen mode"));
    options.add("s", ki18n("Start in slideshow mode"));
    options.add("+[file or folder]", ki18n("A starting file or folder"));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;
    Gwenview::ImageFormats::registerPlugins();

    // startHelper must live for the whole live of the application
    StartHelper startHelper;
    if (app.isSessionRestored()) {
        kRestoreMainWindows<Gwenview::MainWindow>();
    } else {
        startHelper.createMainWindow();
    }
    return app.exec();
}
开发者ID:theunbelievablerepo,项目名称:gwenview,代码行数:35,代码来源:main.cpp

示例3: main

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"), "[email protected]");

    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"), "[email protected]");
    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"), "[email protected]");
    about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "[email protected]");
    about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "[email protected]");

    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"), "[email protected]");
    about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "[email protected]");

    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();
}
开发者ID:KDE,项目名称:khipu,代码行数:59,代码来源:main.cpp

示例4: main

int main ( int argc, char **argv ) {
  KAboutData about ( "kmilion", 0, ki18n ( "KMilion" ), version, ki18n ( description ),
                     KAboutData::License_GPL, ki18n ( "(C) 2010 Mikołaj Sochacki" ), KLocalizedString(), 0, "[email protected]" );
  about.addAuthor ( ki18n ( "Mikołaj Sochacki" ), KLocalizedString(), "[email protected]" );
  KCmdLineArgs::init ( argc, argv, &about );

  KCmdLineOptions options;
  options.add ( "+[URL]", ki18n ( "Document to open" ) );
  KCmdLineArgs::addCmdLineOptions ( options );
  KApplication app;
  
  KMilion *widget = new KMilion;
  const QRect r = app.desktop()->frameGeometry();
  widget->setScreenSize ( r.width(), r.height() );
  KCmdLineArgs *args;
  if ( app.isSessionRestored() ) {
      RESTORE ( KMilion );
    }
  else {
      args = KCmdLineArgs::parsedArgs();
      widget->show();
    }
  args->clear();

  // Tak jest w orginale nie mam pojęcia dlaczego? Szczególnie po co kilka razy show!
  //see if we are starting with session management
//     if (app.isSessionRestored())
//     {
//         RESTORE(KMilion);
//     }
//     else
//     {
//         // no session.. just start up normally
//         KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
//         if (args->count() == 0)
//         {
//             //kmilion *widget = new kmilion;
//             widget->show();
//         }
//         else
//         {
//             int i = 0;
//             for (; i < args->count(); i++)
//             {
//                 //kmilion *widget = new kmilion;
//                 widget->show();
//             }
//         }
//         args->clear();
//     }

  return app.exec();
}
开发者ID:mikolajs,项目名称:milionaire,代码行数:53,代码来源:main.cpp

示例5: aboutData

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"),"[email protected]");
    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;
}
开发者ID:KDE,项目名称:kmplayer,代码行数:51,代码来源:main.cpp

示例6: main

int main(int argc, char **argv)
{
    KAboutData about("moviemanager", 0, ki18n("MovieManager"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2012 Sandeep Raju P & Sadan Sohan M"), KLocalizedString(), 0, "[email protected]\[email protected]");
    about.addAuthor( ki18n("Sandeep Raju P"), KLocalizedString(), "[email protected]" );
    about.addAuthor( ki18n("Sadan Sohan M"), KLocalizedString(), "[email protected]" );
    KCmdLineArgs::init(argc, argv, &about);

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

    MovieManager *widget = new MovieManager();

    // see if we are starting with session management
    if (app.isSessionRestored())
    {
        RESTORE(MovieManager);
    }
    else
    {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0)
        {
            //moviemanager *widget = new moviemanager;
            //widget->setMaximumSize(200,200);
            widget->show();
            //mainListScroll->show();
           // widget->mainListScroll->show();

        }
        else
        {
            int i = 0;
            for (; i < args->count(); i++)
            {
                //moviemanager *widget = new moviemanager;
                //widget->setMaximumSize(200,200);
                widget->show();
                //widget->mainListScroll->show();
            }
        }
        args->clear();
    }

    return app.exec();
}
开发者ID:sandeepraju,项目名称:MovieManager,代码行数:49,代码来源:main.cpp

示例7: main

int main(int argc, char *argv[])
{
    KAboutData about("trickle", 0, ki18n("Trickle"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2007-2009 Michael Forney"), KLocalizedString(), 0, "[email protected]");
    about.addAuthor( ki18n("Michael Forney"), KLocalizedString(), "[email protected]" );
    KCmdLineArgs::init(argc, argv, &about);
    KApplication app;
    Trickle * trickle = new Trickle();
    if (app.isSessionRestored())
    {
        RESTORE(Trickle);
    }
    else
    {
        trickle->show();
    }
    app.exec();
    return 0;
}
开发者ID:michaelforney,项目名称:trickle,代码行数:18,代码来源:main.cpp

示例8: main

int main(int argc, char *argv[])
{
    kDebug() << "Hello World!";
    KAboutData aboutData( "ksirk", 0, ki18n("KsirK"),
                          KDE_VERSION_STRING, ki18n(description), KAboutData::License_GPL,
                          ki18n("(c) 2002-2013, Gaël de Chalendar\n"),
                          ki18n("For help and user manual, please see\nthe KsirK web site."));
    aboutData.addAuthor(ki18n("Gael de Chalendar aka Kleag"),KLocalizedString(), "[email protected]");
    aboutData.addAuthor(ki18n("Nemanja Hirsl"),ki18n("Current maintainer"), "[email protected]");
    aboutData.addAuthor(ki18n("Robin Doer"));
    aboutData.addAuthor(ki18n("Albert Astals Cid"));
    aboutData.addAuthor(ki18n("Michal Golunski (Polish translation)"),KLocalizedString(), "[email protected]");
    aboutData.addAuthor(ki18n("French students of the 'IUP ISI 2007-2008':"));
    aboutData.addAuthor(ki18n("&nbsp;&nbsp;Anthony Rey<br/>&nbsp;&nbsp;Benjamin Lucas<br/>&nbsp;&nbsp;Benjamin Moreau<br/>&nbsp;&nbsp;Gaël Clouet<br/>&nbsp;&nbsp;Guillaume Pelouas<br/>&nbsp;&nbsp;Joël Marco<br/>&nbsp;&nbsp;Laurent Dang<br/>&nbsp;&nbsp;Nicolas Linard<br/>&nbsp;&nbsp;Vincent Sac"));
    aboutData.setHomepage("http://games.kde.org/ksirk/");
    KCmdLineArgs::init( argc, argv, &aboutData );

    KCmdLineOptions options;
    options.add("+[File]", ki18n("file to open"));
    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

    KApplication app;
    KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));

    if (app.isSessionRestored())
    {
        RESTORE(Ksirk::KGameWindow);
    }
    else
    {
        kDebug() << "Creating main window";
        Ksirk::KGameWindow *ksirk = new Ksirk::KGameWindow();
//       connect(app,SIGNAL(lastWindowClosed()),app,SLOT(quit()));
//         app.setMainWidget(ksirk);
        ksirk->show();
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        args->clear();
    }
    kDebug() << "Executing app";
    int res =  app.exec();
    KGlobal::locale()->removeCatalog( "libkdegames" );
    return res;
}
开发者ID:KDE,项目名称:ksirk,代码行数:43,代码来源:main.cpp

示例9: main

int main(int argc, char **argv)
{
    KAboutData about("photomanager", 0, ki18n("photomanager"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2012 vvs"), KLocalizedString(), 0, "[email protected]");
    about.addAuthor( ki18n("vvs"), KLocalizedString(), "[email protected]" );
    KCmdLineArgs::init(argc, argv, &about);

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

    photomanager *widget = new photomanager;

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

    return app.exec();
}
开发者ID:sandeepraju,项目名称:kapptemplate,代码行数:42,代码来源:main.cpp

示例10: main

int main(int argc, char **argv)
{
    KAboutData about("kwebcam", 0, ki18n("KWebCam"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) %{CURRENT_YEAR} %{AUTHOR}"), KLocalizedString(), 0, "%{EMAIL}");
    about.addAuthor( ki18n("%{AUTHOR}"), KLocalizedString(), "%{EMAIL}" );
    KCmdLineArgs::init(argc, argv, &about);

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

    KWebCam *widget = new KWebCam;

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

    return app.exec();
}
开发者ID:cojack,项目名称:KWebCam,代码行数:42,代码来源:main.cpp

示例11: main

int main(int argc, char **argv)
{
    KAboutData aboutData( "kreversi", 0, ki18n("KReversi"),
                          "2.0", ki18n(description), KAboutData::License_GPL,
                          ki18n("(c) 1997-2000, Mario Weilguni\n(c) 2004-2006, Inge Wallin\n(c) 2006, Dmitry Suzdalev"),
                          KLocalizedString(), "http://games.kde.org/kreversi" );
    aboutData.addAuthor(ki18n("Mario Weilguni"),ki18n("Original author"), "[email protected]");
    aboutData.addAuthor(ki18n("Inge Wallin"),ki18n("Original author"), "[email protected]");
    aboutData.addAuthor(ki18n("Dmitry Suzdalev"), ki18n("Game rewrite for KDE4. Current maintainer."), "[email protected]");
    aboutData.addCredit(ki18n("Simon Hürlimann"), ki18n("Action refactoring"));
    aboutData.addCredit(ki18n("Mats Luthman"), ki18n("Game engine, ported from his JAVA applet."));
    aboutData.addCredit(ki18n("Arne Klaassen"), ki18n("Original raytraced chips."));
    aboutData.addCredit(ki18n("Mauricio Piacentini"), ki18n("Vector chips and background for KDE4."));
    aboutData.addCredit(ki18n("Brian Croom"), ki18n("Port rendering code to KGameRenderer"), "[email protected]");

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

    KCmdLineOptions options;
    options.add("demo", ki18n( "Start with demo game playing" ));
    KCmdLineArgs::addCmdLineOptions( options );

    KApplication application;
    KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));

    if( application.isSessionRestored() )
    {
        RESTORE(KReversiMainWindow)
    }
    else
    {
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        KReversiMainWindow *mainWin = new KReversiMainWindow( 0, args->isSet( "demo" ) );
	args->clear();
        mainWin->show();
    }

    KExtHighscore::ExtManager highscoresManager;

    return application.exec();
}
开发者ID:bysreg,项目名称:komo,代码行数:40,代码来源:main.cpp

示例12: main

int main(int argc, char **argv)
{
    KAboutData about("webappeditor", 0, ki18n("Selkie Remixer"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("Copyright 2009-2010 Sebastian Kügler"), KLocalizedString(), 0, "[email protected]");
    about.addAuthor( ki18n("Sebastian Kügler"), KLocalizedString(), "[email protected]" );
    KCmdLineArgs::init(argc, argv, &about);

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

    SelkieEditor *widget = 0;
    // see if we are starting with session management
    if (app.isSessionRestored()) {
        //RESTORE(WebAppEditor);
    } else {
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
        if (args->count() == 0) {
            widget = new SelkieEditor(QString());
            //webappeditor *widget = new webappeditor;
            widget->show();
        } else {
            kDebug() << "Loading:" << argv[0];
            widget = new SelkieEditor(argv[1]);
            widget->show();
            /*
            int i = 0;
            for (; i < args->count(); i++) {
                //webappeditor *widget = new webappeditor;
            }
            */
        }
        args->clear();
    }

    return app.exec();
}
开发者ID:KDE,项目名称:silk,代码行数:39,代码来源:selkie-remixer.cpp

示例13: main

int main(int argc, char *argv[])
{
  kDebug() << "Hello World!";
  KAboutData aboutData(
    "ksirkskineditor",
    0,
    ki18n("KsirK Skin Editor"),
    KDE_VERSION_STRING,
    ki18n(description),
    KAboutData::License_GPL,
    ki18n("(c) 2008, Gaël de Chalendar\n"),
    ki18n("For help and user manual, please see\nThe KsirK Web site"),
    "http://games.kde.org/game.php?game=ksirk");
  aboutData.addAuthor(ki18n("Gael de Chalendar aka Kleag"),KLocalizedString(), "[email protected]");

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

  KCmdLineOptions options;
  options.add("+[File]", ki18n("file to open"));
  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

  KApplication app;
  KGlobal::locale()->insertCatalog( QLatin1String( "libkdegames" ));
  if (app.isSessionRestored())
  {
      RESTORE(KsirkSkinEditor::MainWindow);
  }
  else
  {
    kDebug() << "Creating main window";
    KsirkSkinEditor::MainWindow *ksirkskineditor = new KsirkSkinEditor::MainWindow();
    ksirkskineditor->show();
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    args->clear();
  }
  kDebug() << "Executing app";
  return app.exec();
}  
开发者ID:jsj2008,项目名称:kdegames,代码行数:38,代码来源:main.cpp

示例14: main

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, "[email protected]" );
	about.addAuthor ( ki18n ( "Miha Čančula" ), KLocalizedString(), "[email protected]" );
	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();
}
开发者ID:Noughmad,项目名称:Opeke,代码行数:37,代码来源:main.cpp

示例15: main

/**
 * Setting up the KAboutData structure.
 * Parsing and handling of the given command line arguments.
 * @param argc   the number of arguments
 * @param argv   the array of arguments
 * @return exit status
 */
int main(int argc, char *argv[])
{
	KAboutData aboutData( "kompare", 0, ki18n("Kompare"), version, ki18n(description),
	                      KAboutData::License_GPL,
	                      ki18n("(c) 2001-2004 John Firebaugh, (c) 2001-2005,2009 Otto Bruggeman, (c) 2004-2005 Jeff Snyder, (c) 2007-2012 Kevin Kofler") );
	aboutData.addAuthor( ki18n("John Firebaugh"), ki18n("Author"), "[email protected]" );
	aboutData.addAuthor( ki18n("Otto Bruggeman"), ki18n("Author"), "[email protected]" );
	aboutData.addAuthor( ki18n("Jeff Snyder"), ki18n("Developer"), "[email protected]" );
	aboutData.addCredit( ki18n("Kevin Kofler"), ki18n("Maintainer"), "[email protected]" );
	aboutData.addCredit( ki18n("Chris Luetchford"), ki18n("Kompare icon artist"), "[email protected]" );
	aboutData.addCredit( ki18n("Malte Starostik"), ki18n("A lot of good advice"), "[email protected]" );
	aboutData.addCredit( ki18n("Bernd Gehrmann"), ki18n("Cervisia diff viewer"), "[email protected]" );

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

	KCmdLineOptions options;
	options.add("c", ki18n( "This will compare URL1 with URL2" ));
	options.add("o", ki18n( "This will open URL1 and expect it to be diff output. URL1 can also be a '-' and then it will read from standard input. Can be used for instance for cvs diff | kompare -o -. Kompare will do a check to see if it can find the original file(s) and then blend the original file(s) into the diffoutput and show that in the viewer. -n disables the check." ));
	options.add("b", ki18n( "This will blend URL2 into URL1, URL2 is expected to be diff output and URL1 the file or folder that the diffoutput needs to be blended into. " ));
	options.add("n", ki18n( "Disables the check for automatically finding the original file(s) when using '-' as URL with the -o option." ));
	options.add("e <encoding>", ki18n( "Use this to specify the encoding when calling it from the command line. It will default to the local encoding if not specified." ));
	options.add("+[URL1 [URL2]]");
	options.add("+-");
	KCmdLineArgs::addCmdLineOptions( options );
	KApplication kompare;
	bool difault = false;

	KompareShell* ks;

	// see if we are starting with session management
	if (kompare.isSessionRestored())
	{
		RESTORE(KompareShell)
	}
	else
	{
		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

		ks = new KompareShell();
		ks->setObjectName( "FirstKompareShell" );

		kDebug( 8100 ) << "Arg Count = " << args->count() << endl;
		for ( int i=0; i < args->count(); i++ )
		{
			kDebug( 8100 ) << "Argument " << (i+1) << ": " << args->arg( i ) << endl;
		}

		if ( args->isSet( "e" ) )
		{
			// Encoding given...
			// FIXME: Need to implement this...
		}

		if ( args->isSet( "o" ) )
		{
			kDebug( 8100 ) << "Option -o is set" << endl;
			if ( args->count() != 1 )
			{
				difault = true;
			}
			else
			{
				ks->show();
				kDebug( 8100 ) << "OpenDiff..." << endl;
				if ( args->arg(0) == QLatin1String("-") )
					ks->openStdin();
				else
					ks->openDiff( args->url( 0 ) );
				difault = false;
			}
		}
		else if ( args->isSet( "c" ) )
		{
			kDebug( 8100 ) << "Option -c is set" << endl;
			if ( args->count() != 2 )
			{
				KCmdLineArgs::usage( "kompare" );
				difault = true;
			}
			else
			{
				ks->show();
				KUrl url0 = args->url( 0 );
				kDebug( 8100 ) << "URL0 = " << url0.url() << endl;
				KUrl url1 = args->url( 1 );
				kDebug( 8100 ) << "URL1 = " << url1.url() << endl;
				ks->compare( url0, url1 );
				difault = false;
			}
		}
		else if ( args->isSet( "b" ) )
		{
			kDebug( 8100 ) << "Option -b is set" << endl;
//.........这里部分代码省略.........
开发者ID:annulen,项目名称:kompare,代码行数:101,代码来源:main.cpp


注:本文中的KApplication::isSessionRestored方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。