diff options
-rw-r--r-- | client/main.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/client/main.cpp b/client/main.cpp index 2fbb8fe..97d994a 100644 --- a/client/main.cpp +++ b/client/main.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ||
2 | #include <QApplication> | 2 | #include <QApplication> |
3 | #include <QCommandLineParser> | ||
3 | 4 | ||
4 | #include "common/console.h" | 5 | #include "common/console.h" |
5 | #include "resourceaccess.h" | 6 | #include "resourceaccess.h" |
@@ -8,12 +9,24 @@ int main(int argc, char *argv[]) | |||
8 | { | 9 | { |
9 | QApplication app(argc, argv); | 10 | QApplication app(argc, argv); |
10 | 11 | ||
11 | new Console("Toy Client"); | 12 | new Console("Akonadi Next Client"); |
12 | ResourceAccess *resAccess = new ResourceAccess("toyResource"); | ||
13 | 13 | ||
14 | QObject::connect(&app, &QCoreApplication::aboutToQuit, | 14 | ResourceAccess *resAccess = 0; |
15 | resAccess, &ResourceAccess::close); | 15 | QCommandLineParser cliOptions; |
16 | cliOptions.addPositionalArgument(QObject::tr("[resource]"), | ||
17 | QObject::tr("A resource to connect to")); | ||
18 | cliOptions.process(app); | ||
19 | QStringList resources = cliOptions.positionalArguments(); | ||
20 | if (resources.isEmpty()) { | ||
21 | resources << "toy"; | ||
22 | } | ||
23 | |||
24 | for (const QString &resource: cliOptions.positionalArguments()) { | ||
25 | resAccess = new ResourceAccess(resource); | ||
26 | QObject::connect(&app, &QCoreApplication::aboutToQuit, | ||
27 | resAccess, &ResourceAccess::close); | ||
28 | resAccess->open(); | ||
29 | } | ||
16 | 30 | ||
17 | resAccess->open(); | ||
18 | return app.exec(); | 31 | return app.exec(); |
19 | } \ No newline at end of file | 32 | } \ No newline at end of file |