Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgscredentials.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscredentials.h - interface for requesting credentials
3  ----------------------
4  begin : Feburary 2010
5  copyright : (C) 2010 by Juergen E. Fischer
6  email : jef at norbit dot de
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 /* $Id$ */
16 
17 
18 #ifndef QGSCREDENTIALS_H
19 #define QGSCREDENTIALS_H
20 
21 #include <QString>
22 #include <QObject>
23 #include <QPair>
24 #include <QMap>
25 
37 class CORE_EXPORT QgsCredentials
38 {
39  public:
41  virtual ~QgsCredentials();
42 
43  bool get( QString realm, QString &username, QString &password, QString message = QString::null );
44  void put( QString realm, QString username, QString password );
45 
47  static QgsCredentials *instance();
48 
49  protected:
51  virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null ) = 0;
52 
54  void setInstance( QgsCredentials *theInstance );
55 
56  private:
58  QMap< QString, QPair<QString, QString> > mCredentialCache;
59 
62 };
63 
64 
72 class CORE_EXPORT QgsCredentialsConsole : public QObject, public QgsCredentials
73 {
74  Q_OBJECT
75 
76  public:
78 
79  signals:
81  void destroyed();
82 
83  protected:
84  virtual bool request( QString realm, QString &username, QString &password, QString message = QString::null );
85 };
86 
87 #endif