1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2009 Shaun Reich <shaun.reich@kdemail.net> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #include "joburlcache_p.h" |
9 | #include "kuiserver_interface.h" |
10 | |
11 | class JobUrlCacheSingleton |
12 | { |
13 | public: |
14 | JobUrlCache instance; |
15 | }; |
16 | |
17 | Q_GLOBAL_STATIC(JobUrlCacheSingleton, s_jobUrlCache) |
18 | |
19 | JobUrlCache &JobUrlCache::instance() |
20 | { |
21 | return s_jobUrlCache()->instance; |
22 | } |
23 | |
24 | JobUrlCache::JobUrlCache() |
25 | : QObject(nullptr) |
26 | { |
27 | org::kde::kuiserver *interface = |
28 | new org::kde::kuiserver(QStringLiteral("org.kde.kuiserver" ), QStringLiteral("/JobViewServer" ), QDBusConnection::sessionBus(), this); |
29 | |
30 | // connect to receive updates about the job urls |
31 | connect(sender: interface, signal: &OrgKdeKuiserverInterface::jobUrlsChanged, context: this, slot: &JobUrlCache::slotJobUrlsChanged); |
32 | |
33 | // force signal emission |
34 | interface->emitJobUrlsChanged(); |
35 | } |
36 | |
37 | JobUrlCache::~JobUrlCache() |
38 | { |
39 | } |
40 | |
41 | void JobUrlCache::slotJobUrlsChanged(const QStringList &urlList) |
42 | { |
43 | m_destUrls = urlList; |
44 | Q_EMIT jobUrlsChanged(urlList); |
45 | } |
46 | |
47 | void JobUrlCache::requestJobUrlsChanged() |
48 | { |
49 | Q_EMIT jobUrlsChanged(m_destUrls); |
50 | } |
51 | |
52 | #include "moc_joburlcache_p.cpp" |
53 | |