connectivity-api: connectivityqt/vpn-connection.h Source File

connectivity-api

vpn-connection.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Pete Woods <pete.woods@canonical.com>
18 */
19
20 #pragma once
21
22 #include <QDBusConnection>
23 #include <QDBusObjectPath>
24 #include <QObject>
25
26 #include <unity/util/DefinesPtrs.h>
27
28 namespace connectivityqt
29 {
30
31 class Q_DECL_EXPORT VpnConnection : public QObject
32 {
33 Q_OBJECT
34
35 public:
36 UNITY_DEFINES_PTRS(VpnConnection);
37
38 Q_ENUMS(Type)
39
40 enum Type
41 {
42 OPENVPN,
43 PPTP
44 };
45
46 VpnConnection(const QDBusObjectPath& path, const QDBusConnection& connection, QObject* parent = 0);
47
48 virtual ~VpnConnection();
49
50 Q_PROPERTY(QDBusObjectPath path READ path)
51 QDBusObjectPath path() const;
52
53 Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged)
54 QString id() const;
55
56 Q_PROPERTY(bool neverDefault READ neverDefault WRITE setNeverDefault NOTIFY neverDefaultChanged)
57 bool neverDefault() const;
58
59 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
60 bool active() const;
61
62 Q_PROPERTY(bool activatable READ activatable NOTIFY activatableChanged)
63 bool activatable() const;
64
65 Q_PROPERTY(Type type READ type)
66 virtual Type type() const = 0;
67
68 public Q_SLOTS:
69 void setId(const QString& id) const;
70
71 void setNeverDefault(bool neverDefault) const;
72
73 void setActive(bool active) const;
74
75 void updateSecrets() const;
76
77 Q_SIGNALS:
78 void idChanged(const QString& id);
79
80 void neverDefaultChanged(bool neverDefault);
81
82 void activeChanged(bool active);
83
84 void activatableChanged(bool active);
85
86 void remove() const;
87
88 protected:
89 class Priv;
90 std::shared_ptr<Priv> d;
91 };
92
93 }
94
95 Q_DECLARE_METATYPE(connectivityqt::VpnConnection::Type)
connectivityqt::VpnConnection
Definition: vpn-connection.h:32
connectivityqt::VpnConnection::UNITY_DEFINES_PTRS
UNITY_DEFINES_PTRS(VpnConnection)
connectivityqt
Definition: connectivity.cpp:37
connectivityqt::VpnConnection::Type
Type
Definition: vpn-connection.h:41
connectivityqt::VpnConnection::OPENVPN
@ OPENVPN
Definition: vpn-connection.h:42