Skip to content

Commit

Permalink
feat: 添加 identity 支持 dde-network-core 处理
Browse files Browse the repository at this point in the history
添加 identity 支持 dde-network-core 处理

Log:
Task: https://pms.uniontech.com/task-view-212907.html
Influence: 无线网络
Change-Id: Ie497219d973b06969baee1bd09af5ebc60225381
  • Loading branch information
liaohanqin committed Jan 12, 2023
1 parent b48807b commit ab0e5df
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion dnetwork-secret-dialog/networkdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,32 @@ bool NetworkDialog::exec(const QJsonDocument &doc)
device = array.first().toString();
}
QString connName = obj.value("connId").toString();
if (!connName.isEmpty() && (1 == obj.value("secrets").toArray().size())) {
QJsonObject propsObj = obj.value("props").toObject();
QString password;
static const char* identity = "identity";
bool needIdentity = false;
int count = 0;
for (auto secret : obj.value("secrets").toArray()) {
const QString& key = secret.toString();
if (key == identity) {
needIdentity = true;
continue;
}
count++;
if (propsObj.contains(key)) {
password = propsObj.value(key).toString();
}
}
if (!connName.isEmpty() && 1 == count) {
m_key = connName;
QJsonObject json;
json.insert("dev", device);
json.insert("ssid", m_key);
json.insert("wait", true);
if (needIdentity) {
json.insert(identity, propsObj.value(identity).toString());
}
json.insert("password", password);
QJsonDocument doc;
doc.setObject(json);
m_data = "\nconnect:" + doc.toJson(QJsonDocument::Compact) + "\n";
Expand Down

0 comments on commit ab0e5df

Please sign in to comment.