Exemplo n.º 1
0
int main( int argc, char **argv )
{

	qRegisterMetaType<ElementList>();

	options.add("convert-sqlite3", ki18n("Convert the current SQLite 2.x database to SQLite 3 and exit") , 0 );
	options.add( 0, KLocalizedString(), 0 );    


	KAboutData about( "krecipes", 0, ki18n( "Krecipes" ), version, ki18n( "The KDE Cookbook" ), KAboutData::License_GPL, ki18n( "(C) 2003 Unai Garro\n(C) 2004-2006 Jason Kivlighn"), ki18n("This product is RecipeML compatible.\nYou can get more information about this file format in:\nhttp://www.formatdata.com/recipeml" ), "http://krecipes.sourceforge.net/" );
	about.addAuthor( ki18n("Unai Garro"), KLocalizedString(), "*****@*****.**", 0 );
	about.addAuthor( ki18n("Jason Kivlighn"), KLocalizedString(), "*****@*****.**", 0 );
	about.addAuthor( ki18n("Cyril Bosselut"), KLocalizedString(), "*****@*****.**", "http://b1project.com" );

	about.addCredit( ki18n("Colleen Beamer"), ki18n("Testing, bug reports, suggestions"), "*****@*****.**", 0 );
	about.addCredit( ki18n("Robert Wadley"), ki18n("Icons and artwork"), "*****@*****.**", 0 );
	about.addAuthor( ki18n("Daniel Sauvé"), ki18n("Porting to KDE4"), "*****@*****.**", "http://metres.homelinux.com" );

        about.addAuthor( ki18n("Laurent Montel"), ki18n("Porting to KDE4"), "*****@*****.**", 0 );
        about.addAuthor( ki18n("José Manuel Santamaría Lema"), ki18n("Porting to KDE4, current maintainer"), "*****@*****.**", 0 );
        about.addAuthor( ki18n("Martin Engelmann"), ki18n("Porting to KDE4, developer"), "*****@*****.**", 0 );
	
	about.addCredit( ki18n("Patrick Spendrin"), ki18n("Patches to make Krecipes work under Windows"), "*****@*****.**", 0 );
	about.addCredit( ki18n("Mike Ferguson"), ki18n("Help with bugs, patches"), "", 0 );
	about.addCredit( ki18n("Warren Severin"), ki18n("Code to export recipes to *.mx2 files"), "", 0 );
	
	about.addCredit( ki18n("Eduardo Robles Elvira"),
		ki18n("He advised using WebKit to fix printing support during Akademy-es 2010."),
		"*****@*****.**", 0 );
	about.addCredit( ki18n("José Millán Soto"),
		ki18n("He advised using WebKit to fix printing support during Akademy-es 2010."),
		"", 0 );

	about.setTranslator( ki18n( "INSERT YOUR NAME HERE" ), ki18n( "INSERT YOUR EMAIL ADDRESS" ) );
	KCmdLineArgs::init( argc, argv, &about );
	KCmdLineArgs::addCmdLineOptions( options );
	KUniqueApplication::addCmdLineOptions();

	if ( !KUniqueApplication::start() ) {
		std::cerr << "Krecipes is already running!" << std::endl;
		return 0;
	}

	KUniqueApplication app;

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

		QApplication::flush();

		if ( args->isSet("convert-sqlite3") ) {
			ConvertSQLite3 sqliteConverter;
			sqliteConverter.convert();
			return 0;
		}

		Krecipes * widget = new Krecipes;
		app.setTopWidget( widget );
		widget->show();

		args->clear();
	}

	return app.exec();
}
int main(int argc, char **argv)
{
    KAboutData about("kftpgrabber", 0, ki18n("KFTPgrabber"), version, ki18n(description),
                     KAboutData::License_GPL, ki18n("(C) 2008, The KFTPgrabber developers"), KLocalizedString(), "http://www.kftp.org");
    about.addAuthor(ki18n("Jernej Kos"), ki18n("Lead developer"), "*****@*****.**");
    about.addAuthor(ki18n("Markus Brüffer"), ki18n("Developer"), "*****@*****.**");
    
    about.addCredit(ki18n("Lee Joseph"), ki18n("Fedora ambassador responsible for promotion, testing and debugging; also a package maintainer for Fedora-compatible distributions"), "*****@*****.**");
    about.addCredit(ki18n("libssh2 Developers"), ki18n("SSH library"), "*****@*****.**");
    about.addCredit(ki18n("Anthony D. Urso"), ki18n("otpCalc code"));
    about.addCredit(ki18n("Kopete Developers"), ki18n("KopeteBalloon popup code"), "*****@*****.**");
    about.addCredit(ki18n("KSysGuard Developers"), ki18n("Traffic graph widget"), "*****@*****.**");
    about.addCredit(ki18n("Bob Ziuchkovski"), ki18n("Icon design"), "*****@*****.**");
    about.addCredit(ki18n("Tobias Ussing"), ki18n("Testing and debugging"), "*****@*****.**");
    about.addCredit(ki18n("Tim Kosse"), ki18n("Directory parser code"), "*****@*****.**");
    about.addCredit(ki18n("Peter Penz"), ki18n("Listview column handling code"), "*****@*****.**");

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

    KCmdLineOptions options;
    options.add("+[url]", ki18n("An optional URL to connect to"));
    KCmdLineArgs::addCmdLineOptions(options);
    KUniqueApplication app;
    
    if (app.isSessionRestored()) {
      RESTORE(MainWindow);
    } else {
      MainWindow *mainWindow = 0;
      KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

      KSplashScreen *splash = 0L;
      QString splashPath = KStandardDirs::locate("appdata", "kftpgrabber-logo.png");
      if (!KFTPCore::Config::startMinimized() && KFTPCore::Config::showSplash()) {
        // Show the splash screen
        if (!splashPath.isNull()) {
          QPixmap splashImage = QPixmap(splashPath);
          splash = new KSplashScreen(splashImage);
          splash->setMaximumWidth(400);
          splash->show();
        }
      }
      
      mainWindow = new MainWindow();
      if (!KFTPCore::Config::startMinimized())
        mainWindow->show();
        
      // Check if an URL was passed as a command line argument
      if (args->count() == 1) {
        KUrl remoteUrl = args->url(0);
        
        if (!remoteUrl.isLocalFile()) {
          if (!remoteUrl.port())
            remoteUrl.setPort(21);
            
          if (!remoteUrl.hasUser())
            remoteUrl.setUser("anonymous");
            
          if (!remoteUrl.hasPass()) {
            if (!KFTPCore::Config::anonMail().isEmpty())
              remoteUrl.setPass(KFTPCore::Config::anonMail());
            else
              remoteUrl.setPass("*****@*****.**");
          }

          KFTPSession::Manager::self()->spawnRemoteSession(KFTPSession::IgnoreSide, remoteUrl);
        }
      }
        
      if (splash != 0L) {
        splash->finish(mainWindow);
        delete splash;
      }
      
      args->clear();
    }
    
    return app.exec();
}