Quantum GIS API Documentation
1.8
|
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 00016 00017 #ifndef QGSCREDENTIALS_H 00018 #define QGSCREDENTIALS_H 00019 00020 #include <QString> 00021 #include <QObject> 00022 #include <QPair> 00023 #include <QMap> 00024 00036 class CORE_EXPORT QgsCredentials 00037 { 00038 public: 00040 virtual ~QgsCredentials(); 00041 00042 bool get( QString realm, QString &username, QString &password, QString message = QString::null ); 00043 void put( QString realm, QString username, QString password ); 00044 00046 static QgsCredentials *instance(); 00047 00048 protected: 00050 virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null ) = 0; 00051 00053 void setInstance( QgsCredentials *theInstance ); 00054 00055 private: 00057 QMap< QString, QPair<QString, QString> > mCredentialCache; 00058 00060 static QgsCredentials *smInstance; 00061 }; 00062 00063 00071 class CORE_EXPORT QgsCredentialsConsole : public QObject, public QgsCredentials 00072 { 00073 Q_OBJECT 00074 00075 public: 00076 QgsCredentialsConsole(); 00077 00078 signals: 00080 void destroyed(); 00081 00082 protected: 00083 virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null ); 00084 }; 00085 00086 #endif