Quantum GIS API Documentation  1.7.4
src/core/qgscredentials.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgscredentials.h  -  interface for requesting credentials
00003     ----------------------
00004     begin                : Feburary 2010
00005     copyright            : (C) 2010 by Juergen E. Fischer
00006     email                : jef at norbit dot de
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 /* $Id$ */
00016 
00017 
00018 #ifndef QGSCREDENTIALS_H
00019 #define QGSCREDENTIALS_H
00020 
00021 #include <QString>
00022 #include <QObject>
00023 #include <QPair>
00024 #include <QMap>
00025 
00037 class CORE_EXPORT QgsCredentials
00038 {
00039   public:
00041     virtual ~QgsCredentials();
00042 
00043     bool get( QString realm, QString &username, QString &password, QString message = QString::null );
00044     void put( QString realm, QString username, QString password );
00045 
00047     static QgsCredentials *instance();
00048 
00049   protected:
00051     virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null ) = 0;
00052 
00054     void setInstance( QgsCredentials *theInstance );
00055 
00056   private:
00058     QMap< QString, QPair<QString, QString> > mCredentialCache;
00059 
00061     static QgsCredentials *smInstance;
00062 };
00063 
00064 
00072 class CORE_EXPORT QgsCredentialsConsole : public QObject, public QgsCredentials
00073 {
00074     Q_OBJECT
00075 
00076   public:
00077     QgsCredentialsConsole();
00078 
00079   signals:
00081     void destroyed();
00082 
00083   protected:
00084     virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null );
00085 };
00086 
00087 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines