2019-09-09 15:12:58 +03:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQuick.Controls.Material 2.2
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
2019-10-29 11:52:47 +03:00
|
|
|
Flickable {
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
id: settingsPanel
|
|
|
|
objectName: 'settingsView'
|
|
|
|
contentWidth: app.width
|
|
|
|
contentHeight: content.implicitHeight
|
|
|
|
|
2019-10-29 11:52:47 +03:00
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
|
|
width: 8
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
hoverEnabled: true
|
|
|
|
z: 2
|
|
|
|
}
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
Keys.onEscapePressed: navigator.home()
|
|
|
|
|
|
|
|
function getDeviceLabel(device) {
|
2019-10-31 15:34:04 +03:00
|
|
|
if (!!device) {
|
2019-09-09 15:12:58 +03:00
|
|
|
return ("%1").arg(device.name)
|
2019-10-31 15:34:04 +03:00
|
|
|
} else {
|
|
|
|
return qsTr("Insert your YubiKey")
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-31 15:34:04 +03:00
|
|
|
function getDeviceDescription(device) {
|
|
|
|
if (!!device) {
|
|
|
|
return qsTr("Serial number: %1").arg(!!device.serial ? device.serial : "Not Available")
|
2019-09-09 15:12:58 +03:00
|
|
|
} else if (yubiKey.availableDevices.length > 0
|
|
|
|
&& !yubiKey.availableDevices.some(dev => dev.selectable)) {
|
2019-09-09 17:59:30 +03:00
|
|
|
return qsTr("No compatible device found")
|
2019-09-09 15:12:58 +03:00
|
|
|
} else {
|
2019-09-09 17:59:30 +03:00
|
|
|
return qsTr("No device found")
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearPasswordFields() {
|
|
|
|
currentPasswordField.text = ""
|
|
|
|
newPasswordField.text = ""
|
|
|
|
confirmPasswordField.text = ""
|
|
|
|
}
|
|
|
|
|
|
|
|
function submitPassword() {
|
|
|
|
if (acceptableInput()) {
|
|
|
|
if (!!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword) {
|
|
|
|
changePassword()
|
|
|
|
} else {
|
|
|
|
setPassword()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function acceptableInput() {
|
|
|
|
if (!!yubiKey.currentDevice && yubiKey.currentDeviceValidated) {
|
|
|
|
if (!!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword
|
|
|
|
&& currentPasswordField.text.length == 0) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (newPasswordField.text.length > 0
|
|
|
|
&& (newPasswordField.text === confirmPasswordField.text)) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
function changePassword() {
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToLoading()
|
2019-09-09 15:12:58 +03:00
|
|
|
yubiKey.validate(currentPasswordField.text, false, function (resp) {
|
|
|
|
if (resp.success) {
|
|
|
|
setPassword()
|
|
|
|
} else {
|
|
|
|
navigator.snackBarError(getErrorMessage(resp.error_id))
|
|
|
|
console.log("change password failed:", resp.error_id)
|
|
|
|
}
|
|
|
|
clearPasswordFields()
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToSettings()
|
2019-09-09 15:12:58 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPassword() {
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToLoading()
|
2019-09-09 15:12:58 +03:00
|
|
|
yubiKey.setPassword(newPasswordField.text, false, function (resp) {
|
|
|
|
if (resp.success) {
|
2019-09-09 17:59:30 +03:00
|
|
|
navigator.snackBar(qsTr("Password set"))
|
2019-09-09 15:12:58 +03:00
|
|
|
yubiKey.currentDevice.hasPassword = true
|
|
|
|
passwordManagementPanel.isExpanded = false
|
|
|
|
} else {
|
|
|
|
navigator.snackBarError(getErrorMessage(resp.error_id))
|
|
|
|
console.log("set password failed:", resp.error_id)
|
|
|
|
}
|
|
|
|
clearPasswordFields()
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToSettings()
|
2019-09-09 15:12:58 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function removePassword() {
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToLoading()
|
2019-09-09 15:12:58 +03:00
|
|
|
yubiKey.validate(currentPasswordField.text, false, function (resp) {
|
|
|
|
if (resp.success) {
|
|
|
|
yubiKey.removePassword(function (resp) {
|
|
|
|
if (resp.success) {
|
2019-09-09 17:59:30 +03:00
|
|
|
navigator.snackBar(qsTr("Password removed"))
|
2019-09-09 15:12:58 +03:00
|
|
|
yubiKey.currentDevice.hasPassword = false
|
|
|
|
passwordManagementPanel.isExpanded = false
|
|
|
|
} else {
|
|
|
|
navigator.snackBarError(getErrorMessage(resp.error_id))
|
|
|
|
console.log("remove password failed:", resp.error_id)
|
|
|
|
}
|
|
|
|
clearPasswordFields()
|
2019-09-10 16:31:16 +03:00
|
|
|
navigator.goToSettings()
|
2019-09-09 15:12:58 +03:00
|
|
|
})
|
|
|
|
} else {
|
|
|
|
navigator.snackBarError(getErrorMessage(resp.error_id))
|
|
|
|
console.log("remove password failed:", resp.error_id)
|
|
|
|
}
|
2019-09-10 16:31:16 +03:00
|
|
|
|
2019-09-09 15:12:58 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-09-09 17:59:30 +03:00
|
|
|
property string title: qsTr("Settings")
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: themes
|
|
|
|
|
|
|
|
ListElement {
|
2019-11-27 16:44:27 +03:00
|
|
|
text: qsTr("System default")
|
2019-09-09 15:12:58 +03:00
|
|
|
value: Material.System
|
|
|
|
}
|
|
|
|
ListElement {
|
2019-11-27 16:44:27 +03:00
|
|
|
text: qsTr("Light mode")
|
2019-09-09 15:12:58 +03:00
|
|
|
value: Material.Light
|
|
|
|
}
|
|
|
|
ListElement {
|
2019-11-27 16:44:27 +03:00
|
|
|
text: qsTr("Dark mode")
|
2019-09-09 15:12:58 +03:00
|
|
|
value: Material.Dark
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: otpModeDigits
|
|
|
|
|
|
|
|
ListElement {
|
|
|
|
text: "Off"
|
|
|
|
value: 0
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
text: "6"
|
|
|
|
value: 6
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
text: "7"
|
|
|
|
value: 7
|
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
text: "8"
|
|
|
|
value: 8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: content
|
|
|
|
anchors.fill: parent
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
StyledExpansionContainer {
|
|
|
|
id: keyPane
|
2019-09-09 17:59:30 +03:00
|
|
|
sectionTitle: qsTr("Device")
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
StyledExpansionPanel {
|
|
|
|
id: currentDevicePanel
|
2019-10-31 15:34:04 +03:00
|
|
|
label: getDeviceLabel(yubiKey.currentDevice)
|
|
|
|
description: getDeviceDescription(yubiKey.currentDevice)
|
2019-09-09 15:12:58 +03:00
|
|
|
keyImage: !!yubiKey.currentDevice ? yubiKey.getCurrentDeviceImage() : "../images/yubikeys-large-transparent"
|
|
|
|
isTopPanel: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
isEnabled: yubiKey.availableDevices.length > 1
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
id: deviceButtonGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: yubiKey.availableDevices
|
2020-01-28 12:53:17 +03:00
|
|
|
onModelChanged: {
|
|
|
|
if (yubiKey.availableDevices.length < 2) {
|
|
|
|
currentDevicePanel.isExpanded = false
|
|
|
|
}
|
|
|
|
}
|
2019-10-31 15:34:04 +03:00
|
|
|
StyledRadioButton {
|
2019-09-09 15:12:58 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
objectName: index
|
|
|
|
checked: !!yubiKey.currentDevice
|
|
|
|
&& modelData.serial === yubiKey.currentDevice.serial
|
|
|
|
text: getDeviceLabel(modelData)
|
2019-10-31 15:34:04 +03:00
|
|
|
description: getDeviceDescription(modelData)
|
2019-09-09 15:12:58 +03:00
|
|
|
enabled: modelData.selectable
|
2019-10-31 15:34:04 +03:00
|
|
|
buttonGroup: deviceButtonGroup
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledButton {
|
|
|
|
id: selectBtn
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
|
|
|
|
text: "Select"
|
|
|
|
enabled: {
|
|
|
|
if (!!yubiKey.availableDevices && !!deviceButtonGroup.checkedButton) {
|
|
|
|
var dev = yubiKey.availableDevices[deviceButtonGroup.checkedButton.objectName]
|
|
|
|
return dev !== yubiKey.currentDevice
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
yubiKey.refreshDevicesDefault()
|
|
|
|
var dev = yubiKey.availableDevices[deviceButtonGroup.checkedButton.objectName]
|
|
|
|
yubiKey.selectCurrentSerial(dev.serial,
|
|
|
|
function (resp) {
|
|
|
|
if (resp.success) {
|
|
|
|
entries.clear()
|
|
|
|
yubiKey.currentDevice = dev
|
|
|
|
currentDevicePanel.expandAction()
|
|
|
|
yubiKey.calculateAll()
|
|
|
|
} else {
|
|
|
|
console.log("select device failed", resp.error_id)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledExpansionPanel {
|
|
|
|
id: passwordManagementPanel
|
2019-11-27 16:44:27 +03:00
|
|
|
label: !!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword ? qsTr("Change password") : qsTr("Set password")
|
2019-10-02 14:59:32 +03:00
|
|
|
description: qsTr("For additional security the YubiKey may be protected with a password.")
|
2019-09-09 15:12:58 +03:00
|
|
|
visible: !!yubiKey.currentDevice && !settings.otpMode
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
|
|
|
StyledTextField {
|
|
|
|
id: currentPasswordField
|
|
|
|
visible: !!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword
|
2019-11-27 16:44:27 +03:00
|
|
|
labelText: qsTr("Current password")
|
2019-09-09 15:12:58 +03:00
|
|
|
echoMode: TextInput.Password
|
|
|
|
Keys.onEnterPressed: submitPassword()
|
|
|
|
Keys.onReturnPressed: submitPassword()
|
|
|
|
onSubmit: submitPassword()
|
|
|
|
}
|
|
|
|
StyledTextField {
|
|
|
|
id: newPasswordField
|
2019-11-27 16:44:27 +03:00
|
|
|
labelText: qsTr("New password")
|
2019-09-09 15:12:58 +03:00
|
|
|
echoMode: TextInput.Password
|
|
|
|
Keys.onEnterPressed: submitPassword()
|
|
|
|
Keys.onReturnPressed: submitPassword()
|
|
|
|
onSubmit: submitPassword()
|
|
|
|
}
|
|
|
|
StyledTextField {
|
|
|
|
id: confirmPasswordField
|
2019-11-27 16:44:27 +03:00
|
|
|
labelText: qsTr("Confirm password")
|
2019-09-09 15:12:58 +03:00
|
|
|
echoMode: TextInput.Password
|
|
|
|
Keys.onEnterPressed: submitPassword()
|
|
|
|
Keys.onReturnPressed: submitPassword()
|
|
|
|
onSubmit: submitPassword()
|
|
|
|
}
|
|
|
|
RowLayout {
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
StyledButton {
|
|
|
|
id: removePasswordBtn
|
|
|
|
visible: !!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword
|
|
|
|
enabled: currentPasswordField.text.length > 0
|
|
|
|
text: "Remove"
|
|
|
|
flat: true
|
2019-11-05 18:43:17 +03:00
|
|
|
onClicked: navigator.confirm({
|
|
|
|
"heading": qsTr("Remove password?"),
|
2020-01-14 17:13:35 +03:00
|
|
|
"description": qsTr("A password will not be required to access the accounts anymore."),
|
2019-11-27 16:44:27 +03:00
|
|
|
"warning": false,
|
2019-11-05 18:43:17 +03:00
|
|
|
"acceptedCb": function () {
|
|
|
|
removePassword()
|
|
|
|
}
|
|
|
|
})
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
StyledButton {
|
|
|
|
id: applyPassword
|
|
|
|
text: !!yubiKey.currentDevice && yubiKey.currentDevice.hasPassword ? "Change" : "Set"
|
|
|
|
enabled: acceptableInput()
|
|
|
|
onClicked: submitPassword()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledExpansionPanel {
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Reset")
|
2019-10-31 15:34:04 +03:00
|
|
|
description: qsTr("Warning: Reset will delete all accounts and restore factory defaults.")
|
2019-09-09 15:12:58 +03:00
|
|
|
isEnabled: false
|
|
|
|
visible: !!yubiKey.currentDevice && !settings.otpMode
|
|
|
|
toolButtonIcon: "../images/reset.svg"
|
2019-10-31 15:34:04 +03:00
|
|
|
toolButtonToolTip: qsTr("Reset device")
|
2019-11-05 18:43:17 +03:00
|
|
|
toolButton.onClicked: navigator.confirm({
|
|
|
|
"heading": qsTr("Reset device?"),
|
|
|
|
"message": qsTr("This will delete all accounts and restore factory defaults of your YubiKey."),
|
|
|
|
"description": qsTr("There is NO going back from here, if you do not know what you are doing, do NOT do this."),
|
|
|
|
"acceptedCb": function () {
|
|
|
|
navigator.goToLoading()
|
|
|
|
yubiKey.reset(function (resp) {
|
|
|
|
if (resp.success) {
|
|
|
|
entries.clear()
|
|
|
|
navigator.snackBar(
|
|
|
|
qsTr("Reset completed"))
|
|
|
|
yubiKey.currentDeviceValidated = true
|
|
|
|
yubiKey.currentDevice.hasPassword = false
|
|
|
|
|
|
|
|
} else {
|
|
|
|
navigator.snackBarError(
|
|
|
|
navigator.getErrorMessage(
|
|
|
|
resp.error_id))
|
|
|
|
console.log("reset failed:",
|
|
|
|
resp.error_id)
|
|
|
|
}
|
|
|
|
navigator.goToSettings()
|
|
|
|
})
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
2020-01-14 18:48:26 +03:00
|
|
|
})
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
2020-01-14 18:48:26 +03:00
|
|
|
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledExpansionContainer {
|
|
|
|
id: appPane
|
2019-09-09 17:59:30 +03:00
|
|
|
sectionTitle: qsTr("Application")
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
StyledExpansionPanel {
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Appearance")
|
2019-10-31 15:34:04 +03:00
|
|
|
description: qsTr("Change the visual appearance of the application.")
|
2019-09-09 15:12:58 +03:00
|
|
|
isTopPanel: true
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
StyledComboBox {
|
|
|
|
id: themeComboBox
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Theme")
|
2019-09-09 15:12:58 +03:00
|
|
|
comboBox.textRole: "text"
|
|
|
|
model: themes
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
settings.theme = themes.get(currentIndex).value
|
|
|
|
}
|
|
|
|
currentIndex: {
|
|
|
|
switch (settings.theme) {
|
|
|
|
case Material.System:
|
|
|
|
return 0
|
|
|
|
case Material.Light:
|
|
|
|
return 1
|
|
|
|
case Material.Dark:
|
|
|
|
return 2
|
|
|
|
default:
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledExpansionPanel {
|
|
|
|
id: interfacePanel
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Interface")
|
2019-10-08 15:56:42 +03:00
|
|
|
description: qsTr("Configure how to communicate with the YubiKey.")
|
2019-09-09 15:12:58 +03:00
|
|
|
property bool otpModeSelected: interfaceCombobox.currentIndex === 2
|
|
|
|
property bool customReaderSelected: interfaceCombobox.currentIndex === 1
|
|
|
|
property bool aboutToChange: (otpModeSelected !== settings.otpMode)
|
|
|
|
|| (slot1DigitsComboBox.currentIndex
|
|
|
|
!== getComboBoxIndex(
|
|
|
|
settings.slot1digits))
|
|
|
|
|| (slot2DigitsComboBox.currentIndex
|
|
|
|
!== getComboBoxIndex(
|
|
|
|
settings.slot2digits))
|
|
|
|
|| customReaderSelected !== settings.useCustomReader
|
|
|
|
|| readerFilter.text !== settings.customReaderName && readerFilter.text.length > 0
|
|
|
|
|
|
|
|
function isValidMode() {
|
|
|
|
return aboutToChange
|
|
|
|
&& ((otpModeSelected
|
|
|
|
&& (slot1DigitsComboBox.currentIndex !== 0
|
|
|
|
|| slot2DigitsComboBox.currentIndex !== 0))
|
|
|
|
|| !otpModeSelected)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setInterface() {
|
|
|
|
settings.slot1digits = otpModeDigits.get(
|
|
|
|
slot1DigitsComboBox.currentIndex).value
|
|
|
|
settings.slot2digits = otpModeDigits.get(
|
|
|
|
slot2DigitsComboBox.currentIndex).value
|
|
|
|
settings.otpMode = otpModeSelected
|
|
|
|
settings.useCustomReader = customReaderSelected
|
|
|
|
settings.customReaderName = readerFilter.text
|
|
|
|
yubiKey.clearCurrentDeviceAndEntries()
|
|
|
|
yubiKey.refreshDevicesDefault()
|
|
|
|
navigator.goToSettings()
|
2019-09-09 17:59:30 +03:00
|
|
|
navigator.snackBar(qsTr("Interface changed"))
|
2019-09-09 15:12:58 +03:00
|
|
|
interfacePanel.isExpanded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
function getComboBoxIndex(digits) {
|
|
|
|
switch (digits) {
|
|
|
|
case 0:
|
|
|
|
return 0
|
|
|
|
case 6:
|
|
|
|
return 1
|
|
|
|
case 7:
|
|
|
|
return 2
|
|
|
|
case 8:
|
|
|
|
return 3
|
|
|
|
default:
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
StyledComboBox {
|
|
|
|
id: interfaceCombobox
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Interface")
|
2019-11-27 16:44:27 +03:00
|
|
|
model: ["CCID (recommended)", "CCID with custom reader", "OTP"]
|
2019-09-09 15:12:58 +03:00
|
|
|
currentIndex: getCurrentIndex()
|
|
|
|
|
|
|
|
function getCurrentIndex() {
|
|
|
|
if (settings.otpMode) {
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
if (settings.useCustomReader && !settings.otpMode) {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
// default
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
visible: interfacePanel.otpModeSelected
|
|
|
|
Label {
|
|
|
|
Layout.fillWidth: true
|
2019-10-02 14:59:32 +03:00
|
|
|
font.pixelSize: 12
|
2019-11-27 16:44:27 +03:00
|
|
|
color: primaryColor
|
|
|
|
opacity: lowEmphasis
|
2019-10-02 14:59:32 +03:00
|
|
|
text: qsTr("Using OTP slots should be considered for special cases only.")
|
2019-09-09 15:12:58 +03:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Layout.rowSpan: 1
|
|
|
|
bottomPadding: 8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
visible: interfacePanel.otpModeSelected
|
|
|
|
|
|
|
|
StyledComboBox {
|
|
|
|
id: slot1DigitsComboBox
|
2019-11-27 16:44:27 +03:00
|
|
|
label: qsTr("Slot 1 digits")
|
2019-09-09 15:12:58 +03:00
|
|
|
comboBox.textRole: "text"
|
|
|
|
model: otpModeDigits
|
|
|
|
currentIndex: interfacePanel.getComboBoxIndex(
|
|
|
|
settings.slot1digits)
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
width: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledComboBox {
|
|
|
|
id: slot2DigitsComboBox
|
2019-11-27 16:44:27 +03:00
|
|
|
label: qsTr("Slot 2 digits")
|
2019-09-09 15:12:58 +03:00
|
|
|
comboBox.textRole: "text"
|
|
|
|
model: otpModeDigits
|
|
|
|
currentIndex: interfacePanel.getComboBoxIndex(
|
|
|
|
settings.slot2digits)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
visible: interfacePanel.customReaderSelected
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
visible: yubiKey.availableReaders.length > 0
|
|
|
|
StyledComboBox {
|
|
|
|
id: connectedReaders
|
|
|
|
enabled: yubiKey.availableReaders.length > 0
|
|
|
|
visible: yubiKey.availableReaders.length > 0
|
2019-09-09 17:59:30 +03:00
|
|
|
label: qsTr("Connected readers")
|
2019-09-09 15:12:58 +03:00
|
|
|
model: yubiKey.availableReaders
|
|
|
|
}
|
|
|
|
StyledButton {
|
2019-11-27 16:44:27 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
|
2019-09-09 17:59:30 +03:00
|
|
|
text: qsTr("Use as filter")
|
2019-09-09 15:12:58 +03:00
|
|
|
flat: true
|
|
|
|
enabled: yubiKey.availableReaders.length > 0
|
|
|
|
visible: yubiKey.availableReaders.length > 0
|
|
|
|
onClicked: readerFilter.text = connectedReaders.currentText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledTextField {
|
|
|
|
id: readerFilter
|
|
|
|
enabled: interfacePanel.customReaderSelected
|
|
|
|
visible: interfacePanel.customReaderSelected
|
|
|
|
labelText: qsTr("Custom reader filter")
|
|
|
|
text: settings.customReaderName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledButton {
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
text: "Apply"
|
|
|
|
enabled: interfacePanel.isValidMode()
|
|
|
|
onClicked: interfacePanel.setInterface()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledExpansionPanel {
|
2020-01-14 17:13:35 +03:00
|
|
|
label: Qt.platform.os === "osx" ? "Menu Bar" : "System Tray"
|
2019-09-09 17:59:30 +03:00
|
|
|
description: qsTr("Configure where and how the application is visible.")
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
CheckBox {
|
|
|
|
id: sysTrayCheckbox
|
|
|
|
checked: settings.closeToTray
|
2019-09-09 17:59:30 +03:00
|
|
|
text: Qt.platform.os === "osx" ? qsTr("Show in menu bar") : qsTr("Show in system tray")
|
2019-09-09 15:12:58 +03:00
|
|
|
padding: 0
|
|
|
|
indicator.width: 16
|
|
|
|
indicator.height: 16
|
|
|
|
onCheckStateChanged: {
|
|
|
|
if(!checked) {
|
|
|
|
hideOnLaunchCheckbox.checked = false
|
|
|
|
}
|
|
|
|
settings.closeToTray = checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: hideOnLaunchCheckbox
|
|
|
|
enabled: sysTrayCheckbox.checked
|
|
|
|
checked: settings.hideOnLaunch
|
2019-09-09 17:59:30 +03:00
|
|
|
text: qsTr("Hide on launch")
|
2019-09-09 15:12:58 +03:00
|
|
|
padding: 0
|
|
|
|
indicator.width: 16
|
|
|
|
indicator.height: 16
|
|
|
|
onCheckStateChanged: settings.hideOnLaunch = checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-14 18:48:26 +03:00
|
|
|
|
|
|
|
StyledExpansionPanel {
|
|
|
|
label: qsTr("Clear passwords")
|
2020-01-15 10:39:49 +03:00
|
|
|
description: qsTr("Delete all saved passwords.")
|
2020-01-14 18:48:26 +03:00
|
|
|
isEnabled: false
|
|
|
|
visible: true
|
2020-01-21 16:47:09 +03:00
|
|
|
isBottomPanel: true
|
2020-01-15 11:54:41 +03:00
|
|
|
toolButtonIcon: "../images/delete.svg"
|
2020-01-14 18:48:26 +03:00
|
|
|
toolButtonToolTip: qsTr("Clear")
|
|
|
|
toolButton.onClicked: navigator.confirm({
|
|
|
|
"heading": qsTr("Clear passwords?"),
|
2020-01-15 10:39:49 +03:00
|
|
|
"message": qsTr("This will delete all saved passwords."),
|
|
|
|
"description": qsTr("A password prompt will appear the next time a YubiKey with a password is used."),
|
2020-01-14 18:48:26 +03:00
|
|
|
"acceptedCb": function() {
|
|
|
|
yubiKey.clearLocalPasswords(function (resp) {
|
|
|
|
if (resp.success) {
|
|
|
|
navigator.snackBar(qsTr("Passwords cleared"))
|
|
|
|
}
|
|
|
|
})}
|
|
|
|
})
|
|
|
|
}
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|