File indexing completed on 2024-04-14 15:49:49
0001 // SPDX-License-Identifier: GPL-3.0-or-later 0002 /* 0003 Copyright 2017 - 2023 Martin Koller, kollix@aon.at 0004 0005 This file is part of liquidshell. 0006 0007 liquidshell is free software: you can redistribute it and/or modify 0008 it under the terms of the GNU General Public License as published by 0009 the Free Software Foundation, either version 3 of the License, or 0010 (at your option) any later version. 0011 0012 liquidshell is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 GNU General Public License for more details. 0016 0017 You should have received a copy of the GNU General Public License 0018 along with liquidshell. If not, see <http://www.gnu.org/licenses/>. 0019 */ 0020 0021 #ifndef _PkUpdates_H_ 0022 #define _PkUpdates_H_ 0023 0024 // software updates via PackageKit 0025 0026 #include <SysTrayItem.hxx> 0027 0028 #include <PackageKit/Daemon> 0029 #include <KNotification> 0030 0031 #include <QMultiMap> 0032 #include <QTimer> 0033 #include <QDateTime> 0034 #include <QPointer> 0035 class PkUpdateList; 0036 0037 class PkUpdates : public SysTrayItem 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 PkUpdates(QWidget *parent); 0043 0044 struct PackageData 0045 { 0046 QString id; 0047 QString summary; 0048 }; 0049 typedef QMultiMap<PackageKit::Transaction::Info, PackageData> PackageList; 0050 0051 protected: 0052 QWidget *getDetailsList() override; 0053 0054 private Q_SLOTS: 0055 void checkForUpdatesReached(); 0056 void checkForUpdates(); 0057 void refreshFinished(PackageKit::Transaction::Exit status, uint runtime); 0058 void package(PackageKit::Transaction::Info info, const QString &packageID, const QString &summary); 0059 void transactionError(PackageKit::Transaction::Error error, const QString &details); 0060 void packageInstalled(const QString &id); 0061 void packageCountToInstallChanged(int num); 0062 0063 private: 0064 void addItems(QString &tooltip, const QList<PackageData> &list) const; 0065 void createToolTip(bool notify = false); 0066 void setRefreshProgress(int progress); 0067 0068 private: 0069 PackageList packages; 0070 QTimer updateTimer; 0071 QDateTime nextCheck; 0072 PkUpdateList *updateList = nullptr; 0073 int refreshProgress = 100; 0074 QPixmap currentPixmap; 0075 QPointer<KNotification> notification; 0076 }; 0077 0078 #endif