Skip to content

Commit 1ff02de

Browse files
committedSep 22, 2015
[auth system] Fix doc string warnings and comments in PR 2330
1 parent 16ac248 commit 1ff02de

34 files changed

+436
-212
lines changed
 

‎python/core/auth/qgsauthcertutils.sip

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,85 +43,85 @@ class QgsAuthCertUtils
4343

4444

4545

46-
static const QString getSslProtocolName( QSsl::SslProtocol protocol );
46+
static QString getSslProtocolName( QSsl::SslProtocol protocol );
4747

4848

49-
static const QMap< QString, QSslCertificate> mapDigestToCerts( QList<QSslCertificate> certs );
49+
static QMap< QString, QSslCertificate> mapDigestToCerts( QList<QSslCertificate> certs );
5050

5151

52-
// static const QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
52+
// static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
5353

5454

55-
static const QMap< QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs );
55+
static QMap< QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs );
5656

5757

58-
// static const QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs );
58+
// static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs );
5959

6060

61-
static const QList<QSslCertificate> certsFromFile( const QString &certspath );
61+
static QList<QSslCertificate> certsFromFile( const QString &certspath );
6262

6363

64-
static const QSslCertificate certFromFile( const QString &certpath );
64+
static QSslCertificate certFromFile( const QString &certpath );
6565

6666

67-
static const QSslKey keyFromFile( const QString &keypath,
68-
const QString &keypass = QString(),
69-
QString *algtype = 0 );
67+
static QSslKey keyFromFile( const QString &keypath,
68+
const QString &keypass = QString(),
69+
QString *algtype = 0 );
7070

7171

72-
static const QList<QSslCertificate> certsFromString( const QString &pemtext );
72+
static QList<QSslCertificate> certsFromString( const QString &pemtext );
7373

7474

75-
static const QStringList certKeyBundleToPem( const QString &certpath,
76-
const QString &keypath,
77-
const QString &keypass = QString(),
78-
bool reencrypt = true );
75+
static QStringList certKeyBundleToPem( const QString &certpath,
76+
const QString &keypath,
77+
const QString &keypass = QString(),
78+
bool reencrypt = true );
7979

8080

81-
static const QStringList pkcs12BundleToPem( const QString &bundlepath,
82-
const QString &bundlepass = QString(),
83-
bool reencrypt = true );
81+
static QStringList pkcs12BundleToPem( const QString &bundlepath,
82+
const QString &bundlepass = QString(),
83+
bool reencrypt = true );
8484

8585

86-
static const QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
86+
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
8787

8888

89-
static const QString resolvedCertName( const QSslCertificate& cert, bool issuer = false );
89+
static QString resolvedCertName( const QSslCertificate& cert, bool issuer = false );
9090

9191

92-
// static const QString getCertDistinguishedName( const QSslCertificate& qcert,
92+
// static QString getCertDistinguishedName( const QSslCertificate& qcert,
9393
// const QCA::Certificate& acert = QCA::Certificate(),
9494
// bool issuer = false );
9595

9696

97-
static const QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
97+
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
9898

9999

100-
static const QString getColonDelimited( const QString& txt );
100+
static QString getColonDelimited( const QString& txt );
101101

102102

103-
static const QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
103+
static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
104104

105105

106-
// static const QCA::Certificate qtCertToQcaCert( const QSslCertificate& cert );
106+
// static QCA::Certificate qtCertToQcaCert( const QSslCertificate& cert );
107107

108108

109-
// static const QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate>& certs );
109+
// static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate>& certs );
110110

111111

112-
// static const QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
112+
// static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
113113

114114

115-
// static const QString qcaValidityMessage( QCA::Validity validity );
115+
// static QString qcaValidityMessage( QCA::Validity validity );
116116

117117

118-
// static const QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
118+
// static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
119119

120120

121-
// static const QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
121+
// static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
122122

123123

124-
static const QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
124+
static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
125125

126126

127127
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate& cert );
@@ -141,7 +141,7 @@ class QgsAuthCertUtils
141141

142142
static bool certificateIsSslClient( const QSslCertificate& cert );
143143

144-
static const QString sslErrorEnumString( QSslError::SslError errenum );
144+
static QString sslErrorEnumString( QSslError::SslError errenum );
145145

146-
// static const QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
146+
// static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
147147
};

‎src/core/auth/qgsauthcertutils.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "qgslogger.h"
2626

2727

28-
const QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol )
28+
QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol )
2929
{
3030
switch ( protocol )
3131
{
@@ -46,7 +46,7 @@ const QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol )
4646
}
4747
}
4848

49-
const QMap<QString, QSslCertificate> QgsAuthCertUtils::mapDigestToCerts( QList<QSslCertificate> certs )
49+
QMap<QString, QSslCertificate> QgsAuthCertUtils::mapDigestToCerts( QList<QSslCertificate> certs )
5050
{
5151
QMap<QString, QSslCertificate> digestmap;
5252
Q_FOREACH ( QSslCertificate cert, certs )
@@ -56,7 +56,7 @@ const QMap<QString, QSslCertificate> QgsAuthCertUtils::mapDigestToCerts( QList<Q
5656
return digestmap;
5757
}
5858

59-
const QMap<QString, QList<QSslCertificate> > QgsAuthCertUtils::certsGroupedByOrg( QList<QSslCertificate> certs )
59+
QMap<QString, QList<QSslCertificate> > QgsAuthCertUtils::certsGroupedByOrg( QList<QSslCertificate> certs )
6060
{
6161
QMap< QString, QList<QSslCertificate> > orgcerts;
6262
Q_FOREACH ( QSslCertificate cert, certs )
@@ -70,7 +70,7 @@ const QMap<QString, QList<QSslCertificate> > QgsAuthCertUtils::certsGroupedByOrg
7070
return orgcerts;
7171
}
7272

73-
const QMap<QString, QgsAuthConfigSslServer> QgsAuthCertUtils::mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs )
73+
QMap<QString, QgsAuthConfigSslServer> QgsAuthCertUtils::mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs )
7474
{
7575
QMap<QString, QgsAuthConfigSslServer> digestmap;
7676
Q_FOREACH ( QgsAuthConfigSslServer config, configs )
@@ -80,7 +80,7 @@ const QMap<QString, QgsAuthConfigSslServer> QgsAuthCertUtils::mapDigestToSslConf
8080
return digestmap;
8181
}
8282

83-
const QMap<QString, QList<QgsAuthConfigSslServer> > QgsAuthCertUtils::sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs )
83+
QMap<QString, QList<QgsAuthConfigSslServer> > QgsAuthCertUtils::sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs )
8484
{
8585
QMap< QString, QList<QgsAuthConfigSslServer> > orgconfigs;
8686
Q_FOREACH ( QgsAuthConfigSslServer config, configs )
@@ -113,7 +113,7 @@ static QByteArray fileData_( const QString& path, bool astext = false )
113113
return data;
114114
}
115115

