/***************************************************************************
 *   Copyright (C) 2005 by Daniel Stöckel                                  *
 *   the_docter@gmx.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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#include "kommando.h"
#include <kuniqueapplication.h> //TODO: Switch this back to kuniqueapplication before release
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kshell.h>
#include <configdialogimpl.h>
#include <config.h>

static const char description[] =
    I18N_NOOP("A wheelmenu for KDE powerusers");

static const char version[] = "0.4.1";

static KCmdLineOptions options[] =
{
    KCmdLineLastOption
};

int main(int argc, char **argv)
{
    KAboutData about("kommando", I18N_NOOP("Kommando"), version, description,
		     KAboutData::License_GPL, "(C) 2006 Daniel Stöckel", 0, 0, "the_docter@gmx.net");
    about.addAuthor( "Daniel Stöckel", 0, "the_docter@gmx.net" );
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions( options );

		//Why allow two instances of Kommando? Makes using DCoP easier too.
		KUniqueApplication app;
		
		ConfigDialogImpl *mainWin = 0;

		/*
		 * Fortunatly there is no session data which needs to be restored
		 * (and probably never will be)
		 * otherwise deriving Kommando from QWidget would not work properly
		 */
		/*if (app.isRestored())
    {
			RESTORE(mainWin);
    }
    else
		{*/
        // no session.. just start up normally
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

        /// @todo do something with the command line args here

		mainWin = new ConfigDialogImpl();

        app.setMainWidget( mainWin );
        args->clear();
	//}

    // mainWin has WDestructiveClose flag by default, so it will delete itself.
    return app.exec();
}
