ModemManagerQt

fakemodem/modemtime.cpp
1/*
2 SPDX-FileCopyrightText: 2015 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 "modemtime.h"
8
9#include <QDBusConnection>
10#include <QDBusMessage>
11
12ModemTime::ModemTime(QObject *parent)
13 : QDBusAbstractAdaptor(parent)
14 , m_enabledNotifications(false)
15{
16}
17
18ModemTime::~ModemTime()
19{
20}
21
22QVariantMap ModemTime::networkTimezone() const
23{
24 return m_timezone;
25}
26
27QString ModemTime::GetNetworkTime()
28{
29 return QStringLiteral("2010-08-06T18:34:14.3+02:00");
30}
31
32void ModemTime::setModemPath(const QString &path)
33{
34 m_modemPath = path;
35}
36
37void ModemTime::setEnableNotifications(bool enable)
38{
39 m_enabledNotifications = enable;
40}
41
42void ModemTime::setNetworkTimezone(const QVariantMap &timezone)
43{
44 m_timezone = timezone;
45
46 if (m_enabledNotifications) {
47 QVariantMap map;
48 map.insert(QLatin1String("NetworkTimezone"), QVariant::fromValue<QVariantMap>(m_timezone));
49 QDBusMessage message = QDBusMessage::createSignal(m_modemPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
50 message << QLatin1String("org.kde.fakemodem.Modem.Time") << map << QStringList();
52 }
53}
54
55QVariantMap ModemTime::toMap() const
56{
57 QVariantMap map;
58 map.insert(QLatin1String(MM_MODEM_TIME_PROPERTY_NETWORKTIMEZONE), QVariant::fromValue<QVariantMap>(m_timezone));
59 return map;
60}
61
62#include "moc_modemtime.cpp"
QString path(const QString &relativePath)
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.