NetworkManagerQt

connection.h
1/*
2 SPDX-FileCopyrightText: 2008, 2009 Will Stephenson <wstephenson@kde.org>
3 SPDX-FileCopyrightText: 2011-2013 Lamarque V. Souza <lamarque@kde.org>
4 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef NETWORKMANAGERQT_SETTINGS_CONNECTION_H
10#define NETWORKMANAGERQT_SETTINGS_CONNECTION_H
11
12#include "connectionsettings.h"
13#include "generictypes.h"
14#include <networkmanagerqt/networkmanagerqt_export.h>
15
16#include <QDBusPendingReply>
17#include <QObject>
18#include <QSharedPointer>
19
20namespace NetworkManager
21{
22class ConnectionPrivate;
23
24/**
25 * This class represents a single network connection configuration.
26 */
27class NETWORKMANAGERQT_EXPORT Connection : public QObject
28{
29 Q_OBJECT
30public:
32 typedef QList<Ptr> List;
33
34 /**
35 * Constructs a connection object for the given path
36 */
37 explicit Connection(const QString &path, QObject *parent = nullptr);
38 ~Connection() override;
39
40 /**
41 * Returns if this connection is valid
42 */
43 bool isValid() const;
44
45 /**
46 * Returns the unique identifier of this connection
47 */
48 QString uuid() const;
49
50 /**
51 * Returns the path (DBus) of this connection
52 */
53 QString path() const;
54
55 /**
56 * Returns the name of this connection
57 */
58 QString name() const;
59 /**
60 * If set, indicates that the in-memory state of the
61 * connection does not match the on-disk state. This flag
62 * will be set when updateUnsaved() is called or when any
63 * connection details change, and cleared when the connection
64 * is saved to disk via save() or from internal operations.
65 *
66 * @since 0.9.9.0
67 */
68 bool isUnsaved() const;
69 /**
70 * Returns the settings of this connection
71 */
72 ConnectionSettings::Ptr settings();
73
74 /**
75 * Retrieves this connections's secrets (passwords and / or encryption keys).
76 *
77 * @param setting the setting identifier.
78 */
79 QDBusPendingReply<NMVariantMapMap> secrets(const QString &setting);
80
81 /**
82 * Update the connection with new @p settings and properties, replacing all previous settings and properties.
83 * Secrets may be part of the update request, and will be either stored in persistent storage or given to a Secret Agent for storage,
84 * depending on the request.
85 */
86 QDBusPendingReply<> update(const NMVariantMapMap &settings);
87 /**
88 * Update the connection with new @p settings and properties (replacing
89 * all previous settings and properties) but do not immediately save
90 * the connection to disk. Secrets may be part of the update request
91 * and may sent to a Secret Agent for storage, depending on the
92 * flags associated with each secret.
93 *
94 * Use the save() method to save these changes to disk. Note
95 * that unsaved changes will be lost if the connection is
96 * reloaded from disk (either automatically on file change or
97 * due to an explicit reloadConnections() call).
98 *
99 * @since 0.9.9.0
100 */
101 QDBusPendingReply<> updateUnsaved(const NMVariantMapMap &settings);
102
103 /**
104 * Saves a "dirty" connection (that had previously been
105 * updated with updateUnsaved()) to persistent storage.
106 *
107 * @since 0.9.9.0
108 */
109 QDBusPendingReply<> save();
110
111 /**
112 * Clear the secrets belonging to this network connection profile.
113 * @since 5.8.0
114 */
115 QDBusPendingReply<> clearSecrets();
116
117 /**
118 * Removes the connection from NetworkManager database,
119 * this operation does not ask for confirmation but
120 * a policykit rule might prevent it from being removed
121 * without the proper password.
122 */
123 QDBusPendingReply<> remove();
124
125Q_SIGNALS:
126 /**
127 * Emitted when the connection settings changes
128 */
129 void updated();
130
131 /**
132 * Emitted when the connection was removed
133 * @param path connections's path.
134 */
135 void removed(const QString &path);
136 /**
137 * Emitted when the connection unsaved state changes
138 */
139 void unsavedChanged(bool unsaved);
140
141private:
142 Q_DECLARE_PRIVATE(Connection)
143
144 ConnectionPrivate *const d_ptr;
145};
146
147}
148#endif // CONNECTION_H
This class represents a single network connection configuration.
Definition connection.h:28
void removed(const QString &path)
Emitted when the connection was removed.
void unsavedChanged(bool unsaved)
Emitted when the connection unsaved state changes.
void updated()
Emitted when the connection settings changes.
This class allows querying the underlying system to discover the available network interfaces and rea...
Definition accesspoint.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.