KIO
kpasswdserverloop.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <QtDBus/QDBusConnection>
00023 #include <QtDBus/QDBusConnectionInterface>
00024
00025 #include "kpasswdserverloop_p.h"
00026
00027 namespace KIO
00028 {
00029
00030 KPasswdServerLoop::KPasswdServerLoop() : m_seqNr(-1)
00031 {
00032 connect(QDBusConnection::sessionBus().interface(),
00033 SIGNAL(serviceOwnerChanged(QString, QString, QString)),
00034 this,
00035 SLOT(slotServiceOwnerChanged(QString, QString, QString)));
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::slotServiceOwnerChanged(const QString &name, const QString &oldOwner,
00071 const QString &newOwner)
00072 {
00073 Q_UNUSED(oldOwner);
00074
00075 if (newOwner.isEmpty() && name == "org.kde.kded") {
00076 exit(-1);
00077 }
00078 }
00079
00080 }
00081
00082 #include "kpasswdserverloop_p.moc"