1 | /*************************************************************************** |
2 | * Copyright (C) 2013 by Volker Krause <vkrause@kde.org> * |
3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU Library General Public License as * |
6 | * published by the Free Software Foundation; either version 2 of the * |
7 | * License, or (at your option) any later version. * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
13 | * * |
14 | * You should have received a copy of the GNU Library General Public * |
15 | * License along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
18 | ***************************************************************************/ |
19 | |
20 | #include <session.h> |
21 | |
22 | #include <shared/akapplication.h> |
23 | #include <shared/akstandarddirs.h> |
24 | |
25 | #include <QCoreApplication> |
26 | #include <QDebug> |
27 | |
28 | int main(int argc, char **argv) |
29 | { |
30 | AkCoreApplication app(argc, argv); |
31 | app.setDescription(QLatin1String("Akonadi ASAP cat\n" |
32 | "This is a development tool, only use this if you know what you are doing.\n\n" |
33 | "Usage: asapcat [input]" )); |
34 | |
35 | boost::program_options::options_description options; |
36 | options.add_options() |
37 | ("input" , boost::program_options::value<std::string>()->default_value("-" ), "input to read commands from" ); |
38 | app.addCommandLineOptions(options); |
39 | app.addPositionalCommandLineOption("input" , 1); |
40 | |
41 | app.parseCommandLine(); |
42 | |
43 | Session session(QString::fromStdString(app.commandLineArguments()["input" ].as<std::string>())); |
44 | QObject::connect(&session, SIGNAL(disconnected()), QCoreApplication::instance(), SLOT(quit())); |
45 | QMetaObject::invokeMethod(&session, "connectToHost" , Qt::QueuedConnection); |
46 | |
47 | const int result = app.exec(); |
48 | session.printStats(); |
49 | return result; |
50 | } |
51 | |