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