1/*
2 SPDX-FileCopyrightText: 2017 Elvis Angelaccio <elvis.angelaccio@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#undef QT_NO_CAST_FROM_ASCII
8
9#include <KAuth/Action>
10#include <KAuth/ExecuteJob>
11
12#include <QCoreApplication>
13#include <QDebug>
14
15using namespace KAuth;
16
17int main(int argc, char **argv)
18{
19 QCoreApplication app(argc, argv);
20
21 QString filename = "foo.txt";
22
23 //! [client_how_to_call_helper]
24 QVariantMap args;
25 args["filename"] = filename;
26 Action readAction("org.kde.kf6auth.example.read");
27 readAction.setHelperId("org.kde.kf6auth.example");
28 readAction.setArguments(args);
29 ExecuteJob *job = readAction.execute();
30 if (!job->exec()) {
31 qDebug() << "KAuth returned an error code:" << job->error();
32 } else {
33 QString contents = job->data()["contents"].toString();
34 qDebug() << "KAuth succeeded. Contents: " << contents;
35 }
36 //! [client_how_to_call_helper]
37
38 return app.exec();
39}
40

source code of kauth/examples/client.cpp