File indexing completed on 2024-04-14 04:16:18

0001 /***************************************************************************
0002                           main.cpp  -  description
0003                             -------------------
0004     begin                : Die Apr 10 19:46:49 CEST 2001
0005     copyright            : (C) 2001 by Jan Schäfer
0006     email                : j_schaef@informatik.uni-kl.de
0007 ***************************************************************************/
0008 
0009 /***************************************************************************
0010 *                                                                         *
0011 *   This program is free software; you can redistribute it and/or modify  *
0012 *   it under the terms of the GNU General Public License as published by  *
0013 *   the Free Software Foundation; either version 2 of the License, or     *
0014 *   (at your option) any later version.                                   *
0015 *                                                                         *
0016 ***************************************************************************/
0017 
0018 #include <QApplication>
0019 #include <QCommandLineParser>
0020 #include <QCommandLineOption>
0021 #include <QDir>
0022 
0023 #include <KAboutData>
0024 #include <KLocalizedString>
0025 
0026 #include "kimeshell.h"
0027 #include "kimagemapeditor_version.h"
0028 
0029 int main(int argc, char *argv[])
0030 {
0031   QApplication app(argc, argv);
0032   KLocalizedString::setApplicationDomain("kimagemapeditor");
0033 
0034   KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
0035     KIMAGEMAPEDITOR_VERSION_STRING, i18n("An HTML imagemap editor"), KAboutLicense::GPL,
0036     i18n("(c) 2001-2007 Jan Schaefer"), QString(),
0037     QStringLiteral("https://kde.org/applications/development/org.kde.kimagemapeditor"), QStringLiteral("janschaefer@users.sourceforge.net"));
0038   aboutData.addAuthor(i18n("Jan Schaefer"),QString(), "janschaefer@users.sourceforge.net");
0039   aboutData.addCredit(i18n("Joerg Jaspert"),i18n("For helping me with the Makefiles, and creating the Debian package"));
0040   aboutData.addCredit(i18n("Aaron Seigo and Michael"),i18n("For helping me fixing --enable-final mode"));
0041   aboutData.addCredit(i18n("Antonio Crevillen"),i18n("For the Spanish translation"));
0042   aboutData.addCredit(i18n("Fabrice Mous"),i18n("For the Dutch translation"));
0043   aboutData.addCredit(i18n("Germain Chazot"),i18n("For the French translation"));
0044 
0045   aboutData.setOrganizationDomain("kde.org");
0046   aboutData.setDesktopFileName(QStringLiteral("org.kde.kimagemapeditor"));
0047   KAboutData::setApplicationData(aboutData);
0048 
0049   app.setOrganizationName(QStringLiteral("KDE"));
0050 
0051   app.setWindowIcon(QIcon::fromTheme("kimagemapeditor", app.windowIcon()));
0052 
0053   QCommandLineParser parser;
0054   aboutData.setupCommandLine(&parser);
0055 
0056   parser.addOption(QCommandLineOption(QStringList() << QLatin1String("c") << QLatin1String("stdout"), i18n("Write HTML-Code to stdout on exit")));
0057   parser.addPositionalArgument(QLatin1String("[File]"), i18n("File to open"));
0058   parser.process(app);
0059   aboutData.processCommandLine(&parser);
0060 
0061   if (app.isSessionRestored())
0062   {
0063       kRestoreMainWindows<KimeShell>();
0064   }
0065   else
0066   {
0067       if ( parser.positionalArguments().count() == 0 )
0068       {
0069         KimeShell *kimeShell = new KimeShell();
0070         kimeShell->setStdout(parser.isSet("stdout"));
0071         kimeShell->readConfig();
0072         kimeShell->show();
0073         kimeShell->openLastFile();
0074       }
0075       else
0076       {
0077           int i = 0;
0078           for (; i < parser.positionalArguments().count(); i++ )
0079           {
0080             KimeShell *kimeShell = new KimeShell();
0081             kimeShell->setStdout(parser.isSet("stdout"));
0082             kimeShell->readConfig();
0083             kimeShell->show();
0084             kimeShell->openFile(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath(), QUrl::AssumeLocalFile));
0085           }
0086       }
0087 
0088   }
0089 
0090   return app.exec();
0091 }