NetworkManagerQt

fakenetwork/connection.cpp
1/*
2 SPDX-FileCopyrightText: 2014 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "connection.h"
8
9#include <QDBusConnection>
10#include <QDBusMessage>
11#include <QDBusMetaType>
12#include <QDBusObjectPath>
13
14Connection::Connection(QObject *parent, const NMVariantMapMap &settings)
15 : QObject(parent)
16 , m_unsaved(false)
17 , m_settings(settings)
18{
19 qDBusRegisterMetaType<NMVariantMapMap>();
20}
21
22Connection::~Connection()
23{
24}
25
26bool Connection::unsaved() const
27{
28 return m_unsaved;
29}
30
31void Connection::Delete()
32{
33 // From some reason signal Removed is not send over DBus when using only Q_EMIT
34 QDBusMessage message = QDBusMessage::createSignal(m_connectionPath, QLatin1String("org.kde.fakenetwork.Settings.Connection"), QLatin1String("Removed"));
36 // Q_EMIT Removed();
37
38 // Send it for FakeNetwork as well
39 Q_EMIT connectionRemoved(QDBusObjectPath(m_connectionPath));
40}
41
42NMVariantMapMap Connection::GetSecrets(const QString &setting_name)
43{
44 Q_UNUSED(setting_name)
45 // TODO
46 return NMVariantMapMap();
47}
48
49NMVariantMapMap Connection::GetSettings()
50{
51 // TODO: return settings without secrets
52 return m_settings;
53}
54
55void Connection::Save()
56{
57 // TODO
58}
59
60void Connection::Update(const NMVariantMapMap &properties)
61{
62 m_settings = properties;
63
64 Q_EMIT Updated();
65}
66
67void Connection::UpdateUnsaved(const NMVariantMapMap &properties)
68{
69 Q_UNUSED(properties)
70 // TODO
71}
72
73QString Connection::connectionPath() const
74{
75 return m_connectionPath;
76}
77
78void Connection::setConnectionPath(const QString &path)
79{
80 m_connectionPath = path;
81}
82
83#include "moc_connection.cpp"
QString path(const QString &relativePath)
KGuiItem properties()
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
Q_EMITQ_EMIT
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.