bugfix: fixed authData saving

This commit is contained in:
vladimir.kuznetsov 2024-10-24 21:22:21 +08:00
parent 628e22869d
commit 131b8e69f5
5 changed files with 10 additions and 3 deletions

View file

@ -847,6 +847,8 @@ bool InstallController::updateServiceFromApi(const int serverIndex, const QStrin
newApiConfig.insert(configKey::serviceProtocol, apiConfig.value(configKey::serviceProtocol)); newApiConfig.insert(configKey::serviceProtocol, apiConfig.value(configKey::serviceProtocol));
newServerConfig.insert(configKey::apiConfig, newApiConfig); newServerConfig.insert(configKey::apiConfig, newApiConfig);
newServerConfig.insert(configKey::authData, authData);
newServerConfig.insert(config_key::crc, serverConfig.value(config_key::crc));
m_serversModel->editServer(newServerConfig, serverIndex); m_serversModel->editServer(newServerConfig, serverIndex);
if (reloadServiceConfig) { if (reloadServiceConfig) {

View file

@ -39,6 +39,9 @@ QVariant ApiCountryModel::data(const QModelIndex &index, int role) const
case CountryNameRole: { case CountryNameRole: {
return countryInfo.value(configKey::serverCountryName).toString(); return countryInfo.value(configKey::serverCountryName).toString();
} }
case CountryImageCodeRole: {
return countryInfo.value(configKey::serverCountryCode).toString().toUpper();
}
} }
return QVariant(); return QVariant();
@ -76,5 +79,6 @@ QHash<int, QByteArray> ApiCountryModel::roleNames() const
QHash<int, QByteArray> roles; QHash<int, QByteArray> roles;
roles[CountryNameRole] = "countryName"; roles[CountryNameRole] = "countryName";
roles[CountryCodeRole] = "countryCode"; roles[CountryCodeRole] = "countryCode";
roles[CountryImageCodeRole] = "countryImageCode";
return roles; return roles;
} }

View file

@ -11,7 +11,8 @@ class ApiCountryModel : public QAbstractListModel
public: public:
enum Roles { enum Roles {
CountryNameRole = Qt::UserRole + 1, CountryNameRole = Qt::UserRole + 1,
CountryCodeRole CountryCodeRole,
CountryImageCodeRole
}; };
explicit ApiCountryModel(QObject *parent = nullptr); explicit ApiCountryModel(QObject *parent = nullptr);

View file

@ -771,5 +771,5 @@ const QString ServersModel::getDefaultServerImagePathCollapsed()
if (countryCode.isEmpty()) { if (countryCode.isEmpty()) {
return ""; return "";
} }
return QString("qrc:/countriesFlags/images/flagKit/%1.svg").arg(countryCode); return QString("qrc:/countriesFlags/images/flagKit/%1.svg").arg(countryCode.toUpper());
} }

View file

@ -90,7 +90,7 @@ PageType {
Layout.rightMargin: 32 Layout.rightMargin: 32
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
source: "qrc:/countriesFlags/images/flagKit/" + countryCode + ".svg" source: "qrc:/countriesFlags/images/flagKit/" + countryImageCode + ".svg"
} }
} }