bool KrecipesView::questionRerunWizard( const QString &message, const QString &errormsg, RecipeDB::Error error ) { if ( (error == RecipeDB::FixDbFailed) && (dbType == "SQLite") ) { QString finalMessage = message + ' ' + i18n( "\nYou are using SQLite; this error is often caused by using an SQLite 2 " "database with Krecipes supporting SQLite 3, if this is the case you could run " "the SQLite converter.\n" "What do you want to do?" ); int answer = KMessageBox::questionYesNoCancel( this, finalMessage, "", KGuiItem( i18n("Run the setup assistant"), KIcon("plasmagik") ), KGuiItem( i18n("Run the SQLite converter"), KIcon("document-revert") ), KStandardGuiItem::quit() ); if ( answer == KMessageBox::Yes ) { wizard( true ); } else if ( answer == KMessageBox::No ) { ConvertSQLite3 converter; converter.convert(); } else { kError() << errormsg << ". Exiting" ; kapp->exit( 1 ); exit ( 1 ); //FIXME: why doesn't kapp->exit(1) do anything? return false; } return true; } else { QString finalMessage = message + ' ' + i18n( "\nWould you like to run the setup wizard again? " "Otherwise, the application will be closed." ); int answer = KMessageBox::questionYesNo( this, finalMessage ); if ( answer == KMessageBox::Yes ) wizard( true ); else { kError() << errormsg << ". Exiting" ; kapp->exit( 1 ); exit ( 1 ); //FIXME: why doesn't kapp->exit(1) do anything? return false; } return true; } }
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(); }