File indexing completed on 2024-05-12 05:25:39

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "sieveeditor-version.h"
0008 #include "sieveeditormainwindow.h"
0009 #include <KAboutData>
0010 #include <KCrash>
0011 #include <KDBusService>
0012 #include <KLocalizedString>
0013 #include <QApplication>
0014 #include <QCommandLineParser>
0015 #include <QTextStream>
0016 #ifdef WITH_KUSERFEEDBACK
0017 #include "userfeedback/userfeedbackmanager.h"
0018 #include <KUserFeedback/Provider>
0019 #endif
0020 
0021 int main(int argc, char **argv)
0022 {
0023     QApplication app(argc, argv);
0024     app.setDesktopFileName(QStringLiteral("org.kde.sieveeditor"));
0025     KCrash::initialize();
0026 
0027     KLocalizedString::setApplicationDomain(QByteArrayLiteral("sieveeditor"));
0028 
0029     KAboutData aboutData(QStringLiteral("sieveeditor"),
0030                          i18n("KSieve Editor"),
0031                          QStringLiteral(SIEVEEDITOR_VERSION),
0032                          i18n("Sieve Editor"),
0033                          KAboutLicense::GPL_V2,
0034                          i18n("Copyright © 2013-%1 sieveeditor authors", QStringLiteral("2024")));
0035     aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("montel@kde.org"));
0036 
0037     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("sieveeditor")));
0038     KAboutData::setApplicationData(aboutData);
0039 
0040     QCommandLineParser parser;
0041     aboutData.setupCommandLine(&parser);
0042 #ifdef WITH_KUSERFEEDBACK
0043     const QCommandLineOption feedbackOption(QStringLiteral("feedback"), i18n("Lists the available options for user feedback"));
0044     parser.addOption(feedbackOption);
0045 #endif
0046     parser.process(app);
0047     aboutData.processCommandLine(&parser);
0048 
0049 #ifdef WITH_KUSERFEEDBACK
0050     if (parser.isSet(feedbackOption)) {
0051         QTextStream(stdout) << UserFeedBackManager::self()->userFeedbackProvider()->describeDataSources() << '\n';
0052         return 0;
0053     }
0054 #endif
0055 
0056     KDBusService service(KDBusService::Unique);
0057 
0058     auto mw = new SieveEditorMainWindow();
0059     mw->show();
0060     const int val = app.exec();
0061     return val;
0062 }