18 #include "ui_qgsauthconfigidedit.h" 26 , mAuthCfgOrig( authcfg )
28 , mAllowEmpty( allowEmpty )
32 leAuthCfg->setReadOnly(
true );
36 leAuthCfg->setText( authcfg );
48 return leAuthCfg->text();
55 QString authcfg( leAuthCfg->text() );
56 bool curvalid = (( authcfg == mAuthCfgOrig && authcfg.
size() == 7 )
57 || ( mAllowEmpty && authcfg.isEmpty() ) );
64 if ( mValid != curvalid )
77 mAuthCfgOrig = authcfg;
79 leAuthCfg->setText( authcfg );
85 mAllowEmpty = allowed;
91 leAuthCfg->setText( mAuthCfgOrig );
92 updateValidityStyle(
true );
95 void QgsAuthConfigIdEdit::updateValidityStyle(
bool valid )
102 leAuthCfg->setStyleSheet( ss );
105 void QgsAuthConfigIdEdit::on_btnLock_toggled(
bool checked )
107 leAuthCfg->setReadOnly( !checked );
109 leAuthCfg->setFocus();
114 void QgsAuthConfigIdEdit::on_leAuthCfg_textChanged(
const QString &txt )
120 bool QgsAuthConfigIdEdit::isAlphaNumeric(
const QString &authcfg )
122 QRegExp rx(
"([a-z]|[A-Z]|[0-9]){7}" );
123 return rx.
indexIn( authcfg ) != -1;
static QgsAuthManager * instance()
Enforce singleton pattern.
void validityChanged(bool valid)
Validity of the ID has changed.
void setAuthConfigId(const QString &authcfg)
Set the authentication configuration ID, storing it, and validating the passed value.
static QColor yellowColor()
Yellow color representing caution regarding action.
int indexIn(const QString &str, int offset, CaretMode caretMode) const
const char * name() const
static QColor redColor()
Red color representing invalid, untrusted, etc.
void clear()
Clear all of the widget's editing state and contents.
QString const configId()
The authentication configuration ID, if valid, otherwise null QString.
bool validate()
Validate the widget state and ID.
void setAllowEmptyId(bool allowed)
Set whether to allow no ID to be set.
bool isDisabled() const
Whether QCA has the qca-ossl plugin, which a base run-time requirement.
bool configIdUnique(const QString &id) const
Verify if provided authentication id is unique.
QgsAuthConfigIdEdit(QWidget *parent=nullptr, const QString &authcfg=QString(), bool allowEmpty=true)
Widget to unlock and edit an authentication configuration ID.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const