File indexing completed on 2024-05-19 05:13:17
0001 /* 0002 This file is part of Akonadi. 0003 0004 SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "akonadiconsole-version.h" 0010 #include "instanceselector.h" 0011 0012 #include <KAboutData> 0013 #include <KCrash> 0014 #include <KDBusService> 0015 #include <KLocalizedString> 0016 0017 #include <QApplication> 0018 #include <QCommandLineOption> 0019 #include <QCommandLineParser> 0020 #include <QDBusMetaType> 0021 0022 int main(int argc, char **argv) 0023 { 0024 QApplication app(argc, argv); 0025 KLocalizedString::setApplicationDomain(QByteArrayLiteral("akonadiconsole")); 0026 KAboutData aboutData(QStringLiteral("akonadiconsole"), 0027 i18n("Akonadi Console"), 0028 QStringLiteral(KDEPIM_VERSION), 0029 i18n("The Management and Debugging Console for Akonadi"), 0030 KAboutLicense::GPL, 0031 i18n("(c) 2006-2024 the Akonadi developer"), 0032 QString(), 0033 QStringLiteral("https://community.kde.org/KDE_PIM/akonadi")); 0034 QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("akonadi"))); 0035 aboutData.addAuthor(QStringLiteral("Tobias König"), i18n("Author"), QStringLiteral("tokoe@kde.org")); 0036 aboutData.addAuthor(QStringLiteral("Volker Krause"), i18n("Author"), QStringLiteral("vkrause@kde.org")); 0037 aboutData.setProductName(QByteArrayLiteral("Akonadi/akonadiconsole")); 0038 KAboutData::setApplicationData(aboutData); 0039 0040 KCrash::initialize(); 0041 QCommandLineParser parser; 0042 aboutData.setupCommandLine(&parser); 0043 const QCommandLineOption remoteOption = QCommandLineOption(QStringList() << QStringLiteral("remote"), 0044 QStringLiteral("Connect to an Akonadi remote debugging server"), 0045 QStringLiteral("server")); 0046 parser.addOption(remoteOption); 0047 0048 parser.process(app); 0049 aboutData.processCommandLine(&parser); 0050 0051 KDBusService service; 0052 0053 qRegisterMetaType<QList<QByteArray>>(); 0054 qDBusRegisterMetaType<QList<qint64>>(); 0055 qDBusRegisterMetaType<QList<QByteArray>>(); 0056 0057 if (parser.isSet(remoteOption)) { 0058 const QString akonadiAddr = QStringLiteral("tcp:host=%1,port=31415").arg(parser.value(QStringLiteral("remote"))); 0059 const QString dbusAddr = QStringLiteral("tcp:host=%1,port=31416").arg(parser.value(QStringLiteral("remote"))); 0060 qputenv("AKONADI_SERVER_ADDRESS", akonadiAddr.toLatin1()); 0061 qputenv("DBUS_SESSION_BUS_ADDRESS", dbusAddr.toLatin1()); 0062 } 0063 0064 InstanceSelector instanceSelector(parser.isSet(remoteOption) ? parser.value(remoteOption) : QString()); 0065 0066 return app.exec(); 0067 }