Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85648429
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/contents/ui/device-mgmt/Device.qml b/src/contents/ui/device-mgmt/Device.qml
index 777d2e2..6a79247 100644
--- a/src/contents/ui/device-mgmt/Device.qml
+++ b/src/contents/ui/device-mgmt/Device.qml
@@ -1,162 +1,154 @@
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import QtQuick 2.2
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import org.kde.kirigami 2.13 as Kirigami
Kirigami.SwipeListItem {
id: device
property var item
property var userId
RowLayout {
ColumnLayout {
- id: deviceIdColumn
- children: {
- let c = [
- Qt.createQmlObject('import QtQuick.Controls 2.15; Label { objectName: "deviceIdLabel"; text: item.deviceId }',
- deviceIdColumn, null)
- ]
- if (item.displayName != '' && item.displayName != undefined) {
- c.append(
- Qt.createQmlObject('import QtQuick.Controls 2.15; Label { objectName: "displayNameLabel"; text: item.displayName; font.pixelSize: Kirigami.Units.gridUnit * 0.5 }',
- deviceIdColumn, null)
- )
- }
- return c;
+ Label {
+ objectName: 'deviceIdLabel'
+ text: item.deviceId
+ }
+ Label {
+ objectName: 'displayNameLabel'
+ text: item.displayName
+ font.pixelSize: Kirigami.Units.gridUnit * 0.5
}
-
Layout.fillWidth: true
}
RowLayout {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
- Layout.rightMargin: Kirigami.Units.largeSpacing
Kirigami.Icon {
source: device.getTrustLevelIcon(item.trustLevel)
- Layout.preferredHeight: trustLevelLabel.height
- Layout.preferredWidth: trustLevelLabel.height
+ Layout.preferredHeight: Kirigami.Units.iconSizes.medium
+ Layout.preferredWidth: Kirigami.Units.iconSizes.medium
Accessible.ignored: true
}
Label {
- id: trustLevelLabel
objectName: 'trustLevelLabel'
text: l10n.get(`device-trust-level-${item.trustLevel}`)
}
}
}
property var sheet: Kirigami.OverlaySheet {
id: popup
title: l10n.get('device-set-trust-level-dialog-title')
property var setTrustLevelPromise: null
property var conn: Connections {
target: popup.setTrustLevelPromise
function onResolved(success, data) {
if (!success) {
console.log('Error setting trust level:', JSON.stringify(data));
}
popup.setTrustLevelPromise = null;
popup.close();
}
}
ColumnLayout {
Label {
text: l10n.get('device-set-trust-level-dialog-name-label', { name: item.displayName })
}
Label {
text: l10n.get('device-set-trust-level-dialog-id-label', { id: item.deviceId })
}
Label {
text: l10n.get('device-set-trust-level-dialog-ed25519-key-label', { key: item.ed25519Key })
}
Label {
text: l10n.get('device-set-trust-level-dialog-curve25519-key-label', { key: item.curve25519Key })
}
ButtonGroup {
buttons: trustLevelChoices.children
}
ColumnLayout {
id: trustLevelChoices
objectName: 'trustLevelChoices'
Layout.fillHeight: true
Repeater {
model: ['blocked', 'unseen', 'seen', 'verified']
delegate: RadioButton {
objectName: 'trustLevelChoice_' + modelData
property var level: modelData
autoExclusive: true
checked: item.trustLevel === modelData
text: l10n.get(`device-trust-level-${modelData}`)
icon.name: device.getTrustLevelIcon(modelData)
}
}
}
RowLayout {
Button {
text: l10n.get('device-set-trust-level-dialog-save')
onClicked: {
const current = popup.getNewTrustLevel();
popup.setTrustLevelPromise = matrixSdk.setDeviceTrustLevel(userId, item.deviceId, current);
}
}
Button {
text: l10n.get('device-set-trust-level-dialog-cancel')
onClicked: {
popup.close();
}
}
}
}
function getNewTrustLevel() {
for (let i = 0; i < trustLevelChoices.children.length; ++i) {
const curItem = trustLevelChoices.children[i];
if (curItem.checked) {
return curItem.level;
}
}
return 'unknown';
}
}
actions: [
Kirigami.Action {
text: l10n.get('device-set-trust-level')
iconName: 'settings-configure'
onTriggered: {
popup.open();
}
}
]
function getTrustLevelIcon(level)
{
switch (level) {
case 'blocked':
return 'emblem-error';
case 'unseen':
return 'emblem-warning';
case 'seen':
return 'emblem-added';
case 'verified':
return 'emblem-checked';
default:
return 'emblem-question';
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Aug 28, 11:30 AM (58 m, 32 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1736375
Default Alt Text
(4 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment