KIO

joburlcache.cpp
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
10#ifdef WITH_QTDBUS
11#include "kuiserver_interface.h"
12#endif
13
14class JobUrlCacheSingleton
15{
16public:
17 JobUrlCache instance;
18};
19
20Q_GLOBAL_STATIC(JobUrlCacheSingleton, s_jobUrlCache)
21
22JobUrlCache &JobUrlCache::instance()
23{
24 return s_jobUrlCache()->instance;
25}
26
27JobUrlCache::JobUrlCache()
28 : QObject(nullptr)
29{
30#ifdef WITH_QTDBUS
31 org::kde::kuiserver *interface =
32 new org::kde::kuiserver(QStringLiteral("org.kde.kuiserver"), QStringLiteral("/JobViewServer"), QDBusConnection::sessionBus(), this);
33
34 // connect to receive updates about the job urls
35 connect(interface, &OrgKdeKuiserverInterface::jobUrlsChanged, this, &JobUrlCache::slotJobUrlsChanged);
36
37 // force signal emission
38 interface->emitJobUrlsChanged();
39#endif
40}
41
42JobUrlCache::~JobUrlCache()
43{
44}
45
46void JobUrlCache::slotJobUrlsChanged(const QStringList &urlList)
47{
48 m_destUrls = urlList;
49 Q_EMIT jobUrlsChanged(urlList);
50}
51
52void JobUrlCache::requestJobUrlsChanged()
53{
54 Q_EMIT jobUrlsChanged(m_destUrls);
55}
56
57#include "moc_joburlcache_p.cpp"
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.