File indexing completed on 2024-05-12 04:00:58
0001 /* 0002 SPDX-FileCopyrightText: 2023 Ilya Katsnelson <me@0upti.me> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 #include <QCoreApplication> 0007 #include <QDebug> 0008 0009 #include <NetworkManagerQt/GenericTypes> 0010 #include <NetworkManagerQt/SecretAgent> 0011 0012 class TestAgent: public NetworkManager::SecretAgent { 0013 public: 0014 explicit TestAgent(QObject *parent = nullptr) 0015 : NetworkManager::SecretAgent(QStringLiteral("org.kde.plasma.example-agent"), NetworkManager::SecretAgent::Capability::VpnHints, parent) 0016 { 0017 qInfo() << "Starting fake secret agent"; 0018 } 0019 0020 public Q_SLOTS: 0021 NMVariantMapMap GetSecrets(const NMVariantMapMap &connection, 0022 const QDBusObjectPath &connection_path, 0023 const QString &setting_name, 0024 const QStringList &hints, 0025 uint flags) override 0026 { 0027 qInfo() << "GetSecrets" \ 0028 << "connection:" << connection \ 0029 << "path:" << connection_path.path() \ 0030 << "name:" << setting_name \ 0031 << "hints:" << hints \ 0032 << "flags:" << flags; 0033 return NMVariantMapMap(); 0034 } 0035 0036 void CancelGetSecrets(const QDBusObjectPath &connection_path, const QString &setting_name) override 0037 { 0038 qInfo() << "CancelGetSecrets" << "path:" << connection_path.path() << "name:" << setting_name; 0039 } 0040 0041 void SaveSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) override 0042 { 0043 qInfo() << "SaveSecrets" \ 0044 << "connection:" << connection \ 0045 << "path:" << connection_path.path(); 0046 } 0047 0048 void DeleteSecrets(const NMVariantMapMap &connection, const QDBusObjectPath &connection_path) override 0049 { 0050 qInfo() << "DeleteSecrets" \ 0051 << "connection:" << connection \ 0052 << "path:" << connection_path.path(); 0053 } 0054 }; 0055 0056 int main(int argc, char **argv) 0057 { 0058 QCoreApplication app(argc, argv); 0059 auto agent = TestAgent(&app); 0060 return app.exec(); 0061 }