1/*
2 * \copyright Copyright (c) 2019-2021 Governikus GmbH & Co. KG, Germany
3 */
4
5import QtQuick 2.12
6import QtQuick.Controls 2.12
7import QtQuick.Layouts 1.12
8
9import Governikus.Global 1.0
10import Governikus.Style 1.0
11import Governikus.TitleBar 1.0
12import Governikus.View 1.0
13import Governikus.Type.ApplicationModel 1.0
14import Governikus.Type.NumberModel 1.0
15
16
17SectionPage {
18	id: root
19
20	signal close()
21
22	property int passwordType: NumberModel.passwordType
23	property alias rootEnabled: titleBarAction.rootEnabled
24
25	Accessible.name: qsTr("Password information")
26	Accessible.description: qsTr("This is the password information section of the AusweisApp2.")
27	Keys.onReturnPressed: close()
28	Keys.onEnterPressed: close()
29	Keys.onEscapePressed: close()
30
31	titleBarAction: TitleBarAction {
32		id: titleBarAction
33
34		rootEnabled: ApplicationModel.currentWorkflow === ""
35		showSettings: false
36		text: headline.text
37		showHelp: false
38	}
39
40	GText {
41		id: headline
42
43		anchors.top: parent.top
44		anchors.left: parent.left
45		anchors.right: parent.right
46		anchors.margins: Constants.pane_padding
47
48		activeFocusOnTab: true
49		Accessible.name: headline.text
50
51		wrapMode: Text.WordWrap
52		//: LABEL DESKTOP_QML
53		text: passwordType === NumberModel.PASSWORD_CAN ? qsTr("CAN information")
54			 //: LABEL DESKTOP_QML
55		     : passwordType === NumberModel.PASSWORD_PUK ? qsTr("PUK information")
56			 //: LABEL DESKTOP_QML
57		     : passwordType === NumberModel.PASSWORD_REMOTE_PIN ? qsTr("Smartphone as card reader information")
58			 //: LABEL DESKTOP_QML
59			 : qsTr("PIN information")
60		textStyle: Style.text.header_inverse
61		FocusFrame {}
62	}
63
64	GText {
65		anchors.top: headline.bottom
66		anchors.left: parent.left
67		anchors.right: infoImage.left
68		anchors.margins: Constants.pane_padding
69
70		activeFocusOnTab: true
71
72		text: {
73			if (passwordType === NumberModel.PASSWORD_CAN && NumberModel.isCanAllowedMode) {
74				//: INFO DESKTOP_QML Description text of CAN-allowed authentication
75				return qsTr("The Card Access Number (CAN) allows to access the imprinted data of the ID card. In order to allow on-site reading of the personal data the service provider needs to acquire governmental authorization to do so. On-site reading is usually employed to automatically fill forms and prevent spelling mistakes when transfering the personal data.")
76			}
77			if (passwordType === NumberModel.PASSWORD_CAN && !NumberModel.isCanAllowedMode) {
78				//: INFO DESKTOP_QML Description text of CAN if required for third PIN attempt
79				return qsTr("The Card Access Number (CAN) is required if the PIN has already been entered incorrectly twice. In order to prevent a third incorrect entry and thus the blocking of the PIN without your consent, the CAN is also requested at this point. The CAN is a six-digit number that can be found on the front of the ID card. It is located at the bottom right next to the validity date (marked in red).")
80			}
81			if (passwordType === NumberModel.PASSWORD_PUK) {
82				//: INFO DESKTOP_QML Description text of PUK
83				return qsTr("The Personal Unblocking Key (PUK) is required if the PIN has been entered three times. At this point the PIN is blocked. The PUK is a ten-digit number you received with the letter sent to you by your competent authority (marked in red). Please note that you can only use the PUK to unblock the PIN entry. If you have forgotten your PIN, you can have a new PIN set at your competent authority.")
84			}
85			if (passwordType === NumberModel.PASSWORD_REMOTE_PIN) {
86				//: INFO DESKTOP_QML Description text of SaC pairing
87				return qsTr("You may use your smartphone as a card reader with AusweisApp2. The smartphone needs to feature a supported NFC chipset and both devices, your smartphone and this machine, need to be connected to the same WiFi network.<br><br>To use your smartphone as a card reader you'll always need to activate the remote service in the AusweisApp2 on the smartphone. For the first time you'll also need to start the pairing mode on your smartphone, select the device from the list of available devices on this machine and then enter the pairing code shown on the phone.")
88			}
89
90			//: INFO DESKTOP_QML Description text of PIN
91			return qsTr("The Personal Identification Number (PIN) is chosen by you and is required for every use of the online eID function. You can change it anytime and indefinitely if you know your valid PIN. For your six-digit PIN choose a combination of numbers, that is not easy to guess, neither \"123456\" nor your birth date, or any other numbers printed on the ID card. If you are no longer aware of your valid PIN, you will need to contact your responsible authority to renew your PIN.<br><br>When changing the PIN for the first time, please use the five-digit Transport PIN. You will find the Transport PIN in the letter you received from your responsible authority (marked in red) after you have applied for your identity card.<br><br>Please note that you can not use the online eID function with the five-digit Transport PIN. A change to a six-digit PIN is mandatory.")
92		}
93		textStyle: Style.text.header_inverse
94		horizontalAlignment: Text.AlignJustify
95
96		FocusFrame {}
97	}
98
99	PasswordInfoImage {
100		id: infoImage
101
102		anchors.top: headline.bottom
103		anchors.right: parent.right
104		anchors.margins: Constants.pane_padding
105
106		passwordType: root.passwordType
107		scaleFactorGeneral: 2.75 * ApplicationModel.scaleFactor
108		scaleFactorCan: 2 * ApplicationModel.scaleFactor
109		textStyle: Style.text.normal_inverse
110	}
111
112	NavigationButton {
113		id: button
114
115		anchors {
116			margins: Constants.component_spacing
117			bottom: parent.bottom
118			horizontalCenter: parent.horizontalCenter
119		}
120
121		buttonType: NavigationButton.Type.Back
122		onClicked: root.close()
123	}
124}
125