EvDash: Improve settings
This commit is contained in:
parent
068d024f3f
commit
afcc6d8113
@ -28,12 +28,14 @@
|
|||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
import QtQuick 2.9
|
import QtQuick
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import Nymea 1.0
|
import Nymea
|
||||||
import Nymea.EvDash 1.0
|
import NymeaApp.Utils
|
||||||
|
|
||||||
|
import Nymea.EvDash
|
||||||
|
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
@ -66,25 +68,27 @@ SettingsPageBase {
|
|||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: removeUserPopup
|
id: removeUserPopup
|
||||||
|
|
||||||
NymeaDialog {
|
NymeaDialog {
|
||||||
id: removeUserDialog
|
id: removeUserDialog
|
||||||
|
|
||||||
property string username
|
property string username
|
||||||
|
|
||||||
headerIcon: "qrc:/icons/dialog-warning-symbolic.svg"
|
headerIcon: "qrc:/icons/dialog-warning-symbolic.svg"
|
||||||
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
title: qsTr("Remove user")
|
title: qsTr("Remove user")
|
||||||
text: qsTr("Are you sure you want to remove \"%1\"?").arg(username)
|
text: qsTr("Are you sure you want to remove \"%1\"?").arg(username)
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
evDashManager.removeUser(username);
|
evDashManager.removeUser(username);
|
||||||
popup.close();
|
removeUserDialog.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: evDashManager
|
target: evDashManager
|
||||||
onAddUserReply: {
|
onAddUserReply: (commandId, error) => {
|
||||||
if (error === EvDashManager.EvDashErrorNoError)
|
if (error === EvDashManager.EvDashErrorNoError)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -105,7 +109,7 @@ SettingsPageBase {
|
|||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveUserReply: {
|
onRemoveUserReply: (commandId, error) => {
|
||||||
if (error === EvDashManager.EvDashErrorNoError)
|
if (error === EvDashManager.EvDashErrorNoError)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -133,17 +137,19 @@ SettingsPageBase {
|
|||||||
NymeaDialog {
|
NymeaDialog {
|
||||||
id: addUserDialog
|
id: addUserDialog
|
||||||
|
|
||||||
title: qsTr("Create new user")
|
title: qsTr("Create a new user")
|
||||||
standardButtons: Dialog.NoButton
|
standardButtons: Dialog.NoButton
|
||||||
|
|
||||||
Label { text: qsTr("Username") }
|
|
||||||
|
|
||||||
NymeaTextField {
|
NymeaTextField {
|
||||||
id: usernameTextField
|
id: usernameTextField
|
||||||
|
placeholderText: qsTr("Username")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { text: qsTr("Password") }
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: Style.margins
|
||||||
|
}
|
||||||
|
|
||||||
PasswordTextField {
|
PasswordTextField {
|
||||||
id: passwordTextField
|
id: passwordTextField
|
||||||
@ -194,6 +200,14 @@ SettingsPageBase {
|
|||||||
delegate: NymeaItemDelegate {
|
delegate: NymeaItemDelegate {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: model.name
|
text: model.name
|
||||||
|
iconName: "account"
|
||||||
|
progressive: false
|
||||||
|
additionalItem: ColorIcon {
|
||||||
|
name: "delete"
|
||||||
|
color: Style.foregroundColor
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var popup = removeUserPopup.createObject(app, {username: model.name});
|
var popup = removeUserPopup.createObject(app, {username: model.name});
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|||||||
Reference in New Issue
Block a user