void KrecipesView::initDatabase()
{

	KConfigGroup config = KGlobal::config()->group( "DBType" );
	dbType = checkCorrectDBType( config );



	// Open the database
	database = RecipeDB::createDatabase( dbType );
	if ( !database ) {
		// No DB type has been enabled(should not happen at all, but just in case)

		kError() << i18n( "Code error. No DB support was built in. Exiting" ) ;
		kapp->exit( 1 );
	}

	RecipeDB::Error connectError = database->connect();

	while ( !database->ok() ) {
		// Ask the user if he wants to rerun the wizard
		bool rerun = questionRerunWizard( database->err(),
			i18n( "Unable to open database" ), connectError);
		if ( !rerun )
			break;

		// Reread the configuration file.
		// The user may have changed the data and/or DB type

		KConfigGroup grp = KGlobal::config()->group( "DBType" );
		dbType = checkCorrectDBType( grp );

		delete database;
		database = RecipeDB::createDatabase( dbType );
		if ( database )
			connectError = database->connect();
		else {
			// No DB type has been enabled (should not happen at all, but just in case)

			kError() << i18n( "Code error. No DB support was built in. Exiting" ) ;
			kapp->exit( 1 );
			break;
		}
	}
	kDebug() << i18n( "DB started correctly\n" ).toLatin1();
}
void KrecipesView::initDatabase()
{

	KConfigGroup config = KGlobal::config()->group( "DBType" );
	dbType = checkCorrectDBType( config );



	 
	database = RecipeDB::createDatabase( dbType );
	if ( !database ) {
		 

		kError() << i18n( "Code error. No DB support was built in. Exiting" ) ;
		kapp->exit( 1 );
	}

	RecipeDB::Error connectError = database->connect();

	while ( !database->ok() ) {
		 
		bool rerun = questionRerunWizard( database->err(),
			i18n( "Unable to open database" ), connectError);
		if ( !rerun )
			break;

		 
		 

		KConfigGroup grp = KGlobal::config()->group( "DBType" );
		dbType = checkCorrectDBType( grp );

		delete database;
		database = RecipeDB::createDatabase( dbType );
		if ( database )
			connectError = database->connect();
		else {
			 

			kError() << i18n( "Code error. No DB support was built in. Exiting" ) ;
			kapp->exit( 1 );
			break;
		}
	}
	kDebug() << i18n( "DB started correctly\n" ).toLatin1();
}