File indexing completed on 2023-09-24 04:08:37
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2009 Michael Leupold <lemma@confuego.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #include "kpasswdserverloop_p.h" 0009 0010 #include <QDBusConnection> 0011 #include <QDBusServiceWatcher> 0012 0013 KPasswdServerLoop::KPasswdServerLoop() 0014 : m_seqNr(-1) 0015 { 0016 QDBusServiceWatcher *watcher = 0017 new QDBusServiceWatcher(QStringLiteral("org.kde.kpasswdserver"), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this); 0018 connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &KPasswdServerLoop::kdedServiceUnregistered); 0019 } 0020 0021 KPasswdServerLoop::~KPasswdServerLoop() 0022 { 0023 } 0024 0025 bool KPasswdServerLoop::waitForResult(qlonglong requestId) 0026 { 0027 m_requestId = requestId; 0028 m_seqNr = -1; 0029 m_authInfo = KIO::AuthInfo(); 0030 return (exec() == 0); 0031 } 0032 0033 qlonglong KPasswdServerLoop::seqNr() const 0034 { 0035 return m_seqNr; 0036 } 0037 0038 const KIO::AuthInfo &KPasswdServerLoop::authInfo() const 0039 { 0040 return m_authInfo; 0041 } 0042 0043 void KPasswdServerLoop::slotQueryResult(qlonglong requestId, qlonglong seqNr, const KIO::AuthInfo &authInfo) 0044 { 0045 if (m_requestId == requestId) { 0046 m_seqNr = seqNr; 0047 m_authInfo = authInfo; 0048 exit(0); 0049 } 0050 } 0051 0052 void KPasswdServerLoop::kdedServiceUnregistered() 0053 { 0054 exit(-1); 0055 } 0056 0057 #include "moc_kpasswdserverloop_p.cpp"