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 00286 private: 00287 friend class ::KIO::AuthInfoPrivate; 00288 AuthInfoPrivate * const d; 00289 }; 00290 00291 KIO_EXPORT QDataStream& operator<< (QDataStream& s, const AuthInfo& a); 00292 KIO_EXPORT QDataStream& operator>> (QDataStream& s, AuthInfo& a); 00293 00294 KIO_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const AuthInfo &a); 00295 KIO_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, AuthInfo &a); 00296 00306 class KIO_EXPORT NetRC 00307 { 00308 public: 00309 00320 enum LookUpModeFlag 00321 { 00322 exactOnly = 0x0002, 00323 defaultOnly = 0x0004, 00324 presetOnly = 0x0008 00325 }; 00326 Q_DECLARE_FLAGS(LookUpMode, LookUpModeFlag) 00327 00328 00332 struct AutoLogin 00333 { 00334 QString type; 00335 QString machine; 00336 QString login; 00337 QString password; 00338 QMap<QString, QStringList> macdef; 00339 }; 00340 00345 static NetRC* self(); 00346 00357 bool lookup( const KUrl& url, AutoLogin& login, 00358 bool userealnetrc = false, 00359 const QString &type = QString(), 00360 LookUpMode mode = LookUpMode(exactOnly) | defaultOnly ); 00364 void reload(); 00365 00366 protected: 00367 QString extract( const char*, const char*, int& ); 00368 int openf( const QString& ); 00369 bool parse( int ); 00370 00371 private: 00372 NetRC(); 00373 ~NetRC(); 00374 00375 private: 00376 static NetRC* instance; 00377 00378 class NetRCPrivate; 00379 NetRCPrivate* const d; 00380 }; 00381 } 00382 Q_DECLARE_OPERATORS_FOR_FLAGS(KIO::NetRC::LookUpMode) 00383 Q_DECLARE_METATYPE(KIO::AuthInfo) 00384 00385 #endif
KDE 4.7 API Reference