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 class QDBusArgument;
00032
00033 namespace KIO {
00034
00035 class AuthInfoPrivate;
00036
00057 class KIO_EXPORT AuthInfo
00058 {
00059 KIO_EXPORT friend QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00060 KIO_EXPORT friend QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00061
00062 KIO_EXPORT friend QDBusArgument &operator<<(QDBusArgument &argument, const AuthInfo &a);
00063 KIO_EXPORT friend const QDBusArgument &operator>>(const QDBusArgument &argument, AuthInfo &a);
00064
00065 public:
00066
00070 AuthInfo();
00071
00075 AuthInfo( const AuthInfo& info );
00076
00081 ~AuthInfo();
00082
00086 AuthInfo& operator=( const AuthInfo& info );
00087
00092 bool isModified() const;
00093
00098 void setModified( bool flag );
00099
00110 KUrl url;
00111
00115 QString username;
00116
00120 QString password;
00121
00131 QString prompt;
00132
00142 QString caption;
00143
00166 QString comment;
00167
00175 QString commentLabel;
00176
00193 QString realmValue;
00194
00203 QString digestInfo;
00204
00216 bool verifyPath;
00217
00223 bool readOnly;
00224
00236 bool keepPassword;
00237
00242 enum FieldFlags
00243 {
00244 ExtraFieldNoFlags = 0,
00245 ExtraFieldReadOnly = 1<<1,
00246 ExtraFieldMandatory = 1<<2
00247 };
00248
00258 void setExtraField(const QString &fieldName, const QVariant & value);
00259
00264 void setExtraFieldFlags(const QString &fieldName, const FieldFlags flags);
00265
00271 QVariant getExtraField(const QString &fieldName) const;
00272
00277 AuthInfo::FieldFlags getExtraFieldFlags(const QString &fieldName) const;
00278
00285 static void registerMetaTypes();
00286
00287 protected:
00288 bool modified;
00289 private:
00290 friend class ::KIO::AuthInfoPrivate;
00291 AuthInfoPrivate * const d;
00292 };
00293
00294 KIO_EXPORT QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00295 KIO_EXPORT QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00296
00297 KIO_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const AuthInfo &a);
00298 KIO_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, AuthInfo &a);
00299
00309 class KIO_EXPORT NetRC
00310 {
00311 public:
00312
00323 enum LookUpModeFlag
00324 {
00325 exactOnly = 0x0002,
00326 defaultOnly = 0x0004,
00327 presetOnly = 0x0008
00328 };
00329 Q_DECLARE_FLAGS(LookUpMode, LookUpModeFlag)
00330
00331
00335 struct AutoLogin
00336 {
00337 QString type;
00338 QString machine;
00339 QString login;
00340 QString password;
00341 QMap<QString, QStringList> macdef;
00342 };
00343
00348 static NetRC* self();
00349
00360 bool lookup( const KUrl& url, AutoLogin& login,
00361 bool userealnetrc = false,
00362 const QString &type = QString(),
00363 LookUpMode mode = LookUpMode(exactOnly) | defaultOnly );
00367 void reload();
00368
00369 protected:
00370 QString extract( const char*, const char*, int& );
00371 int openf( const QString& );
00372 bool parse( int );
00373
00374 private:
00375 NetRC();
00376 ~NetRC();
00377
00378 private:
00379 static NetRC* instance;
00380
00381 class NetRCPrivate;
00382 NetRCPrivate* const d;
00383 };
00384 }
00385 Q_DECLARE_OPERATORS_FOR_FLAGS(KIO::NetRC::LookUpMode)
00386 Q_DECLARE_METATYPE(KIO::AuthInfo)
00387
00388 #endif