/* 
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *         (C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#include <err.h>

#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kuniqueapplication.h>

#include <dbsdglobal.h>
#include <translation.h>
#include <dbsdkiconloader.h>
#include <batterytray.h>
#include <battery.h>

int  main(int argc, char *argv[])
{
	if(!Battery::informationAvailable())
		errx(1, "No battery information available. Exiting.");

   KAboutData  about("dbsd-battinfo", "Battery Info", "", NULL, KAboutData::License_BSD);
   KCmdLineArgs::init(argc, argv, &about);
   KUniqueApplication::addCmdLineOptions();

   if(!KUniqueApplication::start())
   	errx(0, "already running.");
   
   KUniqueApplication  a;
	
	Translation::installTranslator();
	DBSDGlobal::setIconLoader(new DBSDKIconLoader);
   
   BatteryTray  tray;
   a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
   
   tray.show();
   tray.start();
   return  a.exec();
}
