• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
kpasswdserverloop.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2009 Michael Leupold <lemma@confuego.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) version 3, or any
9  * later version accepted by the membership of KDE e.V. (or its
10  * successor approved by the membership of KDE e.V.), which shall
11  * act as a proxy defined in Section 6 of version 3 of the license.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "kpasswdserverloop_p.h"
23 
24 #include <QtDBus/QDBusConnection>
25 #include <QtDBus/QDBusServiceWatcher>
26 
27 namespace KIO
28 {
29 
30 KPasswdServerLoop::KPasswdServerLoop() : m_seqNr(-1)
31 {
32  QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.kded", QDBusConnection::sessionBus(),
33  QDBusServiceWatcher::WatchForUnregistration, this);
34  connect(watcher, SIGNAL(serviceUnregistered(QString)),
35  this, SLOT(kdedServiceUnregistered()));
36 }
37 
38 KPasswdServerLoop::~KPasswdServerLoop()
39 {
40 }
41 
42 bool KPasswdServerLoop::waitForResult(qlonglong requestId)
43 {
44  m_requestId = requestId;
45  m_seqNr = -1;
46  m_authInfo = AuthInfo();
47  return (exec() == 0);
48 }
49 
50 qlonglong KPasswdServerLoop::seqNr() const
51 {
52  return m_seqNr;
53 }
54 
55 const AuthInfo &KPasswdServerLoop::authInfo() const
56 {
57  return m_authInfo;
58 }
59 
60 void KPasswdServerLoop::slotQueryResult(qlonglong requestId, qlonglong seqNr,
61  const KIO::AuthInfo &authInfo)
62 {
63  if (m_requestId == requestId) {
64  m_seqNr = seqNr;
65  m_authInfo = authInfo;
66  exit(0);
67  }
68 }
69 
70 void KPasswdServerLoop::kdedServiceUnregistered()
71 {
72  exit(-1);
73 }
74 
75 }
76 
77 #include "kpasswdserverloop_p.moc"
KIO::KPasswdServerLoop::waitForResult
bool waitForResult(qlonglong requestId)
Definition: kpasswdserverloop.cpp:42
KIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information...
Definition: authinfo.h:57
KIO::KPasswdServerLoop::~KPasswdServerLoop
virtual ~KPasswdServerLoop()
Definition: kpasswdserverloop.cpp:38
QDBusConnection::sessionBus
QDBusConnection sessionBus()
KIO::KPasswdServerLoop::authInfo
const AuthInfo & authInfo() const
Definition: kpasswdserverloop.cpp:55
QEventLoop::exec
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
KIO::KPasswdServerLoop::seqNr
qlonglong seqNr() const
Definition: kpasswdserverloop.cpp:50
QEventLoop::exit
void exit(int returnCode)
KIO::KPasswdServerLoop::KPasswdServerLoop
KPasswdServerLoop()
Definition: kpasswdserverloop.cpp:30
QString
KIO::KPasswdServerLoop::slotQueryResult
void slotQueryResult(qlonglong requestId, qlonglong seqNr, const KIO::AuthInfo &authInfo)
Definition: kpasswdserverloop.cpp:60
kpasswdserverloop_p.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QDBusServiceWatcher
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal