1 | // SPDX-License-Identifier: LGPL-2.1-or-later |
2 | // SPDX-FileCopyrightText: 2002 Cornelius Schumacher <schumacher@kde.org> |
3 | // SPDX-FileCopyrightText: 2003-2007 Josef Spillner <spillner@kde.org> |
4 | // SPDX-FileCopyrightText: 2009 Jeremy Whiting <jpwhiting@kde.org> |
5 | // SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org> |
6 | |
7 | #include "provider.h" |
8 | |
9 | #include <KLocalizedString> |
10 | |
11 | #include <QTimer> |
12 | |
13 | namespace KNSCore |
14 | { |
15 | |
16 | class ProviderPrivate |
17 | { |
18 | public: |
19 | ProviderPrivate(Provider *qq) |
20 | : q(qq) |
21 | { |
22 | } |
23 | Provider *const q; |
24 | QStringList tagFilter; |
25 | QStringList downloadTagFilter; |
26 | |
27 | QTimer *basicsThrottle{nullptr}; |
28 | QString version; |
29 | QUrl website; |
30 | QUrl host; |
31 | QString contactEmail; |
32 | QString name; |
33 | QUrl icon; |
34 | bool supportsSsl{false}; |
35 | bool basicsGot{false}; |
36 | |
37 | void updateOnFirstBasicsGet() |
38 | { |
39 | if (!basicsGot) { |
40 | basicsGot = true; |
41 | QTimer::singleShot(interval: 0, receiver: q, slot: &Provider::loadBasics); |
42 | } |
43 | }; |
44 | void throttleBasics() |
45 | { |
46 | if (!basicsThrottle) { |
47 | basicsThrottle = new QTimer(q); |
48 | basicsThrottle->setInterval(0); |
49 | basicsThrottle->setSingleShot(true); |
50 | QObject::connect(sender: basicsThrottle, signal: &QTimer::timeout, context: q, slot: &Provider::basicsLoaded); |
51 | } |
52 | basicsThrottle->start(); |
53 | } |
54 | }; |
55 | |
56 | } // namespace KNSCore |
57 | |