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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/*
SPDX-FileCopyrightText: 2023 Ilya Katsnelson <me@0upti.me>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include <QCoreApplication>
#include <QDebug>
#include <NetworkManagerQt/GenericTypes>
#include <NetworkManagerQt/SecretAgent>
class TestAgent: public NetworkManager::SecretAgent {
public:
explicit TestAgent(QObject *parent = nullptr)
: NetworkManager::SecretAgent(QStringLiteral("org.kde.plasma.example-agent"), NetworkManager::SecretAgent::Capability::VpnHints, parent)
{
qInfo() << "Starting fake secret agent";
}
public Q_SLOTS:
NMVariantMapMap GetSecrets(const NMVariantMapMap &connection,
const QDBusObjectPath &connection_path,
const QString &setting_name,
const QStringList &hints,
uint flags) override
{
qInfo() << "GetSecrets" \
<< "connection:" << connection \
<< "path:" << connection_path.path() \
<< "name:" << setting_name \
<< "hints:" << hints \
<< "flags:" << flags;
return NMVariantMapMap();
}
void CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name) override
{
qInfo() << "CancelGetSecrets" << "path:" << connection_path.path() << "name:" << setting_name;
}
void SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) override
{
qInfo() << "SaveSecrets" \
<< "connection:" << connection \
<< "path:" << connection_path.path();
}
void DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) override
{
qInfo() << "DeleteSecrets" \
<< "connection:" << connection \
<< "path:" << connection_path.path();
}
};
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
auto agent = TestAgent(&app);
return app.exec();
}
|