2022-10-11 12:15:33 +00:00
|
|
|
|
import QtQuick 2.14
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
2024-08-05 13:44:32 +00:00
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-10-11 12:15:33 +00:00
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
import shared.controls 1.0
|
|
|
|
|
import shared.status 1.0
|
|
|
|
|
import shared.popups.keycard.helpers 1.0
|
|
|
|
|
|
|
|
|
|
import "../../stores"
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
property KeycardStore keycardStore
|
|
|
|
|
|
2022-12-09 19:43:36 +00:00
|
|
|
|
signal displayKeycardsForKeypair(string keyUid, string keypairName)
|
2022-10-11 12:15:33 +00:00
|
|
|
|
|
|
|
|
|
spacing: Constants.settingsSection.itemSpacing
|
|
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
|
|
|
|
|
readonly property bool noKeycardsSet: root.keycardStore.keycardModule.keycardModel.count === 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
visible: d.noKeycardsSet
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2023-01-18 11:53:38 +00:00
|
|
|
|
Layout.preferredHeight: 240
|
|
|
|
|
Layout.preferredWidth: 350
|
2022-10-11 12:15:33 +00:00
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
|
antialiasing: true
|
2023-01-18 11:53:38 +00:00
|
|
|
|
source: Style.png("keycard/keycard-security")
|
2022-10-11 12:15:33 +00:00
|
|
|
|
mipmap: true
|
2023-04-26 15:33:24 +00:00
|
|
|
|
cache: false
|
2022-10-11 12:15:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
visible: d.noKeycardsSet
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: Style.current.halfPadding
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
visible: d.noKeycardsSet
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
|
font.pixelSize: Constants.settingsSection.importantInfoFontSize
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("Secure your funds. Keep your profile safe.")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
visible: d.noKeycardsSet
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: Style.current.halfPadding
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
|
visible: !d.noKeycardsSet
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
|
text: qsTr("Your Keycard(s)")
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 19:43:36 +00:00
|
|
|
|
StatusListView {
|
2022-10-11 12:15:33 +00:00
|
|
|
|
visible: !d.noKeycardsSet
|
|
|
|
|
Layout.fillWidth: true
|
2022-12-09 19:43:36 +00:00
|
|
|
|
Layout.preferredHeight: 250
|
2022-10-11 12:15:33 +00:00
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
model: root.keycardStore.keycardModule.keycardModel
|
|
|
|
|
|
|
|
|
|
delegate: KeycardItem {
|
|
|
|
|
width: ListView.view.width
|
|
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
|
keycardName: model.keycard.name
|
|
|
|
|
keycardLocked: model.keycard.locked
|
|
|
|
|
keyPairType: model.keycard.pairType
|
|
|
|
|
keyPairIcon: model.keycard.icon
|
|
|
|
|
keyPairImage: model.keycard.image
|
|
|
|
|
keyPairAccounts: model.keycard.accounts
|
2022-10-11 12:15:33 +00:00
|
|
|
|
|
|
|
|
|
onKeycardSelected: {
|
2022-12-16 09:37:08 +00:00
|
|
|
|
root.displayKeycardsForKeypair(model.keycard.keyUid, model.keycard.name)
|
2022-10-11 12:15:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: d.noKeycardsSet? qsTr("Setup a new Keycard with an existing account")
|
|
|
|
|
: qsTr("Migrate an existing account from Status Desktop to Keycard")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "setupFromExistingKeycardAccount"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
2023-08-25 09:05:05 +00:00
|
|
|
|
root.keycardStore.runSetupKeycardPopup("")
|
2022-10-11 12:15:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
|
text: qsTr("Create, import or restore a Keycard account")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
2022-12-16 09:37:08 +00:00
|
|
|
|
title: qsTr("Create a new Keycard account with a new seed phrase")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "createNewKeycardAccount"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
2024-08-05 13:44:32 +00:00
|
|
|
|
if (root.keycardStore.remainingKeypairCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (root.keycardStore.remainingAccountCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent, {accountsWarning: true})
|
|
|
|
|
return
|
|
|
|
|
}
|
2022-12-16 09:37:08 +00:00
|
|
|
|
root.keycardStore.runCreateNewKeycardWithNewSeedPhrasePopup()
|
2022-10-11 12:15:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Import or restore via a seed phrase")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "importRestoreKeycard"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
2024-08-05 13:44:32 +00:00
|
|
|
|
if (root.keycardStore.remainingKeypairCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (root.keycardStore.remainingAccountCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent, {accountsWarning: true})
|
|
|
|
|
return
|
|
|
|
|
}
|
2022-10-11 12:15:33 +00:00
|
|
|
|
root.keycardStore.runImportOrRestoreViaSeedPhrasePopup()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Import from Keycard to Status Desktop")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "importFromKeycard"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
2024-08-05 13:44:32 +00:00
|
|
|
|
if (root.keycardStore.remainingKeypairCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (root.keycardStore.remainingAccountCapacity() === 0) {
|
|
|
|
|
Global.openPopup(limitWarningComponent, {accountsWarning: true})
|
|
|
|
|
return
|
|
|
|
|
}
|
2022-10-11 12:15:33 +00:00
|
|
|
|
root.keycardStore.runImportFromKeycardToAppPopup()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusSectionHeadline {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
|
Layout.rightMargin: Style.current.padding
|
|
|
|
|
text: qsTr("Other")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Check what’s on a Keycard")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "checkWhatsNewKeycard"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.keycardStore.runDisplayKeycardContentPopup()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Factory reset a Keycard")
|
2023-09-13 05:54:44 +00:00
|
|
|
|
objectName: "factoryResetKeycard"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
components: [
|
|
|
|
|
StatusIcon {
|
2023-04-25 10:32:57 +00:00
|
|
|
|
icon: "next"
|
2022-10-11 12:15:33 +00:00
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.keycardStore.runFactoryResetPopup()
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-05 13:44:32 +00:00
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: limitWarningComponent
|
|
|
|
|
|
|
|
|
|
StatusDialog {
|
|
|
|
|
id: dialog
|
|
|
|
|
|
|
|
|
|
property bool accountsWarning: false
|
|
|
|
|
|
|
|
|
|
title: dialog.accountsWarning? Constants.walletConstants.maxNumberOfAccountsTitle : Constants.walletConstants.maxNumberOfKeypairsTitle
|
|
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: dialog.accountsWarning? Constants.walletConstants.maxNumberOfAccountsContent : Constants.walletConstants.maxNumberOfKeypairsContent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
standardButtons: Dialog.Ok
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-11 12:15:33 +00:00
|
|
|
|
}
|