File indexing completed on 2024-05-12 17:07:09

0001 /*
0002     SPDX-FileCopyrightText: 1998 Luca Montecchiani <m.luca@usa.net>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 #include <QObject>
0008 #include <kauth_version.h>
0009 #if KAUTH_VERSION >= QT_VERSION_CHECK(5, 92, 0)
0010 #include <KAuth/ActionReply>
0011 #include <KAuth/HelperSupport>
0012 #else
0013 #include <KAuth>
0014 #endif
0015 
0016 using namespace KAuth;
0017 
0018 class ClockHelper : public QObject
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     enum { CallError = 1 << 0, TimezoneError = 1 << 1, NTPError = 1 << 2, DateError = 1 << 3 };
0024 
0025 public Q_SLOTS:
0026     ActionReply save(const QVariantMap &map);
0027 
0028 private:
0029     int ntp(const QStringList &ntpServers, bool ntpEnabled);
0030     int date(const QString &newdate, const QString &olddate);
0031     int tz(const QString &selectedzone);
0032     int tzreset();
0033 
0034     void toHwclock();
0035 };