authinfo.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef __KIO_AUTHINFO_H
00022 #define __KIO_AUTHINFO_H
00023 
00024 #include <qmap.h>
00025 #include <qvaluelist.h>
00026 #include <kurl.h>
00027 
00028 
00029 namespace KIO {
00030 
00051 class AuthInfo
00052 {
00053     friend QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00054     friend QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00055 
00056 public:
00060    AuthInfo();
00061 
00065    AuthInfo( const AuthInfo& info );
00066 
00070    AuthInfo& operator=( const AuthInfo& info );
00071 
00076    bool isModified() const { return modified; }
00077 
00082    void setModified( bool flag ) { modified = flag; }
00083 
00094    KURL url;
00095 
00099    QString username;
00100 
00104    QString password;
00105 
00115    QString prompt;
00116 
00126    QString caption;
00127 
00150    QString comment;
00151 
00159    QString commentLabel;
00160 
00177    QString realmValue;
00178 
00187    QString digestInfo;
00188 
00200    bool verifyPath;
00201 
00207    bool readOnly;
00208 
00220     bool keepPassword;
00221 
00222 protected:
00223     bool modified;
00224 private:
00225     class AuthInfoPrivate* d;
00226 };
00227 
00228 QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00229 QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00230 
00240 class NetRC
00241 {
00242 public:
00243 
00254   enum LookUpMode
00255   {
00256       exactOnly = 0x0002,
00257       defaultOnly = 0x0004,
00258       presetOnly = 0x0008
00259   };
00260 
00265   struct AutoLogin
00266   {
00267     QString type;
00268     QString machine;
00269     QString login;
00270     QString password;
00271     QMap<QString, QStringList> macdef;
00272   };
00273 
00278   static NetRC* self();
00279 
00290   bool lookup( const KURL& url, AutoLogin& login,
00291                bool userealnetrc = false,
00292                QString type = QString::null,
00293                int mode = (exactOnly|defaultOnly) );
00297   void reload() { isDirty = true; }
00298 
00299 protected:
00300   QString extract( const char*, const char*, int& );
00301   int openf( const QString& );
00302   bool parse( int );
00303 
00304 private:
00305   NetRC();
00306   ~NetRC();
00307 
00308 private:
00309   bool isDirty;
00310 
00311   typedef QValueList<AutoLogin> LoginList;
00312   typedef QMap<QString, LoginList> LoginMap;
00313   LoginMap loginMap;
00314 
00315   static NetRC* instance;
00316   class NetRCPrivate;
00317   NetRCPrivate* d;
00318 };
00319 }
00320 #endif
 
This file is part of the documentation for kio Library Version 3.2.0.