33 QList < QPair<QgsAuthCertUtils::CertTrustPolicy, QString> > policies;
35 defaultTrustText( defaultpolicy ) )
41 for (
int i = 0; i < policies.size(); i++ )
44 QString name = policies.at( i ).second;
45 addItem( name, QVariant( (
int )polcy ) );
55 connect(
this,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
56 this, &QgsAuthCertTrustPolicyComboBox::highlightCurrentIndex );
74 int idx = findData( QVariant( (
int )policy ) );
75 setCurrentIndex( idx == -1 ? 0 : idx );
81 setItemText( idx, defaultTrustText( defaultpolicy ) );
84 void QgsAuthCertTrustPolicyComboBox::highlightCurrentIndex(
int indx )
87 QString ss( QLatin1String(
"" ) );
104 QgsDebugMsg( QString(
"Set Stylesheet to : %1" ).arg( ss ) );
122 return QStringLiteral(
"%1 (%2)" )
QgsAuthCertUtils::CertTrustPolicy trustPolicy()
Gets currently set trust policy.
static QColor redColor()
Red color representing invalid, untrusted, etc. certificate.
static QColor greenColor()
Green color representing valid, trusted, etc. certificate.
static QString greenTextStyleSheet(const QString &selector="*")
Green text stylesheet representing valid, trusted, etc. certificate.
QgsAuthCertTrustPolicyComboBox(QWidget *parent=nullptr, QgsAuthCertUtils::CertTrustPolicy policy=QgsAuthCertUtils::DefaultTrust, QgsAuthCertUtils::CertTrustPolicy defaultpolicy=QgsAuthCertUtils::DefaultTrust)
Construct a combo box for defining certificate trust policy.
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
static QString redTextStyleSheet(const QString &selector="*")
Red text stylesheet representing invalid, untrusted, etc. certificate.
QgsAuthCertUtils::CertTrustPolicy trustPolicyForIndex(int indx)
Gets trust policy for a given index of combobox.
void setDefaultTrustPolicy(QgsAuthCertUtils::CertTrustPolicy defaultpolicy)
Sets default trust policy.
CertTrustPolicy
Type of certificate trust policy.
QgsAuthCertUtils::CertTrustPolicy defaultCertTrustPolicy()
Gets the default certificate trust policy preferred by user.
static QString getCertTrustName(QgsAuthCertUtils::CertTrustPolicy trust)
Gets the general name for certificate trust.
void setTrustPolicy(QgsAuthCertUtils::CertTrustPolicy policy)
Sets current trust policy.