KIO

kpasswdserverloop.cpp
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
13KPasswdServerLoop::KPasswdServerLoop()
14 : m_seqNr(-1)
15{
16 QDBusServiceWatcher *watcher =
17 new QDBusServiceWatcher(QStringLiteral("org.kde.kpasswdserver6"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this);
18 connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &KPasswdServerLoop::kdedServiceUnregistered);
19}
20
21KPasswdServerLoop::~KPasswdServerLoop()
22{
23}
24
25bool KPasswdServerLoop::waitForResult(qlonglong requestId)
26{
27 m_requestId = requestId;
28 m_seqNr = -1;
29 m_authInfo = KIO::AuthInfo();
30 return (exec() == 0);
31}
32
33qlonglong KPasswdServerLoop::seqNr() const
34{
35 return m_seqNr;
36}
37
38const KIO::AuthInfo &KPasswdServerLoop::authInfo() const
39{
40 return m_authInfo;
41}
42
43void 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(0);
49 }
50}
51
52void KPasswdServerLoop::kdedServiceUnregistered()
53{
54 exit(-1);
55}
56
57#include "moc_kpasswdserverloop_p.cpp"
This class is intended to make it easier to prompt for, cache and retrieve authorization information.
QDBusConnection sessionBus()
void serviceUnregistered(const QString &serviceName)
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 Fri Dec 27 2024 11:48:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.