/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Fri May 18 23:05:50 EDT 2001
    copyright            : (C) 2001 by Alex Podolsky
    email                : alexpod@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
//#include <kuniqueapp.h>
#include <kapplication.h>
#include <dcopclient.h>

#include <iostream.h>

#include "cdbakeoven.h"

static const char *description =
	I18N_NOOP("Thank you for using CD Bake Oven - CD Burning facility for KDE");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
	
	
static KCmdLineOptions options[] =
{
  { "+[File]", I18N_NOOP("file to open"), 0 },
  { 0, 0, 0 }
  // INSERT YOUR COMMANDLINE OPTIONS HERE
};

int main(int argc, char *argv[]){
	
	KAboutData *aboutData = new KAboutData( "cdbakeoven", I18N_NOOP("CD Bake Oven"),
		"1.8.9", description, KAboutData::License_GPL,
		"(c) 2001, Alexy Podolsky",
		I18N_NOOP("\nThis is free software with ABSOLUTELY NO WARRANTY."
		          "\nUse at your own risk! See --license for more details."),
		"http://cdbakeoven.sourceforge.net");
	aboutData->addAuthor("Alexy Podolsky",
		I18N_NOOP("Had some fun with this program, hope you do too."),
		"alexpod@users.sourceforge.net");
	
	KCmdLineArgs::init( argc, argv, aboutData );
	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
	
	/*if (!KUniqueApplication::start()) {
		cerr << "cdbakeoven is already running!\n";
		return 0;
	}*/
	
	//KUniqueApplication app;
 	KApplication app;

	app.dcopClient()->registerAs("cdbakeoven", false);

	if (app.isRestored()){
		RESTORE(CDBakeOvenApp);
	}
	else{
		CDBakeOvenApp *cdbakeoven = new CDBakeOvenApp();
		app.dcopClient()->setDefaultObject( cdbakeoven->objId() );
		cdbakeoven->show();
    		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
		
		if (args->count()){
        		cdbakeoven->openDocumentFile(args->arg(0));
		}
		else{
			cdbakeoven->tryToShowMainDialog();
		}
		args->clear();
  	}

  	return app.exec();
}  
