Show a verified icon for verified devices rather than a verify option
This commit is contained in:
@@ -19,6 +19,15 @@ using namespace Quotient;
|
|||||||
DevicesModel::DevicesModel(QObject *parent)
|
DevicesModel::DevicesModel(QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
|
connect(m_connection, &Connection::sessionVerified, this, [this](const QString &, const QString &deviceId) {
|
||||||
|
const auto it = std::find_if(m_devices.begin(), m_devices.end(), [deviceId](const Quotient::Device &device) {
|
||||||
|
return device.deviceId == deviceId;
|
||||||
|
});
|
||||||
|
if (it != m_devices.end()) {
|
||||||
|
const auto index = this->index(it - m_devices.begin());
|
||||||
|
Q_EMIT dataChanged(index, index, {Type});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::fetchDevices()
|
void DevicesModel::fetchDevices()
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ FormCard.AbstractFormDelegate {
|
|||||||
required property string id
|
required property string id
|
||||||
required property string timestamp
|
required property string timestamp
|
||||||
required property string displayName
|
required property string displayName
|
||||||
|
required property int type
|
||||||
|
|
||||||
property bool editDeviceName: false
|
property bool editDeviceName: false
|
||||||
property bool showVerifyButton
|
property bool showVerifyButton
|
||||||
@@ -98,7 +99,7 @@ FormCard.AbstractFormDelegate {
|
|||||||
}
|
}
|
||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
visible: root.showVerifyButton
|
visible: root.showVerifyButton && root.type !== DevicesModel.Verified
|
||||||
action: Kirigami.Action {
|
action: Kirigami.Action {
|
||||||
id: verifyDeviceAction
|
id: verifyDeviceAction
|
||||||
text: i18n("Verify device")
|
text: i18n("Verify device")
|
||||||
@@ -112,6 +113,21 @@ FormCard.AbstractFormDelegate {
|
|||||||
delay: Kirigami.Units.toolTipDelay
|
delay: Kirigami.Units.toolTipDelay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Kirigami.Icon {
|
||||||
|
visible: root.showVerifyButton && root.type === DevicesModel.Verified
|
||||||
|
implicitWidth: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
implicitHeight: Kirigami.Units.iconSizes.smallMedium
|
||||||
|
source: "security-high"
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: verifyHover
|
||||||
|
}
|
||||||
|
QQC2.ToolTip {
|
||||||
|
text: i18nc("This device is verified", "Verified")
|
||||||
|
delay: Kirigami.Units.toolTipDelay
|
||||||
|
visible: verifyHover.hovered
|
||||||
|
}
|
||||||
|
}
|
||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
action: Kirigami.Action {
|
action: Kirigami.Action {
|
||||||
|
|||||||
Reference in New Issue
Block a user