File indexing completed on 2024-03-24 04:02:47
0001 /* 0002 SPDX-FileCopyrightText: 2014 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "connection.h" 0008 0009 #include <QDBusConnection> 0010 #include <QDBusMessage> 0011 #include <QDBusMetaType> 0012 #include <QDBusObjectPath> 0013 0014 Connection::Connection(QObject *parent, const NMVariantMapMap &settings) 0015 : QObject(parent) 0016 , m_unsaved(false) 0017 , m_settings(settings) 0018 { 0019 qDBusRegisterMetaType<NMVariantMapMap>(); 0020 } 0021 0022 Connection::~Connection() 0023 { 0024 } 0025 0026 bool Connection::unsaved() const 0027 { 0028 return m_unsaved; 0029 } 0030 0031 void Connection::Delete() 0032 { 0033 // From some reason signal Removed is not send over DBus when using only Q_EMIT 0034 QDBusMessage message = QDBusMessage::createSignal(m_connectionPath, QLatin1String("org.kde.fakenetwork.Settings.Connection"), QLatin1String("Removed")); 0035 QDBusConnection::sessionBus().send(message); 0036 // Q_EMIT Removed(); 0037 0038 // Send it for FakeNetwork as well 0039 Q_EMIT connectionRemoved(QDBusObjectPath(m_connectionPath)); 0040 } 0041 0042 NMVariantMapMap Connection::GetSecrets(const QString &setting_name) 0043 { 0044 Q_UNUSED(setting_name) 0045 // TODO 0046 return NMVariantMapMap(); 0047 } 0048 0049 NMVariantMapMap Connection::GetSettings() 0050 { 0051 // TODO: return settings without secrets 0052 return m_settings; 0053 } 0054 0055 void Connection::Save() 0056 { 0057 // TODO 0058 } 0059 0060 void Connection::Update(const NMVariantMapMap &properties) 0061 { 0062 m_settings = properties; 0063 0064 Q_EMIT Updated(); 0065 } 0066 0067 void Connection::UpdateUnsaved(const NMVariantMapMap &properties) 0068 { 0069 Q_UNUSED(properties) 0070 // TODO 0071 } 0072 0073 QString Connection::connectionPath() const 0074 { 0075 return m_connectionPath; 0076 } 0077 0078 void Connection::setConnectionPath(const QString &path) 0079 { 0080 m_connectionPath = path; 0081 } 0082 0083 #include "moc_connection.cpp"