login variants fields fixes
This commit is contained in:
@@ -585,8 +585,9 @@ Window {
|
|||||||
id: pfLogin
|
id: pfLogin
|
||||||
x: 20
|
x: 20
|
||||||
width: parent.width - 40
|
width: parent.width - 40
|
||||||
enabled: pfAuth.currentIndex !== 2
|
// Ник лицензионного профиля приходит из аккаунта: поля здесь нет.
|
||||||
placeholderText: pfAuth.currentIndex === 2 ? "Ник придёт из аккаунта" : "Логин"
|
visible: pfAuth.currentIndex !== 2
|
||||||
|
placeholderText: "Логин"
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
placeholderTextColor: "#666666"
|
placeholderTextColor: "#666666"
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
@@ -601,8 +602,8 @@ Window {
|
|||||||
id: pfPassword
|
id: pfPassword
|
||||||
x: 20
|
x: 20
|
||||||
width: parent.width - 40
|
width: parent.width - 40
|
||||||
enabled: pfAuth.currentIndex === 1
|
visible: pfAuth.currentIndex === 1
|
||||||
placeholderText: pfAuth.currentIndex === 1 ? "Пароль Ely.by" : "Не нужен для этого типа"
|
placeholderText: "Пароль Ely.by"
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
placeholderTextColor: "#666666"
|
placeholderTextColor: "#666666"
|
||||||
@@ -675,7 +676,12 @@ Window {
|
|||||||
const type = pfAuth.currentIndex === 2 ? "microsoft"
|
const type = pfAuth.currentIndex === 2 ? "microsoft"
|
||||||
: pfAuth.currentIndex === 1 ? "elyby" : "offline"
|
: pfAuth.currentIndex === 1 ? "elyby" : "offline"
|
||||||
if (name !== "") {
|
if (name !== "") {
|
||||||
backend.addProfile(name, pfLogin.text.trim(), pfPassword.text, type)
|
// Скрытые поля не сохраняем: в них мог остаться текст, набранный
|
||||||
|
// до переключения типа профиля.
|
||||||
|
backend.addProfile(name,
|
||||||
|
type === "microsoft" ? "" : pfLogin.text.trim(),
|
||||||
|
type === "elyby" ? pfPassword.text : "",
|
||||||
|
type)
|
||||||
profileBox.currentIndex = backend.profileNames.length - 1
|
profileBox.currentIndex = backend.profileNames.length - 1
|
||||||
// Профиль Microsoft без входа бесполезен: сразу показываем окно.
|
// Профиль Microsoft без входа бесполезен: сразу показываем окно.
|
||||||
if (type === "microsoft")
|
if (type === "microsoft")
|
||||||
@@ -767,8 +773,9 @@ Window {
|
|||||||
id: epLogin
|
id: epLogin
|
||||||
x: 20
|
x: 20
|
||||||
width: parent.width - 40
|
width: parent.width - 40
|
||||||
enabled: epAuth.currentIndex !== 2
|
// Для лицензии логин не вводят: ниже показан ник из аккаунта.
|
||||||
placeholderText: epAuth.currentIndex === 2 ? "Ник придёт из аккаунта" : "Логин"
|
visible: epAuth.currentIndex !== 2
|
||||||
|
placeholderText: "Логин"
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
placeholderTextColor: "#666666"
|
placeholderTextColor: "#666666"
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
@@ -779,12 +786,31 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Логин лицензионного профиля — ник, полученный при официальной
|
||||||
|
// авторизации. Отдельное поле, а не подмена epLogin.text: биндинг
|
||||||
|
// сломался бы первым же вводом в поле логина обычного профиля.
|
||||||
|
TextField {
|
||||||
|
id: epMsLogin
|
||||||
|
x: 20
|
||||||
|
width: parent.width - 40
|
||||||
|
visible: epAuth.currentIndex === 2 && editProfileDialog.msName !== ""
|
||||||
|
readOnly: true
|
||||||
|
text: editProfileDialog.msName
|
||||||
|
color: "#ffffff"
|
||||||
|
background: Rectangle {
|
||||||
|
color: "#2a2a2a"
|
||||||
|
radius: 6
|
||||||
|
border.color: "#444444"
|
||||||
|
border.width: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: epPassword
|
id: epPassword
|
||||||
x: 20
|
x: 20
|
||||||
width: parent.width - 40
|
width: parent.width - 40
|
||||||
enabled: epAuth.currentIndex === 1
|
visible: epAuth.currentIndex === 1
|
||||||
placeholderText: epAuth.currentIndex === 1 ? "Пароль Ely.by" : "Не нужен для этого типа"
|
placeholderText: "Пароль Ely.by"
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
placeholderTextColor: "#666666"
|
placeholderTextColor: "#666666"
|
||||||
@@ -816,9 +842,8 @@ Window {
|
|||||||
visible: epAuth.currentIndex === 2
|
visible: epAuth.currentIndex === 2
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: editProfileDialog.msLinked
|
text: editProfileDialog.msLinked ? qsTr("Вход выполнен")
|
||||||
? qsTr("Вход выполнен: %1").arg(editProfileDialog.msName)
|
: qsTr("Вход не выполнен")
|
||||||
: qsTr("Вход не выполнен")
|
|
||||||
color: editProfileDialog.msLinked ? "#91B315" : "#aaaaaa"
|
color: editProfileDialog.msLinked ? "#91B315" : "#aaaaaa"
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
}
|
}
|
||||||
@@ -842,8 +867,7 @@ Window {
|
|||||||
// Microsoft — сохраняем его до входа, иначе backend
|
// Microsoft — сохраняем его до входа, иначе backend
|
||||||
// припишет токены профилю другого типа.
|
// припишет токены профилю другого типа.
|
||||||
backend.updateProfile(editProfileDialog.editIndex,
|
backend.updateProfile(editProfileDialog.editIndex,
|
||||||
epName.text.trim(), epLogin.text.trim(),
|
epName.text.trim(), "", "", "microsoft")
|
||||||
epPassword.text, "microsoft")
|
|
||||||
editProfileDialog.close()
|
editProfileDialog.close()
|
||||||
backend.startMicrosoftLogin(editProfileDialog.editIndex)
|
backend.startMicrosoftLogin(editProfileDialog.editIndex)
|
||||||
}
|
}
|
||||||
@@ -899,10 +923,13 @@ Window {
|
|||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
const name = epName.text.trim()
|
const name = epName.text.trim()
|
||||||
|
const type = epAuth.currentIndex === 2 ? "microsoft"
|
||||||
|
: epAuth.currentIndex === 1 ? "elyby" : "offline"
|
||||||
if (editIndex >= 0 && name !== "")
|
if (editIndex >= 0 && name !== "")
|
||||||
backend.updateProfile(editIndex, name, epLogin.text.trim(), epPassword.text,
|
backend.updateProfile(editIndex, name,
|
||||||
epAuth.currentIndex === 2 ? "microsoft"
|
type === "microsoft" ? "" : epLogin.text.trim(),
|
||||||
: epAuth.currentIndex === 1 ? "elyby" : "offline")
|
type === "elyby" ? epPassword.text : "",
|
||||||
|
type)
|
||||||
editIndex = -1
|
editIndex = -1
|
||||||
epName.text = ""; epLogin.text = ""; epPassword.text = ""
|
epName.text = ""; epLogin.text = ""; epPassword.text = ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user