-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathPkUpdateList.hxx
132 lines (103 loc) · 3.34 KB
/
PkUpdateList.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
This file is part of liquidshell.
SPDX-FileCopyrightText: 2017 - 2024 Martin Koller <kollix@aon.at>
SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef _PkUpdateList_H_
#define _PkUpdateList_H_
#include <PkUpdates.hxx>
#include <QScrollArea>
#include <QQueue>
#include <QPointer>
#include <QSet>
#include <QMultiHash>
class QCheckBox;
class QProgressBar;
class QVBoxLayout;
class QToolButton;
class QPushButton;
class QLabel;
class QLineEdit;
class QMenu;
class PkUpdateList : public QWidget
{
Q_OBJECT
public:
PkUpdateList(QWidget *parent);
void setPackages(const PkUpdates::PackageList &packages);
void setRefreshProgress(int progress);
bool isInstallInProgress() const { return !installQ.isEmpty(); }
QSize sizeHint() const override;
protected:
void hideEvent(QHideEvent *event) override;
Q_SIGNALS:
void refreshRequested();
void packageInstalled(QString id);
void packageCountToInstall(int num);
private Q_SLOTS:
void checkAll(bool on);
void install();
void installOne();
void countChecked();
void filterChanged(const QString &text);
void askEULA(const QString &eulaID, const QString &packageID,
const QString &vendor, const QString &licenseAgreement);
private: // methods
void enqueue(const QString &packageID);
private: // members
QVBoxLayout *vbox;
QScrollArea *scrollArea;
QVBoxLayout *itemsLayout;
QLineEdit *filterEdit;
QProgressBar *progressBar;
QToolButton *installButton;
QMenu *installMenu;
QToolButton *refreshButton;
QCheckBox *checkAllBox;
QSize savedSize;
enum class AfterInstall { Nothing, Sleep, Shutdown } afterInstall = AfterInstall::Nothing;
QQueue<QPointer<class PkUpdateListItem>> installQ;
QPointer<PackageKit::Transaction> transaction;
bool packageNoLongerAvailable;
struct EulaPackage
{
EulaPackage(const QString &e, const QString &p) : eulaID(e), packageID(p) { }
QString eulaID;
QString packageID;
};
QMultiHash<QString, EulaPackage> eulaDialogs; // key = license text hash
QSet<QByteArray> acceptedEula;
PackageKit::Transaction::Restart restart;
};
//--------------------------------------------------------------------------------
class PkUpdateListItem : public QWidget
{
Q_OBJECT
public:
PkUpdateListItem(QWidget *parent, PackageKit::Transaction::Info info, const PkUpdates::PackageData &data);
void showProgress(bool yes);
PkUpdates::PackageData package;
QToolButton *label;
QCheckBox *checkBox;
QProgressBar *progress;
QLabel *detailsLabel;
QLabel *errorLabel;
QLabel *packageLabel;
Q_SIGNALS:
void toggled();
private Q_SLOTS:
void getUpdateDetails();
void updateDetail(const QString &packageID,
const QStringList &updates,
const QStringList &obsoletes,
const QStringList &vendorUrls,
const QStringList &bugzillaUrls,
const QStringList &cveUrls,
PackageKit::Transaction::Restart restart,
const QString &updateText,
const QString &changelog,
PackageKit::Transaction::UpdateState state,
const QDateTime &issued,
const QDateTime &updated);
};
#endif