KIO
authinfo.h
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 #ifndef KIO_AUTHINFO_H
00022 #define KIO_AUTHINFO_H
00023
00024 #include "kio_export.h"
00025
00026 #include <QtCore/QMap>
00027 #include <QtCore/QList>
00028 #include <QtCore/QStringList>
00029 #include <kurl.h>
00030
00031 namespace KIO {
00032
00033 class AuthInfoPrivate;
00034
00055 class KIO_EXPORT AuthInfo
00056 {
00057 KIO_EXPORT friend QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00058 KIO_EXPORT friend QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00059
00060 public:
00061
00065 AuthInfo();
00066
00070 AuthInfo( const AuthInfo& info );
00071
00076 ~AuthInfo();
00077
00081 AuthInfo& operator=( const AuthInfo& info );
00082
00087 bool isModified() const;
00088
00093 void setModified( bool flag );
00094
00105 KUrl url;
00106
00110 QString username;
00111
00115 QString password;
00116
00126 QString prompt;
00127
00137 QString caption;
00138
00161 QString comment;
00162
00170 QString commentLabel;
00171
00188 QString realmValue;
00189
00198 QString digestInfo;
00199
00211 bool verifyPath;
00212
00218 bool readOnly;
00219
00231 bool keepPassword;
00232
00237 enum FieldFlags
00238 {
00239 ExtraFieldNoFlags = 0,
00240 ExtraFieldReadOnly = 1<<1,
00241 ExtraFieldMandatory = 1<<2
00242 };
00243
00253 void setExtraField(const QString &fieldName, const QVariant & value);
00254
00259 void setExtraFieldFlags(const QString &fieldName, const FieldFlags flags);
00260
00266 QVariant getExtraField(const QString &fieldName) const;
00267
00272 AuthInfo::FieldFlags getExtraFieldFlags(const QString &fieldName) const;
00273
00274 protected:
00275 bool modified;
00276 private:
00277 friend class ::KIO::AuthInfoPrivate;
00278 AuthInfoPrivate * const d;
00279 };
00280
00281 KIO_EXPORT QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00282 KIO_EXPORT QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00283
00293 class KIO_EXPORT NetRC
00294 {
00295 public:
00296
00307 enum LookUpModeFlag
00308 {
00309 exactOnly = 0x0002,
00310 defaultOnly = 0x0004,
00311 presetOnly = 0x0008
00312 };
00313 Q_DECLARE_FLAGS(LookUpMode, LookUpModeFlag)
00314
00315
00319 struct AutoLogin
00320 {
00321 QString type;
00322 QString machine;
00323 QString login;
00324 QString password;
00325 QMap<QString, QStringList> macdef;
00326 };
00327
00332 static NetRC* self();
00333
00344 bool lookup( const KUrl& url, AutoLogin& login,
00345 bool userealnetrc = false,
00346 const QString &type = QString(),
00347 LookUpMode mode = LookUpMode(exactOnly) | defaultOnly );
00351 void reload();
00352
00353 protected:
00354 QString extract( const char*, const char*, int& );
00355 int openf( const QString& );
00356 bool parse( int );
00357
00358 private:
00359 NetRC();
00360 ~NetRC();
00361
00362 private:
00363 static NetRC* instance;
00364
00365 class NetRCPrivate;
00366 NetRCPrivate* const d;
00367 };
00368 }
00369 Q_DECLARE_OPERATORS_FOR_FLAGS(KIO::NetRC::LookUpMode)
00370
00371 #endif