File indexing completed on 2024-05-05 17:33:58

0001 /*
0002  *   SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0003  *   SPDX-FileCopyrightText: 2008-2010 Matthias Fuchs <mat69@gmx.net>
0004  *
0005  *   SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef COMICUPDATER_H
0009 #define COMICUPDATER_H
0010 
0011 #include <QTime>
0012 #include <QWidget>
0013 
0014 #include <KConfigGroup>
0015 #include <KNSCore/EntryInternal>
0016 
0017 namespace KNSCore
0018 {
0019 class Engine;
0020 }
0021 
0022 class ComicUpdater : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit ComicUpdater(QObject *parent = nullptr);
0028     ~ComicUpdater() override;
0029 
0030     void init(const KConfigGroup &group);
0031 
0032     void load();
0033     void save();
0034     void setInterval(int interval);
0035     int interval() const;
0036 
0037 private Q_SLOTS:
0038     /**
0039      * Will check if an update is needed, if so will search
0040      * for updates and do them automatically
0041      */
0042     void checkForUpdate();
0043     void slotUpdatesFound(const KNSCore::EntryInternal::List &entries);
0044 
0045 private:
0046     KNSCore::Engine *engine();
0047 
0048 private:
0049     KNSCore::Engine *mEngine;
0050     KConfigGroup mGroup;
0051     int mUpdateIntervall;
0052     QDateTime mLastUpdate;
0053     QTimer *m_updateTimer;
0054     bool mProvidersLoaded;
0055 };
0056 
0057 #endif