kio Library API Documentation

authinfo.h

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., 59 Temple Place - Suite 330,
00018  *  Boston, MA 02111-1307, USA.
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 
00075    bool isModified() const { return modified; }
00076 
00080    void setModified( bool flag ) { modified = flag; }
00081 
00092    KURL url;
00093 
00097    QString username;
00098 
00102    QString password;
00103 
00113    QString prompt;
00114 
00124    QString caption;
00125 
00148    QString comment;
00149 
00157    QString commentLabel;
00158 
00175    QString realmValue;
00176 
00185    QString digestInfo;
00186 
00198    bool verifyPath;
00199 
00205    bool readOnly;
00206 
00218     bool keepPassword;
00219 
00220 protected:
00221     bool modified;
00222 private:
00223     class AuthInfoPrivate* d;
00224 };
00225 
00226 QDataStream& operator<< (QDataStream& s, const AuthInfo& a);
00227 QDataStream& operator>> (QDataStream& s, AuthInfo& a);
00228 
00237 class NetRC
00238 {
00239 public:
00240 
00251   enum LookUpMode
00252   {
00253       exactOnly = 0x0002,
00254       defaultOnly = 0x0004,
00255       presetOnly = 0x0008
00256   };
00257 
00261   struct AutoLogin
00262   {
00263     QString type;
00264     QString machine;
00265     QString login;
00266     QString password;
00267     QMap<QString, QStringList> macdef;
00268   };
00269 
00273   static NetRC* self();
00274 
00278   bool lookup( const KURL&, AutoLogin&, bool userealnetrc = false,
00279                QString type = QString::null,
00280                int mode = (exactOnly|defaultOnly) );
00284   void reload() { isDirty = true; }
00285 
00286 protected:
00287   QString extract( const char*, const char*, int& );
00288   int openf( const QString& );
00289   void parse( int );
00290 
00291 private:
00292   NetRC();
00293   ~NetRC();
00294 
00295 private:
00296   bool isDirty;
00297 
00298   typedef QValueList<AutoLogin> LoginList;
00299   typedef QMap<QString, LoginList> LoginMap;
00300   LoginMap loginMap;
00301 
00302   static NetRC* instance;
00303   class NetRCPrivate;
00304   NetRCPrivate* d;
00305 };
00306 }
00307 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:12:42 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001