yubioath-flutter/qml/NoLoadedDeviceMessage.qml
Dag Heyman c3aafb33d3
bugfix: wrong mode messages was never shown
because device.enabled variable have been renamed
2018-12-11 08:51:56 +01:00

36 lines
1.2 KiB
QML

import QtQuick 2.5
import QtQuick.Controls 1.4
Label {
property var device
property var settings
property bool ccidMode: !settings.slotMode
visible: !device.hasDevice
text: getText()
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
function getText() {
if (device.nDevices === 0) {
return qsTr("No YubiKey detected.")
} else if (device.nDevices === 1) {
if (settings.slotMode && device.enabledUsbInterfaces
&& !device.hasOTP) {
return qsTr("Authenticator mode is set to YubiKey slots, but the OTP connection mode is not enabled.")
} else if (ccidMode && device.enabledUsbInterfaces
&& !device.hasCCID) {
return qsTr("Authenticator mode is set to CCID, but the CCID connection mode is not enabled.")
} else {
return qsTr("Connecting to YubiKey...")
}
} else if (device.nDevices > 1) {
return qsTr("Multiple YubiKeys detected!")
}
}
}