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 ) ) );
48 #if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
60 connect(
this,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
61 this, &QgsAuthCertTrustPolicyComboBox::highlightCurrentIndex );
79 const int idx = findData( QVariant(
static_cast<int>( policy ) ) );
80 setCurrentIndex( idx == -1 ? 0 : idx );
86 setItemText( idx, defaultTrustText( defaultpolicy ) );
89 void QgsAuthCertTrustPolicyComboBox::highlightCurrentIndex(
int indx )
109 QgsDebugMsg( QStringLiteral(
"Set Stylesheet to : %1" ).arg( ss ) );
127 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.