KIO
kpasswdserverloop.cpp
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2009 Michael Leupold <lemma@confuego.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) version 3, or any 00009 * later version accepted by the membership of KDE e.V. (or its 00010 * successor approved by the membership of KDE e.V.), which shall 00011 * act as a proxy defined in Section 6 of version 3 of the license. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #include "kpasswdserverloop_p.h" 00023 00024 #include <QtDBus/QDBusConnection> 00025 #include <QtDBus/QDBusServiceWatcher> 00026 00027 namespace KIO 00028 { 00029 00030 KPasswdServerLoop::KPasswdServerLoop() : m_seqNr(-1) 00031 { 00032 QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.kded", QDBusConnection::sessionBus(), 00033 QDBusServiceWatcher::WatchForUnregistration, this); 00034 connect(watcher, SIGNAL(serviceUnregistered(QString)), 00035 this, SLOT(kdedServiceUnregistered())); 00036 } 00037 00038 KPasswdServerLoop::~KPasswdServerLoop() 00039 { 00040 } 00041 00042 bool KPasswdServerLoop::waitForResult(qlonglong requestId) 00043 { 00044 m_requestId = requestId; 00045 m_seqNr = -1; 00046 m_authInfo = AuthInfo(); 00047 return (exec() == 0); 00048 } 00049 00050 qlonglong KPasswdServerLoop::seqNr() const 00051 { 00052 return m_seqNr; 00053 } 00054 00055 const AuthInfo &KPasswdServerLoop::authInfo() const 00056 { 00057 return m_authInfo; 00058 } 00059 00060 void KPasswdServerLoop::slotQueryResult(qlonglong requestId, qlonglong seqNr, 00061 const KIO::AuthInfo &authInfo) 00062 { 00063 if (m_requestId == requestId) { 00064 m_seqNr = seqNr; 00065 m_authInfo = authInfo; 00066 exit(0); 00067 } 00068 } 00069 00070 void KPasswdServerLoop::kdedServiceUnregistered() 00071 { 00072 exit(-1); 00073 } 00074 00075 } 00076 00077 #include "kpasswdserverloop_p.moc"
KDE 4.6 API Reference