File indexing completed on 2024-12-22 05:00:57

0001 /*
0002   This file is part of KTnef.
0003 
0004   SPDX-FileCopyrightText: 2002 Michael Goffioul <kdeprint@swing.be>
0005   SPDX-FileCopyrightText: 2012 Allen Winter <winter@kde.org>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later
0008 
0009   You should have received a copy of the GNU General Public License
0010   along with this program; if not, write to the Free Software Foundation,
0011   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
0012 */
0013 
0014 #include "ktnef-version.h"
0015 #include "ktnefmain.h"
0016 
0017 #include <KAboutData>
0018 #include <KCrash>
0019 #include <KDBusService>
0020 #include <KLocalizedString>
0021 #include <QApplication>
0022 #include <QCommandLineParser>
0023 
0024 int main(int argc, char *argv[])
0025 {
0026     QApplication app(argc, argv);
0027     KLocalizedString::setApplicationDomain(QByteArrayLiteral("ktnef"));
0028     KCrash::initialize();
0029 
0030     KAboutData aboutData(QStringLiteral("ktnef"),
0031                          i18n("KTnef"),
0032                          QStringLiteral(KTNEF_VERSION),
0033                          i18n("Viewer for mail attachments using TNEF format"),
0034                          KAboutLicense::GPL,
0035                          i18n("Copyright 2000 Michael Goffioul \nCopyright 2012  Allen Winter"));
0036 
0037     aboutData.addAuthor(i18n("Michael Goffioul"), i18n("Author"), QStringLiteral("kdeprint@swing.be"));
0038 
0039     aboutData.addAuthor(i18n("Allen Winter"), i18n("Author, Ported to Qt4/KDE4"), QStringLiteral("winter@kde.org"));
0040 
0041     KAboutData::setApplicationData(aboutData);
0042 
0043     QCommandLineParser parser;
0044     parser.setApplicationDescription(QApplication::applicationDisplayName());
0045     parser.addPositionalArgument(QStringLiteral("file"), i18n("An optional argument 'file' "), QStringLiteral("[file]"));
0046 
0047     aboutData.setupCommandLine(&parser);
0048     parser.process(app);
0049     aboutData.processCommandLine(&parser);
0050     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kmail")));
0051 
0052     KDBusService service;
0053 
0054     auto tnef = new KTNEFMain();
0055     tnef->show();
0056     const QStringList &args = parser.positionalArguments();
0057 
0058     if (!args.isEmpty()) {
0059         tnef->loadFile(args.constFirst());
0060     }
0061 
0062     return app.exec();
0063 }