2022-10-11 12:15:33 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
2022-08-16 09:19:15 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
2022-08-31 17:09:07 +00:00
|
|
|
import shared.popups.keycard 1.0
|
2022-08-16 09:19:15 +00:00
|
|
|
|
|
|
|
import "../stores"
|
2022-10-11 12:15:33 +00:00
|
|
|
import "./keycard"
|
2022-08-16 09:19:15 +00:00
|
|
|
|
|
|
|
SettingsContentBase {
|
|
|
|
id: root
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
property ProfileSectionStore profileSectionStore
|
2022-08-16 09:19:15 +00:00
|
|
|
property KeycardStore keycardStore
|
2022-10-11 12:15:33 +00:00
|
|
|
property string mainSectionTitle: ""
|
2022-08-16 09:19:15 +00:00
|
|
|
|
|
|
|
titleRowComponentLoader.sourceComponent: StatusButton {
|
|
|
|
text: qsTr("Get Keycard")
|
|
|
|
onClicked: {
|
2022-10-14 09:13:27 +00:00
|
|
|
Global.openLink(Constants.keycard.general.purchasePage)
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
function handleBackAction() {
|
|
|
|
if (stackLayout.currentIndex === d.detailsViewIndex) {
|
|
|
|
root.profileSectionStore.backButtonName = ""
|
|
|
|
root.sectionTitle = root.mainSectionTitle
|
|
|
|
stackLayout.currentIndex = d.mainViewIndex
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
2022-10-11 12:15:33 +00:00
|
|
|
}
|
2022-08-31 17:09:07 +00:00
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
StackLayout {
|
|
|
|
id: stackLayout
|
2022-08-16 09:19:15 +00:00
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
currentIndex: d.mainViewIndex
|
2022-08-16 09:19:15 +00:00
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property int mainViewIndex: 0
|
|
|
|
readonly property int detailsViewIndex: 1
|
2022-08-16 09:19:15 +00:00
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
property string observedKeycardUid: ""
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
MainView {
|
2022-08-16 09:19:15 +00:00
|
|
|
Layout.preferredWidth: root.contentWidth
|
2022-10-11 12:15:33 +00:00
|
|
|
keycardStore: root.keycardStore
|
|
|
|
|
|
|
|
onDisplayKeycardDetails: {
|
|
|
|
d.observedKeycardUid = keycardUid
|
|
|
|
root.profileSectionStore.backButtonName = root.mainSectionTitle
|
|
|
|
root.sectionTitle = keycardName
|
|
|
|
stackLayout.currentIndex = d.detailsViewIndex
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
DetailsView {
|
2022-08-16 09:19:15 +00:00
|
|
|
Layout.preferredWidth: root.contentWidth
|
2022-10-11 12:15:33 +00:00
|
|
|
keycardStore: root.keycardStore
|
|
|
|
keycardUid: d.observedKeycardUid
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
Connections {
|
|
|
|
target: root.keycardStore.keycardModule
|
2022-08-16 09:19:15 +00:00
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
onDisplayKeycardSharedModuleFlow: {
|
|
|
|
keycardPopup.active = true
|
|
|
|
}
|
|
|
|
onDestroyKeycardSharedModuleFlow: {
|
|
|
|
keycardPopup.active = false
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
onKeycardUidChanged: {
|
|
|
|
if (d.observedKeycardUid === oldKcUid) {
|
|
|
|
d.observedKeycardUid = newKcUid
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
Loader {
|
|
|
|
id: keycardPopup
|
|
|
|
active: false
|
|
|
|
sourceComponent: KeycardPopup {
|
|
|
|
sharedKeycardModule: root.keycardStore.keycardModule.keycardSharedModule
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 12:15:33 +00:00
|
|
|
onLoaded: {
|
|
|
|
keycardPopup.item.open()
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|