KIO
authinfo.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 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 00189 QString realmValue; 00190 00199 QString digestInfo; 00200 00212 bool verifyPath; 00213 00219 bool readOnly; 00220 00232 bool keepPassword; 00233 00238 enum FieldFlags 00239 { 00240 ExtraFieldNoFlags = 0, 00241 ExtraFieldReadOnly = 1<<1, 00242 ExtraFieldMandatory = 1<<2 00243 }; 00244 00254 void setExtraField(const QString &fieldName, const QVariant & value); 00255 00260 void setExtraFieldFlags(const QString &fieldName, const FieldFlags flags); 00261 00267 QVariant getExtraField(const QString &fieldName) const; 00268 00273 AuthInfo::FieldFlags getExtraFieldFlags(const QString &fieldName) const; 00274 00281 static void registerMetaTypes(); 00282 00283 protected: 00284 bool modified; 00285 private: 00286 friend class ::KIO::AuthInfoPrivate; 00287 AuthInfoPrivate * const d; 00288 }; 00289 00290 KIO_EXPORT QDataStream& operator<< (QDataStream& s, const AuthInfo& a); 00291 KIO_EXPORT QDataStream& operator>> (QDataStream& s, AuthInfo& a); 00292 00293 KIO_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const AuthInfo &a); 00294 KIO_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, AuthInfo &a); 00295 00305 class KIO_EXPORT NetRC 00306 { 00307 public: 00308 00319 enum LookUpModeFlag 00320 { 00321 exactOnly = 0x0002, 00322 defaultOnly = 0x0004, 00323 presetOnly = 0x0008 00324 }; 00325 Q_DECLARE_FLAGS(LookUpMode, LookUpModeFlag) 00326 00327 00331 struct AutoLogin 00332 { 00333 QString type; 00334 QString machine; 00335 QString login; 00336 QString password; 00337 QMap<QString, QStringList> macdef; 00338 }; 00339 00344 static NetRC* self(); 00345 00356 bool lookup( const KUrl& url, AutoLogin& login, 00357 bool userealnetrc = false, 00358 const QString &type = QString(), 00359 LookUpMode mode = LookUpMode(exactOnly) | defaultOnly ); 00363 void reload(); 00364 00365 protected: 00366 QString extract( const char*, const char*, int& ); 00367 int openf( const QString& ); 00368 bool parse( int ); 00369 00370 private: 00371 NetRC(); 00372 ~NetRC(); 00373 00374 private: 00375 static NetRC* instance; 00376 00377 class NetRCPrivate; 00378 NetRCPrivate* const d; 00379 }; 00380 } 00381 Q_DECLARE_OPERATORS_FOR_FLAGS(KIO::NetRC::LookUpMode) 00382 Q_DECLARE_METATYPE(KIO::AuthInfo) 00383 00384 #endif
KDE 4.6 API Reference