File: main.cpp

package info (click to toggle)
kimagemapeditor 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,064 kB
  • sloc: cpp: 6,817; xml: 166; sh: 5; makefile: 3
file content (91 lines) | stat: -rw-r--r-- 3,781 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***************************************************************************
                          main.cpp  -  description
                            -------------------
    begin                : Die Apr 10 19:46:49 CEST 2001
    copyright            : (C) 2001 by Jan Schäfer
    email                : j_schaef@informatik.uni-kl.de
***************************************************************************/

/***************************************************************************
*                                                                         *
*   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 <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDir>

#include <KAboutData>
#include <KLocalizedString>

#include "kimeshell.h"
#include "kimagemapeditor_version.h"

int main(int argc, char *argv[])
{
  QApplication app(argc, argv);
  KLocalizedString::setApplicationDomain("kimagemapeditor");

  KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
    KIMAGEMAPEDITOR_VERSION_STRING, i18n("An HTML imagemap editor"), KAboutLicense::GPL,
    i18n("(c) 2001-2007 Jan Schaefer"), QString(),
    QStringLiteral("https://kde.org/applications/development/org.kde.kimagemapeditor"), QStringLiteral("janschaefer@users.sourceforge.net"));
  aboutData.addAuthor(i18n("Jan Schaefer"),QString(), "janschaefer@users.sourceforge.net");
  aboutData.addCredit(i18n("Joerg Jaspert"),i18n("For helping me with the Makefiles, and creating the Debian package"));
  aboutData.addCredit(i18n("Aaron Seigo and Michael"),i18n("For helping me fixing --enable-final mode"));
  aboutData.addCredit(i18n("Antonio Crevillen"),i18n("For the Spanish translation"));
  aboutData.addCredit(i18n("Fabrice Mous"),i18n("For the Dutch translation"));
  aboutData.addCredit(i18n("Germain Chazot"),i18n("For the French translation"));

  aboutData.setOrganizationDomain("kde.org");
  aboutData.setDesktopFileName(QStringLiteral("org.kde.kimagemapeditor"));
  KAboutData::setApplicationData(aboutData);

  app.setOrganizationName(QStringLiteral("KDE"));

  app.setWindowIcon(QIcon::fromTheme("kimagemapeditor", app.windowIcon()));

  QCommandLineParser parser;
  aboutData.setupCommandLine(&parser);

  parser.addOption(QCommandLineOption(QStringList() << QLatin1String("c") << QLatin1String("stdout"), i18n("Write HTML-Code to stdout on exit")));
  parser.addPositionalArgument(QLatin1String("[File]"), i18n("File to open"));
  parser.process(app);
  aboutData.processCommandLine(&parser);

  if (app.isSessionRestored())
  {
      kRestoreMainWindows<KimeShell>();
  }
  else
  {
      if ( parser.positionalArguments().count() == 0 )
      {
        KimeShell *kimeShell = new KimeShell();
        kimeShell->setStdout(parser.isSet("stdout"));
        kimeShell->readConfig();
        kimeShell->show();
        kimeShell->openLastFile();
      }
      else
      {
          int i = 0;
          for (; i < parser.positionalArguments().count(); i++ )
          {
            KimeShell *kimeShell = new KimeShell();
            kimeShell->setStdout(parser.isSet("stdout"));
            kimeShell->readConfig();
            kimeShell->show();
            kimeShell->openFile(QUrl::fromUserInput(parser.positionalArguments().at(i), QDir::currentPath(), QUrl::AssumeLocalFile));
          }
      }

  }

  return app.exec();
}