@@ -44,6 +44,7 @@ NetworkSecretDialog::NetworkSecretDialog(QJsonDocument jsonDoc, QWidget *parent)
4444 { " IPSec secret" , tr (" Password" ) },
4545 { " Xauth password" , tr (" Group Password" ) },
4646 })
47+ , m_propMap({ { " identity" , tr (" Username" ) }, })
4748{
4849 m_allInputValid = false ;
4950
@@ -67,6 +68,7 @@ void NetworkSecretDialog::parseJsonData(const QJsonDocument &jsonDoc)
6768 m_connName = m_jsonObj.value (" connId" ).toString ();
6869 m_connType = m_jsonObj.value (" connType" ).toString ();
6970 m_connSettingName = m_jsonObj.value (" settingName" ).toString ();
71+ m_propsObj = m_jsonObj.value (" props" ).toObject ();
7072 for (auto secret : m_jsonObj.value (" secrets" ).toArray ()) {
7173 m_secretKeyList.append (secret.toString ());
7274 }
@@ -107,11 +109,22 @@ void NetworkSecretDialog::initUI()
107109
108110 for (int row = 0 ; row < m_secretKeyList.size (); ++row) {
109111 const QString &secret = m_secretKeyList.at (row);
110- DPasswordEdit *lineEdit = new DPasswordEdit ();
112+
113+ DLineEdit *lineEdit;
114+ QString label;
115+ if (m_propMap.contains (secret)) {
116+ lineEdit = new DLineEdit ();
117+ label = m_propMap.value (secret);
118+ } else {
119+ lineEdit = new DPasswordEdit ();
120+ label = m_secretKeyStrMap.value (secret);
121+ }
122+ if (m_propsObj.contains (secret))
123+ lineEdit->setPlaceholderText (m_propsObj.value (secret).toString ());
111124 lineEdit->setClearButtonEnabled (true );
112125 lineEdit->setCopyEnabled (false );
113126 lineEdit->setCutEnabled (false );
114- gridLayout->addWidget (new QLabel (m_secretKeyStrMap. value (secret) + " :" ), row, 0 );
127+ gridLayout->addWidget (new QLabel (label + " :" ), row, 0 );
115128 gridLayout->addWidget (lineEdit, row, 1 );
116129 m_lineEditList.append (lineEdit);
117130
@@ -168,7 +181,7 @@ void NetworkSecretDialog::checkInputValid()
168181
169182 m_lineEditList.at (0 )->hideAlertMessage ();
170183 for (int i = 0 ; i < m_secretKeyList.size (); ++i) {
171- DPasswordEdit * const lineEdit = m_lineEditList.at (i);
184+ DLineEdit * const lineEdit = m_lineEditList.at (i);
172185 if (!passwordIsValid (lineEdit->text (), m_secretKeyList.at (i))) {
173186 allValid = false ;
174187 lineEdit->setAlert (true );
0 commit comments