File indexing completed on 2024-12-22 05:01:15

0001 #include <QDebug>
0002 
0003 #include <QCommandLineParser>
0004 #include <QCoreApplication>
0005 
0006 #include "kmailinterface.h"
0007 
0008 int main(int argc, char **argv)
0009 {
0010     qDebug() << "Test KMail D-Bus interface.";
0011 
0012     QCoreApplication app(argc, argv);
0013     QCommandLineParser parser;
0014     parser.addVersionOption();
0015     parser.addHelpOption();
0016     parser.process(app);
0017 
0018     OrgKdeKmailKmailInterface kmailInterface(QStringLiteral("org.kde.kmail"), QStringLiteral("/KMail"), QDBusConnection::sessionBus());
0019     kmailInterface.openComposer(QStringLiteral("to 1"), QString(), QString(), QStringLiteral("First test"), QStringLiteral("simple openComp call"), false);
0020 
0021     QDBusReply<QDBusObjectPath> composerDbusPath =
0022         kmailInterface.openComposer(QStringLiteral("to 2"), QString(), QString(), QStringLiteral("Second test"), QStringLiteral("DBUS ref call"), false);
0023 
0024     if (!composerDbusPath.isValid()) {
0025         qDebug() << "We can't connect to kmail";
0026         exit(1);
0027     }
0028 
0029     qDebug() << "testDBus done.";
0030 
0031     return 0;
0032 }