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

0001 /*
0002   This file is part of KOrganizer.
0003 
0004   SPDX-FileCopyrightText: 1997-1999 Preston Brown <pbrown@kde.org>
0005   SPDX-FileCopyrightText: 2001, 2003 Cornelius Schumacher <schumacher@kde.org>
0006 
0007   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0008 */
0009 
0010 #include "aboutdata.h"
0011 #include "koapp.h"
0012 #include "korganizer.h"
0013 #include "korganizer_debug.h"
0014 #include "korganizer_options.h"
0015 #include <KConfig>
0016 #include <KConfigGroup>
0017 #include <KCrash>
0018 #include <KLocalizedString>
0019 
0020 #ifdef WITH_KUSERFEEDBACK
0021 #include "userfeedback/korganizeruserfeedbackprovider.h"
0022 #endif
0023 int main(int argc, char **argv)
0024 {
0025     KOrganizerApp app(argc, &argv);
0026     KCrash::initialize();
0027     KLocalizedString::setApplicationDomain(QByteArrayLiteral("korganizer"));
0028 
0029     KOrg::AboutData aboutData;
0030     app.setAboutData(aboutData);
0031 
0032     QCommandLineParser *cmdArgs = app.cmdArgs();
0033     korganizer_options(cmdArgs);
0034 
0035     const QStringList args = QApplication::arguments();
0036     cmdArgs->process(args);
0037     aboutData.processCommandLine(cmdArgs);
0038     QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("korganizer")));
0039 
0040 #ifdef WITH_KUSERFEEDBACK
0041     if (cmdArgs->isSet(QStringLiteral("feedback"))) {
0042         auto userFeedBackProvider = new KOrganizerUserFeedbackProvider(nullptr);
0043         QTextStream(stdout) << userFeedBackProvider->describeDataSources() << '\n';
0044         delete userFeedBackProvider;
0045         return 0;
0046     }
0047 #endif
0048     if (!KOrganizerApp::start(args)) {
0049         qCDebug(KORGANIZER_LOG) << "korganizer already running, exiting";
0050         return 0;
0051     }
0052 
0053     if (app.isSessionRestored()) {
0054         kRestoreMainWindows<KOrganizer>();
0055     }
0056 
0057     // information for the reminder daemon
0058     KConfig cfg(QStringLiteral("defaultcalendarrc"));
0059     KConfigGroup grp(&cfg, QStringLiteral("General"));
0060     grp.writeEntry(QStringLiteral("ApplicationId"), QStringLiteral("org.kde.korganizer"));
0061 
0062     return app.exec();
0063 }