2022-10-11 12:15:33 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
2023-01-23 17:07:56 +00:00
|
|
|
import QtQml.Models 2.14
|
2022-08-16 09:19:15 +00:00
|
|
|
|
2023-01-23 17:07:56 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-08-16 09:19:15 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2023-01-26 11:52:01 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-08-16 09:19:15 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
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-12-16 09:37:08 +00:00
|
|
|
property var emojiPopup
|
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-12-09 19:43:36 +00:00
|
|
|
property string observedKeyUid: ""
|
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
|
|
|
|
|
2022-12-09 19:43:36 +00:00
|
|
|
onDisplayKeycardsForKeypair: {
|
|
|
|
root.keycardStore.keycardModule.prepareKeycardDetailsModel(keyUid)
|
|
|
|
d.observedKeyUid = keyUid
|
2022-10-11 12:15:33 +00:00
|
|
|
root.profileSectionStore.backButtonName = root.mainSectionTitle
|
2022-12-09 19:43:36 +00:00
|
|
|
root.sectionTitle = keypairName
|
2022-10-11 12:15:33 +00:00
|
|
|
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
|
2022-12-09 19:43:36 +00:00
|
|
|
keyUid: d.observedKeyUid
|
2023-02-21 08:25:02 +00:00
|
|
|
|
|
|
|
onChangeSectionTitle: {
|
|
|
|
root.sectionTitle = title
|
|
|
|
}
|
2023-07-07 08:54:23 +00:00
|
|
|
|
|
|
|
onDetailsModelIsEmpty: {
|
|
|
|
// if keypair is removed while user is in the details keycard view mode we need to go back to main keycard view
|
|
|
|
root.handleBackAction()
|
|
|
|
}
|
2022-08-16 09:19:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|