QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
QgsCredentials Class Referenceabstract

Interface for requesting credentials in QGIS in GUI independent way. More...

#include <qgscredentials.h>

Inheritance diagram for QgsCredentials:
Inheritance graph
[legend]
Collaboration diagram for QgsCredentials:
Collaboration graph
[legend]

Public Member Functions

virtual ~QgsCredentials ()
 virtual destructor More...
 
bool get (QString realm, QString &username, QString &password, QString message=QString::null)
 
void put (QString realm, QString username, QString password)
 
void lock ()
 Lock the instance against access from multiple threads. More...
 
void unlock ()
 Unlock the instance after being locked. More...
 
QMutex * mutex ()
 Return pointer to mutex. More...
 

Static Public Member Functions

static QgsCredentialsinstance ()
 retrieves instance More...
 

Protected Member Functions

 QgsCredentials ()
 
virtual bool request (QString realm, QString &username, QString &password, QString message=QString::null)=0
 request a password More...
 
void setInstance (QgsCredentials *theInstance)
 register instance More...
 

Private Attributes

QMap< QString, QPair< QString,
QString > > 
mCredentialCache
 cache for already requested credentials in this session More...
 
QMutex mMutex
 

Static Private Attributes

static QgsCredentialssmInstance = 0
 Pointer to the credential instance. More...
 

Detailed Description

Interface for requesting credentials in QGIS in GUI independent way.

This class provides abstraction of a dialog for requesting credentials to the user. By default QgsCredentials will be used if not overridden with other credential creator function.

QGIS application uses QgsCredentialDialog class for displaying a dialog to the user.

Object deletes itself when it's not needed anymore. Children should use signal destroyed() to be notified of the deletion

Definition at line 37 of file qgscredentials.h.

Constructor & Destructor Documentation

QgsCredentials::~QgsCredentials ( )
virtual

virtual destructor

Definition at line 45 of file qgscredentials.cpp.

QgsCredentials::QgsCredentials ( )
protected

Definition at line 41 of file qgscredentials.cpp.

Member Function Documentation

bool QgsCredentials::get ( QString  realm,
QString &  username,
QString &  password,
QString  message = QString::null 
)

Definition at line 49 of file qgscredentials.cpp.

References mCredentialCache, QgsDebugMsg, and request().

QgsCredentials * QgsCredentials::instance ( )
static

retrieves instance

Definition at line 33 of file qgscredentials.cpp.

References smInstance.

void QgsCredentials::lock ( )

Lock the instance against access from multiple threads.

This does not really lock access to get/put methds, it will just prevent other threads to lock the instance and continue the execution. When the class is used from non-GUI threads, they should call lock() before the get/put calls to avoid race conditions.

Note
added in 2.4

Definition at line 80 of file qgscredentials.cpp.

References mMutex.

QMutex* QgsCredentials::mutex ( )
inline

Return pointer to mutex.

Note
added in 2.4

Definition at line 67 of file qgscredentials.h.

void QgsCredentials::put ( QString  realm,
QString  username,
QString  password 
)

Definition at line 74 of file qgscredentials.cpp.

References mCredentialCache, and QgsDebugMsg.

virtual bool QgsCredentials::request ( QString  realm,
QString &  username,
QString &  password,
QString  message = QString::null 
)
protectedpure virtual

request a password

Implemented in QgsCredentialsConsole, and QgsCredentialDialog.

Referenced by get().

void QgsCredentials::setInstance ( QgsCredentials theInstance)
protected

register instance

Definition at line 23 of file qgscredentials.cpp.

References QgsDebugMsg, and smInstance.

Referenced by QgsCredentialDialog::QgsCredentialDialog(), and QgsCredentialsConsole::QgsCredentialsConsole().

void QgsCredentials::unlock ( )

Unlock the instance after being locked.

Note
added in 2.4

Definition at line 85 of file qgscredentials.cpp.

References mMutex.

Member Data Documentation

QMap< QString, QPair<QString, QString> > QgsCredentials::mCredentialCache
private

cache for already requested credentials in this session

Definition at line 82 of file qgscredentials.h.

Referenced by get(), and put().

QMutex QgsCredentials::mMutex
private

Definition at line 87 of file qgscredentials.h.

Referenced by lock(), and unlock().

QgsCredentials * QgsCredentials::smInstance = 0
staticprivate

Pointer to the credential instance.

Definition at line 85 of file qgscredentials.h.

Referenced by instance(), and setInstance().


The documentation for this class was generated from the following files: