kpasswdserver.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KPASSWDSERVER_H
00026 #define KPASSWDSERVER_H
00027
00028 #include <qdict.h>
00029 #include <qintdict.h>
00030
00031 #include <dcopclient.h>
00032 #include <kio/authinfo.h>
00033 #include <kded/kdedmodule.h>
00034
00035 namespace KWallet {
00036 class Wallet;
00037 }
00038
00039 class KPasswdServer : public KDEDModule
00040 {
00041 Q_OBJECT
00042 K_DCOP
00043 public:
00044 KPasswdServer(const QCString &);
00045 ~KPasswdServer();
00046
00047 k_dcop:
00048 KIO::AuthInfo checkAuthInfo(KIO::AuthInfo, long);
00049 KIO::AuthInfo queryAuthInfo(KIO::AuthInfo, QString, long, long);
00050 void addAuthInfo(KIO::AuthInfo, long);
00051
00052 public slots:
00053 void processRequest();
00054
00055 void removeAuthForWindowId(long windowId);
00056
00057 protected:
00058 struct AuthInfo;
00059
00060 QString createCacheKey( const KIO::AuthInfo &info );
00061 const AuthInfo *findAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00062 void removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00063 void addAuthInfoItem(const QString &key, const KIO::AuthInfo &info, long windowId, long seqNr, bool canceled);
00064 KIO::AuthInfo copyAuthInfo(const AuthInfo *);
00065 void updateAuthExpire(const QString &key, const AuthInfo *, long windowId, bool keep);
00066 static bool storeInWallet( KWallet::Wallet* wallet, const QString& key, const KIO::AuthInfo &info );
00067 static bool readFromWallet( KWallet::Wallet* wallet, const QString& key, QString& username, QString& password, bool userReadOnly, QMap<QString,QString>& knownLogins );
00068 int findWalletEntry( const QMap<QString,QString>& map, const QString& username );
00069
00070 struct AuthInfo {
00071 AuthInfo() { expire = expNever; isCanceled = false; seqNr = 0; }
00072
00073 KURL url;
00074 QString directory;
00075 QString username;
00076 QString password;
00077 QString realmValue;
00078 QString digestInfo;
00079
00080 enum { expNever, expWindowClose, expTime } expire;
00081 QValueList<long> windowList;
00082 unsigned long expireTime;
00083 long seqNr;
00084
00085 bool isCanceled;
00086 };
00087
00088 class AuthInfoList : public QPtrList<AuthInfo>
00089 {
00090 public:
00091 AuthInfoList() { setAutoDelete(true); }
00092 int compareItems(QPtrCollection::Item n1, QPtrCollection::Item n2);
00093 };
00094
00095 QDict< AuthInfoList > m_authDict;
00096
00097 struct Request {
00098 DCOPClient *client;
00099 DCOPClientTransaction *transaction;
00100 QString key;
00101 KIO::AuthInfo info;
00102 QString errorMsg;
00103 long windowId;
00104 long seqNr;
00105 bool prompt;
00106 };
00107
00108 QPtrList< Request > m_authPending;
00109 QPtrList< Request > m_authWait;
00110 QIntDict<QStringList> mWindowIdList;
00111 DCOPClient *m_dcopClient;
00112 long m_seqNr;
00113 };
00114
00115 #endif
This file is part of the documentation for kio Library Version 3.4.1.