1 | /* |
---|---|
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2009 Michael Leupold <lemma@confuego.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
6 | */ |
7 | |
8 | #include "kpasswdserverloop_p.h" |
9 | |
10 | #include <QDBusConnection> |
11 | #include <QDBusServiceWatcher> |
12 | |
13 | KPasswdServerLoop::KPasswdServerLoop() |
14 | : m_seqNr(-1) |
15 | { |
16 | QDBusServiceWatcher *watcher = |
17 | new QDBusServiceWatcher(QStringLiteral("org.kde.kpasswdserver6"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this); |
18 | connect(sender: watcher, signal: &QDBusServiceWatcher::serviceUnregistered, context: this, slot: &KPasswdServerLoop::kdedServiceUnregistered); |
19 | } |
20 | |
21 | KPasswdServerLoop::~KPasswdServerLoop() |
22 | { |
23 | } |
24 | |
25 | bool KPasswdServerLoop::waitForResult(qlonglong requestId) |
26 | { |
27 | m_requestId = requestId; |
28 | m_seqNr = -1; |
29 | m_authInfo = KIO::AuthInfo(); |
30 | return (exec() == 0); |
31 | } |
32 | |
33 | qlonglong KPasswdServerLoop::seqNr() const |
34 | { |
35 | return m_seqNr; |
36 | } |
37 | |
38 | const KIO::AuthInfo &KPasswdServerLoop::authInfo() const |
39 | { |
40 | return m_authInfo; |
41 | } |
42 | |
43 | void KPasswdServerLoop::slotQueryResult(qlonglong requestId, qlonglong seqNr, const KIO::AuthInfo &authInfo) |
44 | { |
45 | if (m_requestId == requestId) { |
46 | m_seqNr = seqNr; |
47 | m_authInfo = authInfo; |
48 | exit(returnCode: 0); |
49 | } |
50 | } |
51 | |
52 | void KPasswdServerLoop::kdedServiceUnregistered() |
53 | { |
54 | exit(returnCode: -1); |
55 | } |
56 | |
57 | #include "moc_kpasswdserverloop_p.cpp" |
58 |