2 This file is part of Akonadi.
4 Copyright (c) 2006 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 #include <kaboutdata.h>
23 #include <qapplication.h>
25 #include "instanceselector.h"
27 #include <Kdelibs4ConfigMigrator>
28 #include <KDBusService>
30 #include <QCommandLineParser>
31 #include <QCommandLineOption>
33 #include <QtDBus/QDBusMetaType>
35 int main(int argc
, char **argv
)
37 QApplication
app(argc
, argv
);
38 app
.setAttribute(Qt::AA_UseHighDpiPixmaps
, true);
39 Kdelibs4ConfigMigrator
migrate(QStringLiteral("akonadiconsole"));
40 migrate
.setConfigFiles(QStringList() << QStringLiteral("akonadiconsolerc"));
41 migrate
.setUiFiles(QStringList() << QStringLiteral("akonadiconsoleui.rc"));
44 KAboutData
aboutData(QStringLiteral("akonadiconsole"),
45 QStringLiteral("Akonadi Console"),
46 QStringLiteral("0.99"),
47 QStringLiteral("The Management and Debugging Console for Akonadi"),
49 QStringLiteral("(c) 2006-2015 the Akonadi developer"), QString(),
50 QStringLiteral("https://community.kde.org/KDE_PIM/akonadi"));
51 QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("akonadi")));
52 aboutData
.addAuthor(QStringLiteral("Tobias König"), QStringLiteral("Author"), QStringLiteral("tokoe@kde.org"));
53 aboutData
.addAuthor(QStringLiteral("Volker Krause"), QStringLiteral("Author"), QStringLiteral("vkrause@kde.org"));
54 KAboutData::setApplicationData(aboutData
);
56 QCommandLineParser parser
;
57 parser
.addVersionOption();
58 parser
.addHelpOption();
59 aboutData
.setupCommandLine(&parser
);
60 parser
.addOption(QCommandLineOption(QStringList() << QStringLiteral("remote"), QStringLiteral("Connect to an Akonadi remote debugging server"), QStringLiteral("server")));
63 aboutData
.processCommandLine(&parser
);
67 qRegisterMetaType
<QVector
<QByteArray
>>();
68 qDBusRegisterMetaType
<QVector
<qint64
>>();
69 qDBusRegisterMetaType
<QVector
<QByteArray
>>();
71 if (parser
.isSet(QStringLiteral("remote"))) {
72 const QString akonadiAddr
= QStringLiteral("tcp:host=%1,port=31415").arg(parser
.value(QStringLiteral("remote")));
73 const QString dbusAddr
= QStringLiteral("tcp:host=%1,port=31416").arg(parser
.value(QStringLiteral("remote")));
74 setenv("AKONADI_SERVER_ADDRESS", akonadiAddr
.toLatin1(), 1);
75 setenv("DBUS_SESSION_BUS_ADDRESS", dbusAddr
.toLatin1(), 1);
78 InstanceSelector
instanceSelector(parser
.isSet(QStringLiteral("remote")) ? parser
.value(QStringLiteral("remote")) : QString());