/***************************************************************************
 *   Copyright (C) 2004-2010 by Giovanni Venturi                           *
 *   giovanni@ksniffer.org                                                 *
 *                                                                         *
 *   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.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/

#include <KApplication>
#include <KAboutData>
#include <KCmdLineArgs>
#include <KUrl>
#include <KLocale>

#include "version.h"
#include "mainwindow.h"

int main (int argc, char *argv[])
{
  KAboutData about( "ksniffer", 0,
    ki18n("KSniffer"), APPVER,
    ki18n("A KDE network sniffer application"),
    KAboutData::License_GPL,
    ki18n("Copyright (c) 2004-2010 Giovanni Venturi") );

  about.addAuthor(ki18n("Giovanni Venturi"), KLocalizedString(), "giovanni@ksniffer.org","http://ksniffer.org" );

  KCmdLineArgs::init( argc, argv, &about );

  KCmdLineOptions options;
  options.add("+[file]", ki18n("Document to open"));
  KCmdLineArgs::addCmdLineOptions(options);

  KApplication app;
  MainWindow* window = new MainWindow();
  window->show();

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  if(args->count())
  {
    window->openFile(args->url(0).url());
  }

  return app.exec();
}
