summaryrefslogtreecommitdiffstats
path: root/kio/kpasswdserver/kpasswdserver.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kio/kpasswdserver/kpasswdserver.h
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kio/kpasswdserver/kpasswdserver.h')
-rw-r--r--kio/kpasswdserver/kpasswdserver.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/kio/kpasswdserver/kpasswdserver.h b/kio/kpasswdserver/kpasswdserver.h
new file mode 100644
index 000000000..31e8b9a2d
--- /dev/null
+++ b/kio/kpasswdserver/kpasswdserver.h
@@ -0,0 +1,118 @@
+/*
+ This file is part of the KDE Password Server
+
+ Copyright (C) 2002 Waldo Bastian ([email protected])
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+//----------------------------------------------------------------------------
+//
+// KDE Password Server
+// $Id$
+
+#ifndef KPASSWDSERVER_H
+#define KPASSWDSERVER_H
+
+#include <qdict.h>
+#include <qintdict.h>
+
+#include <dcopclient.h>
+#include <kio/authinfo.h>
+#include <kded/kdedmodule.h>
+
+namespace KWallet {
+ class Wallet;
+}
+
+class KPasswdServer : public KDEDModule
+{
+ Q_OBJECT
+ K_DCOP
+public:
+ KPasswdServer(const QCString &);
+ ~KPasswdServer();
+
+k_dcop:
+ // KDE4 merge
+ KIO::AuthInfo checkAuthInfo(KIO::AuthInfo, long, unsigned long);
+ KIO::AuthInfo checkAuthInfo(KIO::AuthInfo, long);
+ KIO::AuthInfo queryAuthInfo(KIO::AuthInfo, QString, long, long, unsigned long);
+ KIO::AuthInfo queryAuthInfo(KIO::AuthInfo, QString, long, long);
+ void addAuthInfo(KIO::AuthInfo, long);
+
+public slots:
+ void processRequest();
+ // Remove all authentication info associated with windowId
+ void removeAuthForWindowId(long windowId);
+
+protected:
+ struct AuthInfo;
+
+ QString createCacheKey( const KIO::AuthInfo &info );
+ const AuthInfo *findAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
+ void removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
+ void addAuthInfoItem(const QString &key, const KIO::AuthInfo &info, long windowId, long seqNr, bool canceled);
+ KIO::AuthInfo copyAuthInfo(const AuthInfo *);
+ void updateAuthExpire(const QString &key, const AuthInfo *, long windowId, bool keep);
+ int findWalletEntry( const QMap<QString,QString>& map, const QString& username );
+ bool openWallet( WId windowId );
+
+ struct AuthInfo {
+ AuthInfo() { expire = expNever; isCanceled = false; seqNr = 0; }
+
+ KURL url;
+ QString directory;
+ QString username;
+ QString password;
+ QString realmValue;
+ QString digestInfo;
+
+ enum { expNever, expWindowClose, expTime } expire;
+ QValueList<long> windowList;
+ unsigned long expireTime;
+ long seqNr;
+
+ bool isCanceled;
+ };
+
+ class AuthInfoList : public QPtrList<AuthInfo>
+ {
+ public:
+ AuthInfoList() { setAutoDelete(true); }
+ int compareItems(QPtrCollection::Item n1, QPtrCollection::Item n2);
+ };
+
+ QDict< AuthInfoList > m_authDict;
+
+ struct Request {
+ DCOPClient *client;
+ DCOPClientTransaction *transaction;
+ QString key;
+ KIO::AuthInfo info;
+ QString errorMsg;
+ long windowId;
+ long seqNr;
+ bool prompt;
+ };
+
+ QPtrList< Request > m_authPending;
+ QPtrList< Request > m_authWait;
+ QIntDict<QStringList> mWindowIdList;
+ DCOPClient *m_dcopClient;
+ KWallet::Wallet* m_wallet;
+ long m_seqNr;
+};
+
+#endif