summaryrefslogtreecommitdiffstats
path: root/client/main.cpp
blob: 1748331b63b1d5a90b853ef80bb6f709e6738640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <QApplication>
#include <QCommandLineParser>

#include "common/console.h"
#include "resourceaccess.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    new Console("Akonadi2 Client");

    ResourceAccess *resAccess = 0;
    QCommandLineParser cliOptions;
    cliOptions.addPositionalArgument(QObject::tr("[resource]"),
                                     QObject::tr("A resource to connect to"));
    cliOptions.process(app);
    QStringList resources = cliOptions.positionalArguments();
    if (resources.isEmpty()) {
        resources << "toy";
    }

    for (const QString &resource: resources) {
        resAccess = new ResourceAccess(resource);
        QObject::connect(&app, &QCoreApplication::aboutToQuit,
                        resAccess, &ResourceAccess::close);
        resAccess->open();
    }

    return app.exec();
}