File indexing completed on 2024-05-12 05:37:21

0001 /*
0002     SPDX-FileCopyrightText: 2007 Aaron Seigo <aseigo@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Plasma5Support/DataEngine>
0010 #include <kpluginfactory.h>
0011 
0012 #include <QDebug>
0013 
0014 /**
0015  * This engine provides the current date and time for a given
0016  * timezone. Optionally it can also provide solar position info.
0017  *
0018  * "Local" is a special source that is an alias for the current
0019  * timezone.
0020  */
0021 class TimeEngine : public Plasma5Support::DataEngine
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     TimeEngine(QObject *parent);
0027     ~TimeEngine() override;
0028 
0029     QStringList sources() const override;
0030 
0031 protected:
0032     bool sourceRequestEvent(const QString &name) override;
0033     bool updateSourceEvent(const QString &source) override;
0034 
0035 protected Q_SLOTS:
0036     void clockSkewed(); // call when system time changed and all clocks should be updated
0037     void tzConfigChanged();
0038 
0039 private Q_SLOTS:
0040     void init();
0041 };