File indexing completed on 2024-04-21 05:50:56

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #include "alarmchecker.h"
0008 
0009 #ifndef Q_OS_ANDROID
0010 #include <QDBusInterface>
0011 #include <QDBusConnection>
0012 #include <QDBusReply>
0013 #endif
0014 
0015 
0016 AlarmChecker::AlarmChecker(QObject *parent) : QObject {parent}
0017 {
0018 #ifndef Q_OS_ANDROID
0019     m_interface = new QDBusInterface {QStringLiteral("org.kde.kongressac"), QStringLiteral("/kongressac"), QStringLiteral("org.kde.kongressac"), QDBusConnection::sessionBus(), this};
0020 #endif
0021 }
0022 
0023 void AlarmChecker::scheduleAlarmCheck()
0024 {
0025 #ifndef Q_OS_ANDROID
0026     m_interface->call(QStringLiteral("scheduleAlarmCheck"));
0027 #endif
0028 }
0029 
0030 int AlarmChecker::active()
0031 {
0032 #ifndef Q_OS_ANDROID
0033     auto kongressacActive {false};
0034 
0035     QDBusReply<int> reply = m_interface->call(QStringLiteral("active"));
0036     if (reply.isValid()) {
0037         kongressacActive = reply.value();
0038     }
0039 
0040     return kongressacActive;
0041 #else
0042     return false;
0043 #endif
0044 }
0045 
0046 #include "moc_alarmchecker.cpp"