116-
const QList<QSslCertificate> QgsAuthCertUtils::certsFromFile( const QString &certspath )
116+
QList<QSslCertificate> QgsAuthCertUtils::certsFromFile( const QString &certspath )
117117
{
118118
QList<QSslCertificate> certs;
119119
bool pem = certspath.endsWith( ".pem", Qt::CaseInsensitive );
@@ -125,7 +125,7 @@ const QList<QSslCertificate> QgsAuthCertUtils::certsFromFile( const QString &cer
125125
return certs;
126126
}
127127

128-
const QSslCertificate QgsAuthCertUtils::certFromFile( const QString &certpath )
128+
QSslCertificate QgsAuthCertUtils::certFromFile( const QString &certpath )
129129
{
130130
QSslCertificate cert;
131131
QList<QSslCertificate> certs( QgsAuthCertUtils::certsFromFile( certpath ) );
@@ -140,9 +140,9 @@ const QSslCertificate QgsAuthCertUtils::certFromFile( const QString &certpath )
140140
return cert;
141141
}
142142

143-
const QSslKey QgsAuthCertUtils::keyFromFile( const QString &keypath,
144-
const QString &keypass,
145-
QString *algtype )
143+
QSslKey QgsAuthCertUtils::keyFromFile( const QString &keypath,
144+
const QString &keypass,
145+
QString *algtype )
146146
{
147147
bool pem = keypath.endsWith( ".pem", Qt::CaseInsensitive );
148148
QByteArray keydata( fileData_( keypath, pem ) );
@@ -177,7 +177,7 @@ const QSslKey QgsAuthCertUtils::keyFromFile( const QString &keypath,
177177
return clientkey;
178178
}
179179

180-
const QList<QSslCertificate> QgsAuthCertUtils::certsFromString( const QString &pemtext )
180+
QList<QSslCertificate> QgsAuthCertUtils::certsFromString( const QString &pemtext )
181181
{
182182
QList<QSslCertificate> certs;
183183
certs = QSslCertificate::fromData( pemtext.toAscii(), QSsl::Pem );
@@ -188,7 +188,7 @@ const QList<QSslCertificate> QgsAuthCertUtils::certsFromString( const QString &p
188188
return certs;
189189
}
190190

191-
const QStringList QgsAuthCertUtils::certKeyBundleToPem( const QString &certpath,
191+
QStringList QgsAuthCertUtils::certKeyBundleToPem( const QString &certpath,
192192
const QString &keypath,
193193
const QString &keypass,
194194
bool reencrypt )
@@ -213,7 +213,7 @@ const QStringList QgsAuthCertUtils::certKeyBundleToPem( const QString &certpath,
213213
return QStringList() << certpem << keypem << algtype;
214214
}
215215

216-
const QStringList QgsAuthCertUtils::pkcs12BundleToPem( const QString &bundlepath,
216+
QStringList QgsAuthCertUtils::pkcs12BundleToPem( const QString &bundlepath,
217217
const QString &bundlepass,
218218
bool reencrypt )
219219
{
@@ -246,7 +246,7 @@ const QStringList QgsAuthCertUtils::pkcs12BundleToPem( const QString &bundlepath
246246
return QStringList() << bundle.certificateChain().primary().toPEM() << bundle.privateKey().toPEM( passarray ) << algtype;
247247
}
248248

249-
const QString QgsAuthCertUtils::getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single )
249+
QString QgsAuthCertUtils::getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single )
250250
{
251251
switch ( source )
252252
{
@@ -263,7 +263,7 @@ const QString QgsAuthCertUtils::getCaSourceName( QgsAuthCertUtils::CaCertSource
263263
}
264264
}
265265

266-
const QString QgsAuthCertUtils::resolvedCertName( const QSslCertificate &cert, bool issuer )
266+
QString QgsAuthCertUtils::resolvedCertName( const QSslCertificate &cert, bool issuer )
267267
{
268268
QString name( issuer ? cert.issuerInfo( QSslCertificate::CommonName )
269269
: cert.subjectInfo( QSslCertificate::CommonName ) );
@@ -301,7 +301,7 @@ void QgsAuthCertUtils::appendDirSegment_( QStringList &dirname,
301301
}
302302
}
303303

304-
const QString QgsAuthCertUtils::getCertDistinguishedName( const QSslCertificate &qcert ,
304+
QString QgsAuthCertUtils::getCertDistinguishedName( const QSslCertificate &qcert ,
305305
const QCA::Certificate &acert ,
306306
bool issuer )
307307
{
@@ -351,7 +351,7 @@ const QString QgsAuthCertUtils::getCertDistinguishedName( const QSslCertificate
351351
return dirname.join( "," );
352352
}
353353

354-
const QString QgsAuthCertUtils::getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust )
354+
QString QgsAuthCertUtils::getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust )
355355
{
356356
switch ( trust )
357357
{
@@ -366,7 +366,7 @@ const QString QgsAuthCertUtils::getCertTrustName( QgsAuthCertUtils::CertTrustPol
366366
}
367367
}
368368

369-
const QString QgsAuthCertUtils::getColonDelimited( const QString &txt )
369+
QString QgsAuthCertUtils::getColonDelimited( const QString &txt )
370370
{
371371
// 64321c05b0ebab8e2b67ec0d7d9e2b6d4bc3c303
372372
// -> 64:32:1c:05:b0:eb:ab:8e:2b:67:ec:0d:7d:9e:2b:6d:4b:c3:c3:03
@@ -378,7 +378,7 @@ const QString QgsAuthCertUtils::getColonDelimited( const QString &txt )
378378
return sl.join( ":" );
379379
}
380380

381-
const QString QgsAuthCertUtils::shaHexForCert( const QSslCertificate& cert, bool formatted )
381+
QString QgsAuthCertUtils::shaHexForCert( const QSslCertificate& cert, bool formatted )
382382
{
383383
QString sha( cert.digest( QCryptographicHash::Sha1 ).toHex() );
384384
if ( formatted )
@@ -388,7 +388,7 @@ const QString QgsAuthCertUtils::shaHexForCert( const QSslCertificate& cert, bool
388388
return sha;
389389
}
390390

391-
const QCA::Certificate QgsAuthCertUtils::qtCertToQcaCert( const QSslCertificate &cert )
391+
QCA::Certificate QgsAuthCertUtils::qtCertToQcaCert( const QSslCertificate &cert )
392392
{
393393
if ( QgsAuthManager::instance()->isDisabled() )
394394
return QCA::Certificate();
@@ -403,7 +403,7 @@ const QCA::Certificate QgsAuthCertUtils::qtCertToQcaCert( const QSslCertificate
403403
return qcacert;
404404
}
405405

406-
const QCA::CertificateCollection QgsAuthCertUtils::qtCertsToQcaCollection( const QList<QSslCertificate> &certs )
406+
QCA::CertificateCollection QgsAuthCertUtils::qtCertsToQcaCollection( const QList<QSslCertificate> &certs )
407407
{
408408
QCA::CertificateCollection qcacoll;
409409
if ( QgsAuthManager::instance()->isDisabled() )
@@ -420,7 +420,7 @@ const QCA::CertificateCollection QgsAuthCertUtils::qtCertsToQcaCollection( const
420420
return qcacoll;
421421
}
422422

423-
const QCA::KeyBundle QgsAuthCertUtils::qcaKeyBundle( const QString &path, const QString &pass )
423+
QCA::KeyBundle QgsAuthCertUtils::qcaKeyBundle( const QString &path, const QString &pass )
424424
{
425425
QCA::SecureArray passarray;
426426
if ( !pass.isEmpty() )
@@ -432,7 +432,7 @@ const QCA::KeyBundle QgsAuthCertUtils::qcaKeyBundle( const QString &path, const
432432
return ( res == QCA::ConvertGood ? bundle : QCA::KeyBundle() );
433433
}
434434

435-
const QString QgsAuthCertUtils::qcaValidityMessage( QCA::Validity validity )
435+
QString QgsAuthCertUtils::qcaValidityMessage( QCA::Validity validity )
436436
{
437437
switch ( validity )
438438
{
@@ -465,7 +465,7 @@ const QString QgsAuthCertUtils::qcaValidityMessage( QCA::Validity validity )
465465
}
466466
}
467467

468-
const QString QgsAuthCertUtils::qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm )
468+
QString QgsAuthCertUtils::qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm )
469469
{
470470
switch ( algorithm )
471471
{
@@ -496,7 +496,7 @@ const QString QgsAuthCertUtils::qcaSignatureAlgorithm( QCA::SignatureAlgorithm a
496496
}
497497
}
498498

499-
const QString QgsAuthCertUtils::qcaKnownConstraint( QCA::ConstraintTypeKnown constraint )
499+
QString QgsAuthCertUtils::qcaKnownConstraint( QCA::ConstraintTypeKnown constraint )
500500
{
501501
switch ( constraint )
502502
{
@@ -541,7 +541,7 @@ const QString QgsAuthCertUtils::qcaKnownConstraint( QCA::ConstraintTypeKnown con
541541
}
542542
}
543543

544-
const QString QgsAuthCertUtils::certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype )
544+
QString QgsAuthCertUtils::certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype )
545545
{
546546
switch ( usagetype )
547547
{
@@ -788,7 +788,7 @@ bool QgsAuthCertUtils::certificateIsSslClient( const QSslCertificate &cert )
788788
return QgsAuthCertUtils::certificateUsageTypes( cert ).contains( QgsAuthCertUtils::TlsClientUsage );
789789
}
790790

791-
const QString QgsAuthCertUtils::sslErrorEnumString( QSslError::SslError errenum )
791+
QString QgsAuthCertUtils::sslErrorEnumString( QSslError::SslError errenum )
792792
{
793793
switch ( errenum )
794794
{
@@ -849,7 +849,7 @@ const QString QgsAuthCertUtils::sslErrorEnumString( QSslError::SslError errenum
849849
}
850850
}
851851

852-
const QList<QPair<QSslError::SslError, QString> > QgsAuthCertUtils::sslErrorEnumStrings()
852+
QList<QPair<QSslError::SslError, QString> > QgsAuthCertUtils::sslErrorEnumStrings()
853853
{
854854
QList<QPair<QSslError::SslError, QString> > errenums;
855855
errenums << qMakePair( QSslError::UnableToGetIssuerCertificate,

‎src/core/auth/qgsauthcertutils.h

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
class CORE_EXPORT QgsAuthCertUtils
3131
{
3232
public:
33+
/** Type of CA certificate source */
3334
enum CaCertSource
3435
{
3536
SystemRoot = 0,
@@ -38,6 +39,7 @@ class CORE_EXPORT QgsAuthCertUtils
3839
Connection = 3
3940
};
4041

42+
/** Type of certificate trust policy */
4143
enum CertTrustPolicy
4244
{
4345
DefaultTrust = 0,
@@ -46,6 +48,7 @@ class CORE_EXPORT QgsAuthCertUtils
4648
NoPolicy = 3
4749
};
4850

51+
/** Type of certificate usage */
4952
enum CertUsageType
5053
{
5154
UndeterminedUsage = 0,
@@ -61,6 +64,7 @@ class CORE_EXPORT QgsAuthCertUtils
6164
CRLSigningUsage
6265
};
6366

67+
/** Type of certificate key group */
6468
enum ConstraintGroup
6569
{
6670
KeyUsage = 0,
@@ -69,37 +73,37 @@ class CORE_EXPORT QgsAuthCertUtils
6973

7074

7175
/** SSL Protocol name strings per enum */
72-
static const QString getSslProtocolName( QSsl::SslProtocol protocol );
76+
static QString getSslProtocolName( QSsl::SslProtocol protocol );
7377

7478
/** Map certificate sha1 to certificate as simple cache */
75-
static const QMap< QString, QSslCertificate> mapDigestToCerts( QList<QSslCertificate> certs );
79+
static QMap<QString, QSslCertificate> mapDigestToCerts( QList<QSslCertificate> certs );
7680

7781
/** Map certificates to their oraganization */
78-
static const QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
82+
static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
7983

8084
/** Map SSL custom configs' certificate sha1 to custom config as simple cache */
81-
static const QMap< QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs );
85+
static QMap<QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( QList<QgsAuthConfigSslServer> configs );
8286

8387
/** Map SSL custom configs' certificates to their oraganization */
84-
static const QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs );
88+
static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( QList<QgsAuthConfigSslServer> configs );
8589

8690
/** Return list of concatenated certs from a PEM or DER formatted file */
87-
static const QList<QSslCertificate> certsFromFile( const QString &certspath );
91+
static QList<QSslCertificate> certsFromFile( const QString &certspath );
8892

8993
/** Return first cert from a PEM or DER formatted file */
90-
static const QSslCertificate certFromFile( const QString &certpath );
94+
static QSslCertificate certFromFile( const QString &certpath );
9195

9296
/** Return non-encrypted key from a PEM or DER formatted file
9397
* @param keypath File path to private key
9498
* @param keypass Passphrase for private key
9599
* @param algtype QString to set with resolved algorithm type
96100
*/
97-
static const QSslKey keyFromFile( const QString &keypath,
98-
const QString &keypass = QString(),
99-
QString *algtype = 0 );
101+
static QSslKey keyFromFile( const QString &keypath,
102+
const QString &keypass = QString(),
103+
QString *algtype = 0 );
100104

101105
/** Return list of concatenated certs from a PEM Base64 text block */
102-
static const QList<QSslCertificate> certsFromString( const QString &pemtext );
106+
static QList<QSslCertificate> certsFromString( const QString &pemtext );
103107

104108
/** Return list of certificate, private key and algorithm (as PEM text) from file path components
105109
* @param certpath File path to certificate
@@ -108,71 +112,71 @@ class CORE_EXPORT QgsAuthCertUtils
108112
* @param reencrypt Whether to re-encrypt the private key with the passphrase
109113
* @return certificate, private key, key's algorithm type
110114
*/
111-
static const QStringList certKeyBundleToPem( const QString &certpath,
112-
const QString &keypath,
113-
const QString &keypass = QString(),
114-
bool reencrypt = true );
115+
static QStringList certKeyBundleToPem( const QString &certpath,
116+
const QString &keypath,
117+
const QString &keypass = QString(),
118+
bool reencrypt = true );
115119

116120
/** Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
117121
* @param bundlepath File path to the PKCS bundle
118122
* @param bundlepass Passphrase for bundle
119123
* @param reencrypt Whether to re-encrypt the private key with the passphrase
120124
* @return certificate, private key, key's algorithm type
121125
*/
122-
static const QStringList pkcs12BundleToPem( const QString &bundlepath,
123-
const QString &bundlepass = QString(),
124-
bool reencrypt = true );
126+
static QStringList pkcs12BundleToPem( const QString &bundlepath,
127+
const QString &bundlepass = QString(),
128+
bool reencrypt = true );
125129

126130
/** Get the general name for CA source enum type
127131
* @param source The enum source type for the CA
128132
* @param single Whether to return singular or plural description
129133
*/
130-
static const QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
134+
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
131135

132136
/** Get the general name via RFC 5280 resolution */
133-
static const QString resolvedCertName( const QSslCertificate& cert, bool issuer = false );
137+
static QString resolvedCertName( const QSslCertificate& cert, bool issuer = false );
134138

135139
/** Get combined distinguished name for certificate
136140
* @param qcert Qt SSL cert object
137141
* @param acert QCA SSL cert object to add more info to the output
138142
* @param issuer Whether to return cert's subject or issuer combined name
139143
*/
140-
static const QString getCertDistinguishedName( const QSslCertificate& qcert,
144+
static QString getCertDistinguishedName( const QSslCertificate& qcert,
141145
const QCA::Certificate& acert = QCA::Certificate(),
142146
bool issuer = false );
143147

144148
/** Get the general name for certificate trust */
145-
static const QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
149+
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
146150

147151
/** Get string with colon delimeters every 2 characters */
148-
static const QString getColonDelimited( const QString& txt );
152+
static QString getColonDelimited( const QString& txt );
149153

150154
/** Get the sha1 hash for certificate
151155
* @param cert Qt SSL certificate to generate hash from
152156
* @param formatted Whether to colon-delimit the hash
153157
*/
154-
static const QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
158+
static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
155159

156160
/** Convert a QSslCertificate to a QCA::Certificate */
157-
static const QCA::Certificate qtCertToQcaCert( const QSslCertificate& cert );
161+
static QCA::Certificate qtCertToQcaCert( const QSslCertificate& cert );
158162

159163
/** Convert a QList of QSslCertificate to a QCA::CertificateCollection */
160-
static const QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate>& certs );
164+
static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate>& certs );
161165

162166
/** PKI key/cert bundle from file path, e.g. from .p12 or pfx files */
163-
static const QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
167+
static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
164168

165169
/** Certificate validity check messages per enum */
166-
static const QString qcaValidityMessage( QCA::Validity validity );
170+
static QString qcaValidityMessage( QCA::Validity validity );
167171

168172
/** Certificate signature algorithm strings per enum */
169-
static const QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
173+
static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
170174

171175
/** Certificate well-known constraint strings per enum */
172-
static const QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
176+
static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
173177

174178
/** Certificate usage type strings per enum */
175-
static const QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
179+
static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
176180

177181
/** Try to determine the certificates usage types */
178182
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate& cert );
@@ -193,10 +197,10 @@ class CORE_EXPORT QgsAuthCertUtils
193197
static bool certificateIsSslClient( const QSslCertificate& cert );
194198

195199
/** Get short strings describing an SSL error */
196-
static const QString sslErrorEnumString( QSslError::SslError errenum );
200+
static QString sslErrorEnumString( QSslError::SslError errenum );
197201

198202
/** Get short strings describing SSL errors */
199-
static const QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
203+
static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
200204

201205
private:
202206
static void appendDirSegment_( QStringList &dirname, const QString &segment, QString value );

‎src/core/auth/qgsauthconfig.h

Lines changed: 123 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CORE_EXPORT QgsAuthMethodConfig
3838
public:
3939

4040
/**
41-
* Constructor
42-
* @param method The textual key of the authentication method
41+
* Construct a configuration for an authentication method
42+
* @param method Textual key of the authentication method
4343
* @param version Version of the configuration (for updating previously saved configs later on)
4444
*/
4545
QgsAuthMethodConfig( QString method = QString(), int version = 0 );
@@ -50,60 +50,98 @@ class CORE_EXPORT QgsAuthMethodConfig
5050
~QgsAuthMethodConfig() {}
5151

5252
/**
53-
* The 'authcfg' 7-character alphanumeric ID of the config
53+
* Get 'authcfg' 7-character alphanumeric ID of the config
5454
* @note This is set by QgsAuthManager when the config is initially stored
5555
*/
5656
const QString id() const { return mId; }
57+
/** Set auth config ID */
5758
void setId( const QString& id ) { mId = id; }
5859

60+
/** Get name of configuration */
5961
const QString name() const { return mName; }
62+
/** Set name of configuration */
6063
void setName( const QString& name ) { mName = name; }
6164

62-
/**
63-
* A URI to auto-select a config when connecting to a resource
64-
*/
65+
/** A URI to auto-select a config when connecting to a resource */
6566
const QString uri() const { return mUri; }
6667
void setUri( const QString& uri ) { mUri = uri; }
6768

68-
/**
69-
* The textual key of the associated authentication method
70-
*/
69+
/** Textual key of the associated authentication method */
7170
QString method() const { return mMethod; }
7271
void setMethod( QString method ) { mMethod = method; }
7372

74-
/**
75-
* Version of the configuration
76-
*/
73+
/** Get version of the configuration */
7774
int version() const { return mVersion; }
75+
/** Set version of the configuration */
7876
void setVersion( int version ) { mVersion = version; }
7977

78+
/**
79+
* Whether the configuration is valid
80+
* @param validateid Additionally verify the auth config ID is not empty
81+
*/
8082
bool isValid( bool validateid = false ) const;
8183

8284
/**
8385
* The extended configuration, as stored and retrieved from the authentication database
8486
* @note This is an internal construct used by QgsAuthManager that should generally not be set by client code
8587
*/
8688
const QString configString() const;
89+
/**
90+
* Load existing extended configuration
91+
* @param configstr Configuration string to load
92+
*/
8793
void loadConfigString( const QString& configstr );
8894

95+
/** Get extended configuration, mapped to key/value pairs of QStrings */
96+
QgsStringMap configMap() const { return mConfigMap; }
8997
/**
90-
* The extended configuration, mapped to key/value pairs of QStrings
98+
* Set extended configuration map
99+
* @param map Map to set
91100
*/
92-
QgsStringMap configMap() const { return mConfigMap; }
93101
void setConfigMap( QgsStringMap map ) { mConfigMap = map; }
94102

95-
/** @note if key exists, it is replaced */
103+
/**
104+
* Set a single config value per key in the map
105+
* @note if key exists, it is replaced
106+
* @param key Config key
107+
* @param value Config value
108+
*/
96109
void setConfig( const QString &key, const QString &value );
110+
/**
111+
* Set a multiple config values per key in the map
112+
* @note if key exists, it is replaced
113+
* @param key Config key
114+
* @param value Config value
115+
*/
97116
void setConfigList( const QString &key, const QStringList &value );
98117

118+
/**
119+
* Remove a config from map
120+
* @param key Config to remove
121+
* @return Number of keys removed (should always be 1 or 0)
122+
*/
99123
int removeConfig( const QString &key );
100124

125+
/**
126+
* Return a config's value
127+
* @param key Confgi key
128+
* @param defaultvalue Default value, if key not found
129+
*/
101130
QString config( const QString &key , const QString defaultvalue = QString() ) const;
102131

132+
/**
133+
* Return a config's list of values
134+
* @param key
135+
*/
103136
QStringList configList( const QString &key ) const;
104137

138+
/**
139+
* Whether a config key exists in config map
140+
* @param key
141+
*/
105142
bool hasConfig( const QString &key ) const;
106143

144+
/** Clear all configs */
107145
void clearConfigMap() { mConfigMap.clear(); }
108146

109147
/**
@@ -112,7 +150,7 @@ class CORE_EXPORT QgsAuthMethodConfig
112150
* @note Essentially strips the URL query variables, and by default, strips the path as well
113151
* @param accessurl A URL to process
114152
* @param resource Ouput variable for result
115-
* @param withpath Whether to include the
153+
* @param withpath Whether to include the URI's path in output
116154
*/
117155
static bool uriToResource( const QString &accessurl, QString *resource, bool withpath = false );
118156

@@ -144,35 +182,66 @@ typedef QHash<QString, QgsAuthMethodConfig> QgsAuthMethodConfigsMap;
144182
class CORE_EXPORT QgsPkiBundle
145183
{
146184
public:
185+
/**
186+
* Construct a bundle from existing PKI components
187+
* @param clientCert Certificate to store in bundle
188+
* @param clientKey Private key to store in bundle
189+
* @param keyPassphrase Private key passphrase
190+
* @param caChain Chain of Certificate Authorities for client certificate
191+
*/
147192
QgsPkiBundle( const QSslCertificate &clientCert = QSslCertificate(),
148193
const QSslKey &clientKey = QSslKey(),
149194
const QString &keyPassphrase = QString::null ,
150195
const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
151196
~QgsPkiBundle();
152197

198+
/**
199+
* Construct a bundle of PKI components from PEM-formatted file paths
200+
* @param certPath Certificate file path
201+
* @param keyPath Private key path
202+
* @param keyPass Private key passphrase
203+
* @param caChain Chain of Certificate Authorities for client certificate
204+
*/
153205
static const QgsPkiBundle fromPemPaths( const QString &certPath,
154206
const QString &keyPath,
155207
const QString &keyPass = QString::null,
156208
const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
157209

210+
/**
211+
* Construct a bundle of PKI components from a PKCS#12 file path
212+
* @param bundlepath Bundle file path
213+
* @param bundlepass Optional bundle passphrase
214+
*/
158215
static const QgsPkiBundle fromPkcs12Paths( const QString &bundlepath,
159216
const QString &bundlepass = QString::null );
160217

218+
/** Whether the bundle, either its certificate or private key, is null */
161219
bool isNull() const;
220+
221+
/** Whether the bundle is valid */
162222
bool isValid() const;
163223

224+
/** The sha hash of the client certificate */
164225
const QString certId() const;
165226

227+
/** Client certificate object */
166228
const QSslCertificate clientCert() const { return mCert; }
229+
/** Set client certificate object */
167230
void setClientCert( const QSslCertificate &cert );
168231

232+
/** Private key object */
169233
const QSslKey clientKey( bool reencrypt = true ) const;
234+
/** Set private key object */
170235
void setClientKey( const QSslKey &certkey );
171236

237+
/** Private key passphrase */
172238
const QString keyPassphrase() const { return mKeyPassphrase; }
239+
/** Set private key passphrase */
173240
void setKeyPassphrase( const QString &pass ) { mKeyPassphrase = pass; }
174241

242+
/** Chain of Certificate Authorities for client certificate */
175243
const QList<QSslCertificate> caChain() const { return mCaChain; }
244+
/** Set chain of Certificate Authorities for client certificate */
176245
void setCaChain( const QList<QSslCertificate> &cachain ) { mCaChain = cachain; }
177246

178247
private:
@@ -189,20 +258,33 @@ class CORE_EXPORT QgsPkiBundle
189258
class CORE_EXPORT QgsPkiConfigBundle
190259
{
191260
public:
261+
/**
262+
* Construct a bundle from existing PKI components and authentication method configuration
263+
* @param config Authentication method configuration
264+
* @param cert Certificate to store in bundle
265+
* @param certkey Private key to store in bundle
266+
*/
192267
QgsPkiConfigBundle( const QgsAuthMethodConfig& config,
193268
const QSslCertificate& cert,
194269
const QSslKey& certkey );
195270
~QgsPkiConfigBundle();
196271

272+
/** Whether the bundle is valid */
197273
bool isValid();
198274

275+
/** Authentication method configuration */
199276
const QgsAuthMethodConfig config() const { return mConfig; }
277+
/** Set authentication method configuration */
200278
void setConfig( const QgsAuthMethodConfig& config ) { mConfig = config; }
201279

280+
/** Client certificate object */
202281
const QSslCertificate clientCert() const { return mCert; }
282+
/** Set client certificate object */
203283
void setClientCert( const QSslCertificate& cert ) { mCert = cert; }
204284

285+
/** Private key object */
205286
const QSslKey clientCertKey() const { return mCertKey; }
287+
/** Set private key object */
206288
void setClientCertKey( const QSslKey& certkey ) { mCertKey = certkey; }
207289

208290
private:
@@ -218,38 +300,63 @@ class CORE_EXPORT QgsPkiConfigBundle
218300
class CORE_EXPORT QgsAuthConfigSslServer
219301
{
220302
public:
303+
/** Construct a default SSL server configuration */
221304
QgsAuthConfigSslServer();
222305

223306
~QgsAuthConfigSslServer() {}
224307

308+
/** Server certificate object */
225309
const QSslCertificate sslCertificate() const { return mSslCert; }
310+
/** Set server certificate object */
226311
void setSslCertificate( const QSslCertificate& cert ) { mSslCert = cert; }
227312

313+
/** Server host:port string */
228314
const QString sslHostPort() const { return mSslHostPort; }
315+
/** Set server host:port string */
229316
void setSslHostPort( const QString& hostport ) { mSslHostPort = hostport; }
230317

318+
/** SSL server protocol to use in connections */
231319
QSsl::SslProtocol sslProtocol() const { return mSslProtocol; }
320+
/** Set SSL server protocol to use in connections */
232321
void setSslProtocol( QSsl::SslProtocol protocol ) { mSslProtocol = protocol; }
233322

323+
/** SSL server errors to ignore in connections */
234324
const QList<QSslError> sslIgnoredErrors() const;
325+
/** SSL server errors (as enum list) to ignore in connections */
235326
const QList<QSslError::SslError> sslIgnoredErrorEnums() const { return mSslIgnoredErrors; }
327+
/** Set SSL server errors (as enum list) to ignore in connections */
236328
void setSslIgnoredErrorEnums( const QList<QSslError::SslError>& errors ) { mSslIgnoredErrors = errors; }
237329

330+
/** SSL client's peer verify mode to use in connections */
238331
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const { return mSslPeerVerifyMode; }
332+
/** Set SSL client's peer verify mode to use in connections */
239333
void setSslPeerVerifyMode( QSslSocket::PeerVerifyMode mode ) { mSslPeerVerifyMode = mode; }
240334

335+
/** Number or SSL client's peer to verify in connections
336+
* @note When set to 0 = unlimited depth
337+
*/
241338
int sslPeerVerifyDepth() const { return mSslPeerVerifyDepth; }
339+
/** Set number or SSL client's peer to verify in connections
340+
* @note When set to 0 = unlimited depth
341+
*/
242342
void setSslPeerVerifyDepth( int depth ) { mSslPeerVerifyDepth = depth; }
243343

344+
/** Version of the configuration (used for future upgrading) */
244345
int version() const { return mVersion; }
346+
/** Set version of the configuration (used for future upgrading) */
245347
void setVersion( int version ) { mVersion = version; }
246348

349+
/** Qt version when the configuration was made (SSL protocols may differ) */
247350
int qtVersion() const { return mQtVersion; }
351+
/** Set Qt version when the configuration was made (SSL protocols may differ) */
248352
void setQtVersion( int version ) { mQtVersion = version; }
249353

354+
/** Configuration as a concatenated string */
250355
const QString configString() const;
356+
/** Load concatenated string into configuration, e.g. from auth database */
251357
void loadConfigString( const QString& config = QString() );
252358

359+
/** Whether configuration is null (missing components) */
253360
bool isNull() const;
254361

255362
private:

‎src/core/auth/qgsauthmanager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
5858

5959
public:
6060

61+
/** Message log level (mirrors that of QgsMessageLog, so it can also output there) */
6162
enum MessageLevel
6263
{
6364
INFO = 0,
@@ -380,6 +381,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
380381
/** Get ignored SSL error cache, keyed with cert/connection's sha:host:port */
381382
QHash<QString, QSet<QSslError::SslError> > getIgnoredSslErrorCache() { return mIgnoredSslErrorsCache; }
382383

384+
/** Utility function to dump the cache for debug purposes */
383385
void dumpIgnoredSslErrorsCache_();
384386

385387
/** Update ignored SSL error cache with possible ignored SSL errors, using server config */

‎src/core/auth/qgsauthmethod.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CORE_EXPORT QgsAuthMethod : public QObject
7979

8080
/** The data providers that the method supports, allowing for filtering out authcfgs that are not
8181
* applicable to a given provider, or where the updating code is not currently implemented.
82-
*/
82+
*/
8383
QStringList supportedDataProviders() const { return mDataProviders; }
8484

8585
/** Update a network request with authentication components
@@ -144,19 +144,24 @@ class CORE_EXPORT QgsAuthMethod : public QObject
144144

145145
protected:
146146
/**
147-
*
147+
* Construct a default authentication method
148+
* @note Non-public since this is an abstract base class
148149
*/
149150
explicit QgsAuthMethod()
150151
: mExpansions( QgsAuthMethod::Expansions( 0 ) )
151152
, mDataProviders( QStringList() )
152153
, mVersion( 0 )
153154
{}
154155

156+
/** Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output) */
155157
static QString authMethodTag() { return QObject::tr( "Authentication method" ); }
156158

159+
/** Set the version of the auth method (useful for future upgrading) */
157160
void setVersion( int version ) { mVersion = version; }
158161

162+
/** Set the support expansions (points in providers where the authentication is injected) of the auth method */
159163
void setExpansions( QgsAuthMethod::Expansions expansions ) { mExpansions = expansions; }
164+
/** Set list of data providers this auth method supports */
160165
void setDataProviders( QStringList dataproviders ) { mDataProviders = dataproviders; }
161166

162167
QgsAuthMethod::Expansions mExpansions;

‎src/core/auth/qgsauthmethodmetadata.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
class CORE_EXPORT QgsAuthMethodMetadata
3535
{
3636
public:
37+
/**
38+
* Construct an authentication method metadata container
39+
* @param _key Textual key of the library plugin
40+
* @param _description Description of the library plugin
41+
* @param _library File name of library plugin
42+
*/
3743
QgsAuthMethodMetadata( const QString & _key, const QString & _description, const QString & _library );
3844

3945
/** This returns the unique key associated with the method

‎src/core/auth/qgsauthmethodregistry.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ QgsAuthMethodRegistry::~QgsAuthMethodRegistry()
160160
if ( cleanupFunc )
161161
cleanupFunc();
162162
}
163+
// clear cached QgsAuthMethodMetadata *
164+
delete it->second;
163165
++it;
164166
}
165167
}

‎src/core/auth/qgsauthmethodregistry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class CORE_EXPORT QgsAuthMethodRegistry
9595
const QString & functionName );
9696
#endif
9797

98+
/** Return the library object associated with an auth method key */
9899
QLibrary *authMethodLibrary( const QString & authMethodKey ) const;
99100

100101
/** Return list of available auth methods by their keys */

‎src/core/qgsdataprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
100100
*/
101101
virtual QString dataSourceUri( bool expandAuthConfig = false ) const
102102
{
103-
if ( expandAuthConfig )
103+
if ( expandAuthConfig && mDataSourceURI.contains( "authcfg" ) )
104104
{
105105
QgsDataSourceURI uri( mDataSourceURI );
106106
return uri.uri( expandAuthConfig );

‎src/core/qgsdatasourceuri.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class CORE_EXPORT QgsDataSourceURI
110110
const QString& aSql = QString(),
111111
const QString& aKeyColumn = QString() );
112112

113-
//! set authentication configuration ID
113+
//! Set authentication configuration ID
114114
void setAuthConfigId( const QString& authcfg );
115115

116116
//! set username
@@ -122,6 +122,7 @@ class CORE_EXPORT QgsDataSourceURI
122122
//! Removes password element from uris
123123
static QString removePassword( const QString& aUri );
124124

125+
//! Any associated authentication configuration ID
125126
QString authConfigId() const;
126127
QString username() const;
127128
QString schema() const;

‎src/gui/auth/qgsauthauthoritieseditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,13 +705,13 @@ void QgsAuthAuthoritiesEditor::on_btnCaFile_clicked()
705705
QgsAuthManager::instance()->rebuildCertTrustCache();
706706
updateCertTrustPolicyCache();
707707
}
708-
dlg->deleteLater();
709708

710709
QgsAuthManager::instance()->rebuildTrustedCaCertsCache();
711710

712711
populateFileCaCerts();
713712
mFileCaSecItem->setExpanded( true );
714713
}
714+
dlg->deleteLater();
715715
}
716716

717717
void QgsAuthAuthoritiesEditor::on_btnCaFileClear_clicked()

‎src/gui/auth/qgsauthauthoritieseditor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthA
3737
public:
3838
/**
3939
* Widget for viewing and editing certificate authorities directly in database
40+
* @param parent Parent widget
4041
*/
4142
explicit QgsAuthAuthoritiesEditor( QWidget *parent = 0 );
4243
~QgsAuthAuthoritiesEditor();
@@ -78,7 +79,8 @@ class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthA
7879
void authMessageOut( const QString& message, const QString& authtag, QgsAuthManager::MessageLevel level );
7980

8081
protected:
81-
void showEvent( QShowEvent *e );
82+
/** Overridden show event of base widget */
83+
void showEvent( QShowEvent *e ) override;
8284

8385
private:
8486
enum CaType

‎src/gui/auth/qgsauthcertificateinfo.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,25 @@ class GUI_EXPORT QgsAuthCertInfoDialog : public QDialog
138138
Q_OBJECT
139139

140140
public:
141+
/**
142+
* Construct a dialog displaying detailed info on a certificate and its hierarchical trust chain
143+
* @param cert Certificate object
144+
* @param manageCertTrust Whether to show widgets to manage the trust policy of certs in hierarchy
145+
* @param parent Parent widget
146+
* @param connectionCAs List of hierarchical certificates in a connection
147+
*/
141148
explicit QgsAuthCertInfoDialog( const QSslCertificate& cert,
142149
bool manageCertTrust,
143150
QWidget *parent = 0,
144151
QList<QSslCertificate> connectionCAs = QList<QSslCertificate>() );
145152
~QgsAuthCertInfoDialog();
146153

154+
/** Get access to embedded info widget */
147155
QgsAuthCertInfo *certInfoWidget() { return mCertInfoWdgt; }
148156

157+
/** Whether the trust cache has been rebuilt
158+
* @note This happens when a trust policy has been adjusted for any cert in the hierarchy
159+
*/
149160
bool trustCacheRebuilt() { return mCertInfoWdgt->trustCacheRebuilt(); }
150161

151162
private:

‎src/gui/auth/qgsauthcerttrustpolicycombobox.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,29 @@ class GUI_EXPORT QgsAuthCertTrustPolicyComboBox : public QComboBox
2828
Q_OBJECT
2929

3030
public:
31+
/**
32+
* Construct a combo box for defining certificate trust policy
33+
* @param parent Parent widget
34+
* @param policy Defined trust policy
35+
* @param defaultpolicy Default trust policy
36+
*/
3137
explicit QgsAuthCertTrustPolicyComboBox(
3238
QWidget *parent = 0,
3339
QgsAuthCertUtils::CertTrustPolicy policy = QgsAuthCertUtils::DefaultTrust,
3440
QgsAuthCertUtils::CertTrustPolicy defaultpolicy = QgsAuthCertUtils::DefaultTrust );
3541
~QgsAuthCertTrustPolicyComboBox();
3642

43+
/** Get currently set trust policy */
3744
QgsAuthCertUtils::CertTrustPolicy trustPolicy();
45+
46+
/** Get trust policy for a given index of combobox */
3847
QgsAuthCertUtils::CertTrustPolicy trustPolicyForIndex( int indx );
3948

4049
public slots:
50+
/** Set current trust policy */
4151
void setTrustPolicy( QgsAuthCertUtils::CertTrustPolicy policy );
4252

53+
/** Set default trust policy */
4354
void setDefaultTrustPolicy( QgsAuthCertUtils::CertTrustPolicy defaultpolicy );
4455

4556
private slots:

‎src/gui/auth/qgsauthconfigedit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class GUI_EXPORT QgsAuthConfigEdit : public QDialog, private Ui::QgsAuthConfigEd
3434
Q_OBJECT
3535

3636
public:
37+
/** Type of configuration validity */
3738
enum Validity
3839
{
3940
Valid,

‎src/gui/auth/qgsauthconfigeditor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ void QgsAuthConfigEditor::on_btnAddConfig_clicked()
195195
{
196196
mConfigModel->select();
197197
}
198+
ace->deleteLater();
198199
}
199200

200201
void QgsAuthConfigEditor::on_btnEditConfig_clicked()
@@ -213,6 +214,7 @@ void QgsAuthConfigEditor::on_btnEditConfig_clicked()
213214
{
214215
mConfigModel->select();
215216
}
217+
ace->deleteLater();
216218
}
217219

218220
void QgsAuthConfigEditor::on_btnRemoveConfig_clicked()

‎src/gui/auth/qgsauthconfigselect.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ void QgsAuthConfigSelect::on_btnConfigAdd_clicked()
161161
{
162162
setConfigId( ace->configId() );
163163
}
164+
ace->deleteLater();
164165
}
165166

166167
void QgsAuthConfigSelect::on_btnConfigEdit_clicked()
@@ -174,6 +175,7 @@ void QgsAuthConfigSelect::on_btnConfigEdit_clicked()
174175
{
175176
setConfigId( mAuthCfg );
176177
}
178+
ace->deleteLater();
177179
}
178180

179181
void QgsAuthConfigSelect::on_btnConfigRemove_clicked()

‎src/gui/auth/qgsautheditorwidgets.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito
3030
Q_OBJECT
3131

3232
public:
33+
/**
34+
* Construct a widget to contain various authentication editors
35+
* @param parent Parent widget
36+
*/
3337
explicit QgsAuthEditorWidgets( QWidget *parent = 0 ) :
3438
QWidget( parent )
3539
{
@@ -38,6 +42,7 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito
3842

3943
~QgsAuthEditorWidgets() {}
4044

45+
/** Get access to embedded tabbed widget */
4146
QTabWidget * tabbedWidget() { return tabWidget; }
4247
};
4348

‎src/gui/auth/qgsauthguiutils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,32 @@
2727
#include "qgsmessagebar.h"
2828

2929

30-
const QColor QgsAuthGuiUtils::greenColor()
30+
QColor QgsAuthGuiUtils::greenColor()
3131
{
3232
return QColor( 0, 170, 0 );
3333
}
3434

35-
const QColor QgsAuthGuiUtils::orangeColor()
35+
QColor QgsAuthGuiUtils::orangeColor()
3636
{
3737
return QColor( 255, 128, 0 );
3838
}
3939

40-
const QColor QgsAuthGuiUtils::redColor()
40+
QColor QgsAuthGuiUtils::redColor()
4141
{
4242
return QColor( 200, 0, 0 );
4343
}
4444

45-
const QString QgsAuthGuiUtils::greenTextStyleSheet( const QString &selector )
45+
QString QgsAuthGuiUtils::greenTextStyleSheet( const QString &selector )
4646
{
4747
return QString( "%1{color: %2;}" ).arg( selector ).arg( QgsAuthGuiUtils::greenColor().name() );
4848
}
4949

50-
const QString QgsAuthGuiUtils::orangeTextStyleSheet( const QString &selector )
50+
QString QgsAuthGuiUtils::orangeTextStyleSheet( const QString &selector )
5151
{
5252
return QString( "%1{color: %2;}" ).arg( selector ).arg( QgsAuthGuiUtils::orangeColor().name() );
5353
}
5454

55-
const QString QgsAuthGuiUtils::redTextStyleSheet( const QString &selector )
55+
QString QgsAuthGuiUtils::redTextStyleSheet( const QString &selector )
5656
{
5757
return QString( "%1{color: %2;}" ).arg( selector ).arg( QgsAuthGuiUtils::redColor().name() );
5858
}

‎src/gui/auth/qgsauthguiutils.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ class GUI_EXPORT QgsAuthGuiUtils
3131
public:
3232

3333
/** Green color representing valid, trusted, etc. certificate */
34-
static const QColor greenColor();
34+
static QColor greenColor();
3535

3636
/** Orange color representing loaded component, but not stored in database */
37-
static const QColor orangeColor();
37+
static QColor orangeColor();
3838

3939
/** Red color representing invalid, untrusted, etc. certificate */
40-
static const QColor redColor();
40+
static QColor redColor();
4141

4242
/** Green text stylesheet representing valid, trusted, etc. certificate */
43-
static const QString greenTextStyleSheet( const QString& selector = "*" );
43+
static QString greenTextStyleSheet( const QString& selector = "*" );
4444

4545
/** Orange text stylesheet representing loaded component, but not stored in database */
46-
static const QString orangeTextStyleSheet( const QString& selector = "*" );
46+
static QString orangeTextStyleSheet( const QString& selector = "*" );
4747

4848
/** Red text stylesheet representing invalid, untrusted, etc. certificate */
49-
static const QString redTextStyleSheet( const QString& selector = "*" );
49+
static QString redTextStyleSheet( const QString& selector = "*" );
5050

5151

5252
/** Verify the authentication system is active, else notify user */

‎src/gui/auth/qgsauthidentitieseditor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class GUI_EXPORT QgsAuthIdentitiesEditor : public QWidget, private Ui::QgsAuthId
3535
public:
3636
/**
3737
* Widget for editing authentication configurations directly in database
38+
* @param parent Parent widget
3839
*/
3940
explicit QgsAuthIdentitiesEditor( QWidget *parent = 0 );
4041
~QgsAuthIdentitiesEditor();
@@ -66,7 +67,8 @@ class GUI_EXPORT QgsAuthIdentitiesEditor : public QWidget, private Ui::QgsAuthId
6667
void authMessageOut( const QString& message, const QString& authtag, QgsAuthManager::MessageLevel level );
6768

6869
protected:
69-
void showEvent( QShowEvent *e );
70+
/** Overridden show event of base widget */
71+
void showEvent( QShowEvent *e ) override;
7072

7173
private:
7274
enum IdentityType

‎src/gui/auth/qgsauthimportcertdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void QgsAuthImportCertDialog::validateCertificates()
133133

134134
int certssize = certs.size();
135135

136-
Q_FOREACH ( QSslCertificate cert, certs )
136+
Q_FOREACH ( const QSslCertificate &cert, certs )
137137
{
138138
if ( cert.isValid() )
139139
++validcerts;
@@ -157,7 +157,7 @@ void QgsAuthImportCertDialog::validateCertificates()
157157

158158
if ( nixcerts.size() > 0 )
159159
{
160-
Q_FOREACH ( QSslCertificate nixcert, nixcerts )
160+
Q_FOREACH ( const QSslCertificate &nixcert, nixcerts )
161161
{
162162
certs.removeOne( nixcert );
163163
}

‎src/gui/auth/qgsauthimportcertdialog.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,45 @@ class GUI_EXPORT QgsAuthImportCertDialog : public QDialog, private Ui::QgsAuthIm
3333
Q_OBJECT
3434

3535
public:
36+
/** Type of filter to apply to dialog */
3637
enum CertFilter
3738
{
3839
NoFilter = 1,
3940
CaFilter = 2,
4041
};
4142

43+
/** Type of inputs for certificates */
4244
enum CertInput
4345
{
4446
AllInputs = 1,
4547
FileInput = 2,
4648
TextInput = 3,
4749
};
4850

51+
/**
52+
* Construct a dialog for importing certificates
53+
* @param parent Parent widget
54+
* @param filter Certificate type filter to apply to dialog
55+
* @param input Type of input(s) for certificates
56+
*/
4957
explicit QgsAuthImportCertDialog( QWidget *parent = 0,
5058
QgsAuthImportCertDialog::CertFilter filter = NoFilter,
5159
QgsAuthImportCertDialog::CertInput input = AllInputs );
5260
~QgsAuthImportCertDialog();
5361

62+
/** Get list of certificate objects to import */
5463
const QList<QSslCertificate> certificatesToImport() { return mCerts; }
5564

65+
/** Get the file path to a certificate to import */
5666
const QString certFileToImport();
5767

68+
/** Get certificate text to import */
5869
const QString certTextToImport();
5970

71+
/** Whether to allow importation of invalid certificates (so trust policy can be overridden) */
6072
bool allowInvalidCerts();
6173

74+
/** Defined trust policy for imported certificates */
6275
QgsAuthCertUtils::CertTrustPolicy certTrustPolicy();
6376

6477
private slots:

‎src/gui/auth/qgsauthimportidentitydialog.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,43 @@ class GUI_EXPORT QgsAuthImportIdentityDialog : public QDialog, private Ui::QgsAu
3333
Q_OBJECT
3434

3535
public:
36+
/** Type of identity being imported */
3637
enum IdentityType
3738
{
3839
CertIdentity = 0,
3940
};
4041

42+
/** Type of bundles supported */
4143
enum BundleTypes
4244
{
4345
PkiPaths = 0,
4446
PkiPkcs12 = 1,
4547
};
4648

49+
/** Type of certificate/bundle validity output */
4750
enum Validity
4851
{
4952
Valid,
5053
Invalid,
5154
Unknown
5255
};
5356

57+
/**
58+
* Construct a dialog for importing identities
59+
* @param identitytype Type of the identity to import
60+
* @param parent Parent widget
61+
*/
5462
explicit QgsAuthImportIdentityDialog( QgsAuthImportIdentityDialog::IdentityType identitytype,
5563
QWidget *parent = 0 );
5664
~QgsAuthImportIdentityDialog();
5765

66+
/** Get identity type */
5867
QgsAuthImportIdentityDialog::IdentityType identityType() { return mIdentityType; }
5968

69+
/** Get certificate/key bundle to be imported */
6070
const QPair<QSslCertificate, QSslKey> certBundleToImport() { return mCertBundle; }
6171

72+
/** Get certificate/key bundle to be imported as a PKI bundle object */
6273
const QgsPkiBundle pkiBundleToImport() { return mPkiBundle; }
6374

6475
private slots:

‎src/gui/auth/qgsauthmethodedit.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,35 @@ class GUI_EXPORT QgsAuthMethodEdit : public QWidget
3030
Q_OBJECT
3131

3232
public:
33+
/** Validate the configuration of subclasses */
3334
virtual bool validateConfig() = 0;
3435

36+
/** The configuration key-vale map of subclasses */
3537
virtual QgsStringMap configMap() const = 0;
3638

3739
signals:
40+
/** Emitted when the configuration validatity changes */
3841
void validityChanged( bool valid );
3942

4043
public slots:
44+
/**
45+
* Load an existing config map into subclassed widget
46+
* @param configmap
47+
*/
4148
virtual void loadConfig( const QgsStringMap &configmap ) = 0;
4249

50+
/** Clear GUI controls in subclassed widget, optionally reloading any previously loaded config map */
4351
virtual void resetConfig() = 0;
4452

53+
/** Clear GUI controls in subclassed widget */
4554
virtual void clearConfig() = 0;
4655

4756
protected:
57+
/**
58+
* Construct widget to edit an authentication method configuration
59+
* @note Non-public since this is an abstract base class
60+
* @param parent Parent widget
61+
*/
4862
explicit QgsAuthMethodEdit( QWidget *parent = 0 )
4963
: QWidget( parent )
5064
{}

‎src/gui/auth/qgsauthserverseditor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class GUI_EXPORT QgsAuthServersEditor : public QWidget, private Ui::QgsAuthServe
3434
public:
3535
/**
3636
* Widget for editing authentication configurations directly in database
37+
* @param parent Parent Widget
3738
*/
3839
explicit QgsAuthServersEditor( QWidget *parent = 0 );
3940
~QgsAuthServersEditor();
@@ -63,7 +64,8 @@ class GUI_EXPORT QgsAuthServersEditor : public QWidget, private Ui::QgsAuthServe
6364
void authMessageOut( const QString& message, const QString& authtag, QgsAuthManager::MessageLevel level );
6465

6566
protected:
66-
void showEvent( QShowEvent *e );
67+
/** Overridden show event of base widget */
68+
void showEvent( QShowEvent *e ) override;
6769

6870
private:
6971
enum ConfigType

‎src/gui/auth/qgsauthsslconfigwidget.h

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,69 +38,111 @@ class GUI_EXPORT QgsAuthSslConfigWidget : public QWidget, private Ui::QgsAuthSsl
3838
Q_OBJECT
3939

4040
public:
41+
/**
42+
* Construct a widget for editing an SSL server certificate configuration
43+
* @param parent Parent widget
44+
* @param cert SSL server certificate object
45+
* @param hostport Unique host:port to associate with the server certificate
46+
* @param connectionCAs List of trusted Certificate Authorities objects
47+
*/
4148
explicit QgsAuthSslConfigWidget( QWidget *parent = 0,
4249
const QSslCertificate &cert = QSslCertificate(),
4350
const QString &hostport = QString(),
4451
const QList<QSslCertificate>& connectionCAs = QList<QSslCertificate>() );
4552
~QgsAuthSslConfigWidget();
4653

54+
/** Access to the certificate's group box widget */
4755
QGroupBox *certificateGroupBox() { return grpbxCert; }
56+
/** Access to the SSL configuration's group box widget */
4857
QGroupBox *sslConfigGroupBox() { return grpbxSslConfig; }
4958

59+
/** Get the SSL configuration */
5060
const QgsAuthConfigSslServer sslCustomConfig();
5161

62+
/** Get the SSL server certificate */
5263
const QSslCertificate sslCertificate() { return mCert; }
5364

65+
/** Get the host:port to associate with the server certificate */
5466
const QString sslHost() { return leHost->text(); }
5567

68+
/** Get the SSL protocl used for connections */
5669
QSsl::SslProtocol sslProtocol();
5770

71+
/** Get list of the SSL errors (as enums) to be ignored for connections */
5872
const QList<QSslError::SslError> sslIgnoreErrorEnums();
5973

74+
/** Get the client's peer verify mode for connections */
6075
QSslSocket::PeerVerifyMode sslPeerVerifyMode();
6176

77+
/** Get the client's peer verify depth for connections
78+
* @note Value of 0 = unlimited
79+
*/
6280
int sslPeerVerifyDepth();
6381

6482
public slots:
83+
/** Enable or disable the custom options widget */
6584
void enableSslCustomOptions( bool enable );
6685

6786
// may also load existing config, if found
87+
/** Set SSl certificate and any associated host:port */
6888
void setSslCertificate( const QSslCertificate& cert, const QString &hostport = QString() );
6989

90+
/** Load an existing SSL server configuration */
7091
void loadSslCustomConfig( const QgsAuthConfigSslServer& config = QgsAuthConfigSslServer() );
7192

93+
/** Save the current SSL server configuration to the authentication database */
7294
void saveSslCertConfig();
7395

96+
/** Clear the current SSL server configuration and disabled it */
7497
void resetSslCertConfig();
7598

99+
/** Set the SSL protocol to use in connections */
76100
void setSslProtocol( QSsl::SslProtocol protocol );
77101

102+
/** Reset the SSL protocol to use in connections to the default */
78103
void resetSslProtocol();
79104

105+
/** Add to SSL errors to ignore for the connection */
80106
void appendSslIgnoreErrors( const QList<QSslError>& errors );
81107

108+
/** Set the SSL errors (as enums) to ignore for the connection */
82109
void setSslIgnoreErrorEnums( const QList<QSslError::SslError>& errorenums );
83110

111+
/** Set the SSL errors to ignore for the connection */
84112
void setSslIgnoreErrors( const QList<QSslError>& errors );
85113

114+
/** Clear the SSL errors to ignore for the connection */
86115
void resetSslIgnoreErrors();
87116

117+
/** Set the client's peer verify mode for connections */
88118
void setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth );
89119

120+
/** Reset the client's peer verify mode for connections to default */
90121
void resetSslPeerVerify();
91122

123+
/** Set the host of the server */
92124
void setSslHost( const QString& host );
93125

126+
/** Set whether the config group box is checkable */
94127
void setConfigCheckable( bool checkable );
95128

129+
/** Parse string for host:port */
96130
void validateHostPortText( const QString &txt );
97131

132+
/** Verify if the configuration if ready to save */
98133
bool readyToSave();
99134

100135
signals:
136+
/** Emitted when the enabled state of the configuration changes */
101137
void configEnabledChanged( bool enabled );
138+
139+
/** Emitted when an certificate of same SHA hash is found in authentication database */
102140
void certFoundInAuthDatabase( bool found );
141+
142+
/** Emitted when the validity of the host:port changes */
103143
void hostPortValidityChanged( bool valid );
144+
145+
/** Emitted when the configuration can be saved changes */
104146
void readyToSaveChanged( bool cansave );
105147

106148
private slots:
@@ -143,15 +185,23 @@ class GUI_EXPORT QgsAuthSslConfigDialog : public QDialog
143185
Q_OBJECT
144186

145187
public:
188+
/**
189+
* Construct wrapper dialog for the SSL config widget
190+
* @param parent Parent widget
191+
* @param cert SSL server certificate object
192+
* @param hostport Unique host:port to associate with the server certificate
193+
*/
146194
explicit QgsAuthSslConfigDialog( QWidget *parent = 0,
147195
const QSslCertificate& cert = QSslCertificate(),
148196
const QString &hostport = QString() );
149197
~QgsAuthSslConfigDialog();
150198

199+
/** Access the embedded SSL server configuration widget */
151200
QgsAuthSslConfigWidget *sslCustomConfigWidget() { return mSslConfigWdgt; }
152201

153202
public slots:
154-
void accept();
203+
/** Overridden base dialog accept slot */
204+
void accept() override;
155205

156206
private slots:
157207
void checkCanSave( bool cansave );

‎src/gui/auth/qgsauthsslerrorsdialog.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class GUI_EXPORT QgsAuthSslErrorsDialog : public QDialog, private Ui::QgsAuthSsl
3232
{
3333
Q_OBJECT
3434
public:
35+
/**
36+
* Construct a dialog to handle SSL errors and saving SSL server certificate exceptions
37+
* @param reply Network reply that hand error(s)
38+
* @param sslErrors SSL errors that occurred
39+
* @param parent Parent widget
40+
* @param digest SHA digest of server certificate
41+
* @param hostport Unique host:port to associate with the server certificate
42+
*/
3543
QgsAuthSslErrorsDialog( QNetworkReply *reply,
3644
const QList<QSslError>& sslErrors,
3745
QWidget *parent = 0 ,

‎src/gui/auth/qgsauthsslimportdialog.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,16 @@ class GUI_EXPORT QgsAuthSslImportDialog : public QDialog, private Ui::QgsAuthSsl
8080
{
8181
Q_OBJECT
8282
public:
83+
/**
84+
* Construct dialog for importing certificates
85+
* @param parent
86+
*/
8387
QgsAuthSslImportDialog( QWidget *parent = 0 );
8488
~QgsAuthSslImportDialog();
8589

8690
public slots:
87-
void accept();
91+
/** Overridden slot of base dialog */
92+
void accept() override;
8893

8994
private slots:
9095
void updateEnabledState();

‎src/gui/auth/qgsauthtrustedcasdialog.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ class GUI_EXPORT QgsAuthTrustedCAsDialog : public QDialog, private Ui::QgsAuthTr
3434
Q_OBJECT
3535

3636
public:
37+
/**
38+
* Construct a dialog that will list the trusted Certificate Authorities
39+
* @param parent Parent widget
40+
* @param trustedCAs List of trusted Certificate Authorities objects
41+
*/
3742
explicit QgsAuthTrustedCAsDialog( QWidget *parent = 0,
3843
QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
3944
~QgsAuthTrustedCAsDialog();
@@ -59,7 +64,8 @@ class GUI_EXPORT QgsAuthTrustedCAsDialog : public QDialog, private Ui::QgsAuthTr
5964
void authMessageOut( const QString& message, const QString& authtag, QgsAuthManager::MessageLevel level );
6065

6166
protected:
62-
void showEvent( QShowEvent *e );
67+
/** Overridden widget show event */
68+
void showEvent( QShowEvent *e ) override;
6369

6470
private:
6571
enum CaType

‎src/gui/qgscredentialdialog.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void QgsCredentialDialog::requestCredentialsMasterPassword( QString * password,
122122
QString titletxt( stored ? tr( "Enter CURRENT master authentication password" ) : tr( "Set NEW master authentication password" ) );
123123
lblPasswordTitle->setText( titletxt );
124124

125-
frameMasterPassVerify->setVisible( !stored );
125+
leMasterPassVerify->setVisible( !stored );
126126
lblDontForget->setVisible( !stored );
127127

128128
QApplication::setOverrideCursor( Qt::ArrowCursor );
@@ -180,7 +180,7 @@ void QgsCredentialDialog::requestCredentialsMasterPassword( QString * password,
180180
++passfailed;
181181

182182
leMasterPass->setStyleSheet( invalidStyle_() );
183-
if ( frameMasterPassVerify->isVisible() )
183+
if ( leMasterPassVerify->isVisible() )
184184
{
185185
leMasterPassVerify->setStyleSheet( invalidStyle_() );
186186
}
@@ -196,7 +196,6 @@ void QgsCredentialDialog::requestCredentialsMasterPassword( QString * password,
196196
leMasterPass->clear();
197197
chkMasterPassShow->setChecked( false );
198198
leMasterPassVerify->clear();
199-
chkMasterPassVerifyShow->setChecked( false );
200199

201200
chkbxEraseAuthDb->setChecked( false );
202201
lblSavedForSession->setVisible( true );
@@ -211,25 +210,21 @@ void QgsCredentialDialog::requestCredentialsMasterPassword( QString * password,
211210
void QgsCredentialDialog::on_chkMasterPassShow_stateChanged( int state )
212211
{
213212
leMasterPass->setEchoMode(( state > 0 ) ? QLineEdit::Normal : QLineEdit::Password );
214-
}
215-
216-
void QgsCredentialDialog::on_chkMasterPassVerifyShow_stateChanged( int state )
217-
{
218213
leMasterPassVerify->setEchoMode(( state > 0 ) ? QLineEdit::Normal : QLineEdit::Password );
219214
}
220215

221216
void QgsCredentialDialog::on_leMasterPass_textChanged( const QString &pass )
222217
{
223218
leMasterPass->setStyleSheet( "" );
224219
bool passok = !pass.isEmpty(); // regardless of new or comparing existing, empty password disallowed
225-
if ( frameMasterPassVerify->isVisible() )
220+
if ( leMasterPassVerify->isVisible() )
226221
{
227222
leMasterPassVerify->setStyleSheet( "" );
228223
passok = passok && ( leMasterPass->text() == leMasterPassVerify->text() );
229224
}
230225
mOkButton->setEnabled( passok );
231226

232-
if ( frameMasterPassVerify->isVisible() && !passok )
227+
if ( leMasterPassVerify->isVisible() && !passok )
233228
{
234229
leMasterPass->setStyleSheet( invalidStyle_() );
235230
leMasterPassVerify->setStyleSheet( invalidStyle_() );
@@ -238,7 +233,7 @@ void QgsCredentialDialog::on_leMasterPass_textChanged( const QString &pass )
238233

239234
void QgsCredentialDialog::on_leMasterPassVerify_textChanged( const QString &pass )
240235
{
241-
if ( frameMasterPassVerify->isVisible() )
236+
if ( leMasterPassVerify->isVisible() )
242237
{
243238
leMasterPass->setStyleSheet( "" );
244239
leMasterPassVerify->setStyleSheet( "" );

‎src/gui/qgscredentialdialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class GUI_EXPORT QgsCredentialDialog : public QDialog, public QgsCredentials, pr
4646
void requestCredentialsMasterPassword( QString *password, bool stored, bool *ok );
4747

4848
void on_chkMasterPassShow_stateChanged( int state );
49-
void on_chkMasterPassVerifyShow_stateChanged( int state );
5049
void on_leMasterPass_textChanged( const QString& pass );
5150
void on_leMasterPassVerify_textChanged( const QString& pass );
5251
void on_chkbxEraseAuthDb_toggled( bool checked );

‎src/ui/qgscredentialdialog.ui

Lines changed: 23 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
<property name="fieldGrowthPolicy">
1818
<enum>QFormLayout::ExpandingFieldsGrow</enum>
1919
</property>
20+
<item row="3" column="0" colspan="2">
21+
<widget class="QDialogButtonBox" name="buttonBox">
22+
<property name="orientation">
23+
<enum>Qt::Horizontal</enum>
24+
</property>
25+
<property name="standardButtons">
26+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
27+
</property>
28+
</widget>
29+
</item>
2030
<item row="1" column="0" colspan="2">
2131
<widget class="QStackedWidget" name="stackedWidget">
2232
<property name="currentIndex">
@@ -111,18 +121,15 @@
111121
</widget>
112122
</item>
113123
<item>
114-
<layout class="QHBoxLayout" name="horizontalLayout">
115-
<property name="spacing">
116-
<number>6</number>
117-
</property>
118-
<item>
124+
<layout class="QGridLayout" name="gridLayout">
125+
<item row="0" column="0">
119126
<widget class="QLineEdit" name="leMasterPass">
120127
<property name="echoMode">
121128
<enum>QLineEdit::Password</enum>
122129
</property>
123130
</widget>
124131
</item>
125-
<item>
132+
<item row="0" column="1">
126133
<widget class="QCheckBox" name="chkMasterPassShow">
127134
<property name="sizePolicy">
128135
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -135,58 +142,18 @@
135142
</property>
136143
</widget>
137144
</item>
145+
<item row="1" column="0">
146+
<widget class="QLineEdit" name="leMasterPassVerify">
147+
<property name="echoMode">
148+
<enum>QLineEdit::Password</enum>
149+
</property>
150+
<property name="placeholderText">
151+
<string>Verify password</string>
152+
</property>
153+
</widget>
154+
</item>
138155
</layout>
139156
</item>
140-
<item>
141-
<widget class="QFrame" name="frameMasterPassVerify">
142-
<property name="frameShape">
143-
<enum>QFrame::NoFrame</enum>
144-
</property>
145-
<property name="frameShadow">
146-
<enum>QFrame::Raised</enum>
147-
</property>
148-
<layout class="QHBoxLayout" name="horizontalLayout_2">
149-
<property name="spacing">
150-
<number>6</number>
151-
</property>
152-
<property name="leftMargin">
153-
<number>0</number>
154-
</property>
155-
<property name="topMargin">
156-
<number>0</number>
157-
</property>
158-
<property name="rightMargin">
159-
<number>0</number>
160-
</property>
161-
<property name="bottomMargin">
162-
<number>0</number>
163-
</property>
164-
<item>
165-
<widget class="QLineEdit" name="leMasterPassVerify">
166-
<property name="echoMode">
167-
<enum>QLineEdit::Password</enum>
168-
</property>
169-
<property name="placeholderText">
170-
<string>Verify password</string>
171-
</property>
172-
</widget>
173-
</item>
174-
<item>
175-
<widget class="QCheckBox" name="chkMasterPassVerifyShow">
176-
<property name="sizePolicy">
177-
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
178-
<horstretch>0</horstretch>
179-
<verstretch>0</verstretch>
180-
</sizepolicy>
181-
</property>
182-
<property name="text">
183-
<string>Show</string>
184-
</property>
185-
</widget>
186-
</item>
187-
</layout>
188-
</widget>
189-
</item>
190157
<item>
191158
<widget class="QLabel" name="lblDontForget">
192159
<property name="styleSheet">
@@ -251,16 +218,6 @@ font-style: italic;
251218
</widget>
252219
</widget>
253220
</item>
254-
<item row="3" column="0" colspan="2">
255-
<widget class="QDialogButtonBox" name="buttonBox">
256-
<property name="orientation">
257-
<enum>Qt::Horizontal</enum>
258-
</property>
259-
<property name="standardButtons">
260-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
261-
</property>
262-
</widget>
263-
</item>
264221
</layout>
265222
</widget>
266223
<resources/>

0 commit comments

Comments
 (0)
Please sign in to comment.