Fix/improve Security page offline account handling

This commit is contained in:
miruka 2020-09-20 16:01:02 -04:00
parent 755d954948
commit 38da930a99
3 changed files with 36 additions and 19 deletions

View File

@ -4,6 +4,12 @@
- PCN error handling
- Change docs linking to dev branch back to master
- Implement fallback QML notifications, usable if dbus isn't available
- annoying tooltips when menu open
- profiles missing in notifications
- add http_proxy support
- Encrypted rooms don't show invites in member list after Mirage restart
- Room display name not updated when someone removes theirs
- Fix right margin of own `<image url>\n<image url>` messages

View File

@ -12,6 +12,7 @@ HTile {
property HListView view
property string userId
property bool offline: false
signal verified()
signal blacklisted()
@ -84,6 +85,7 @@ HTile {
label.horizontalAlignment: Qt.AlignHCenter
HRowLayout {
enabled: ! deviceTile.offline
width: parent.width
HTextField {
@ -166,6 +168,7 @@ HTile {
NegativeButton {
text: qsTr("Sign out")
enabled: ! deviceTile.offline
icon.name: "device-delete"
onClicked: deviceTile.deleteRequest()
}

View File

@ -19,6 +19,9 @@ HColumnPage {
property Future loadFuture: null
readonly property QtObject account: ModelStore.get("accounts").find(userId)
readonly property bool offline: ! account || account.presence === "offline"
function takeFocus() {
deviceList.headerItem.exportButton.forceActiveFocus()
}
@ -88,8 +91,12 @@ HColumnPage {
return counts
}
function focusListController(top=true) {
deviceList.currentIndex = top ? 0 : deviceList.count - 1
listController.forceActiveFocus()
}
enabled: ModelStore.get("accounts").find(userId).presence !== "offline"
contentHeight: Math.min(
window.height,
Math.max(
@ -114,6 +121,7 @@ HColumnPage {
header: HColumnLayout {
readonly property alias exportButton: exportButton
readonly property alias importButton: importButton
readonly property alias signOutCheckedButton: signOutCheckedButton
spacing: theme.spacing
@ -160,13 +168,11 @@ HColumnPage {
}
)
Keys.onBacktabPressed: {
deviceList.currentIndex = deviceList.count - 1
listController.forceActiveFocus()
}
Keys.onBacktabPressed: page.focusListController(false)
}
GroupButton {
id: importButton
text: qsTr("Import")
icon.name: "import-keys"
@ -176,6 +182,11 @@ HColumnPage {
{ userId: page.userId },
obj => { obj.dialog.open() }
)
Keys.onTabPressed:
signOutCheckedButton.enabled ?
refreshButton.forceActiveFocus() :
page.focusListController()
}
}
@ -199,6 +210,8 @@ HColumnPage {
}
AutoDirectionLayout {
enabled: ! page.offline
GroupButton {
id: refreshButton
text: qsTr("Refresh")
@ -222,10 +235,7 @@ HColumnPage {
...utils.range(1, deviceList.count - 1),
)
Keys.onTabPressed: {
deviceList.currentIndex = 0
listController.forceActiveFocus()
}
Keys.onTabPressed: page.focusListController()
}
}
}
@ -234,6 +244,7 @@ HColumnPage {
width: deviceList.width
view: deviceList
userId: page.userId
offline: page.offline
onVerified: page.loadDevices()
onBlacklisted: page.loadDevices()
onRenameRequest: name => page.renameDevice(model.index, name)
@ -257,15 +268,8 @@ HColumnPage {
Keys.onReturnPressed: Keys.onEnterPressed(event)
Keys.onMenuPressed: Keys.onEnterPressed(event)
Keys.onUpPressed: {
deviceList.currentIndex = deviceList.count - 1
listController.forceActiveFocus()
}
Keys.onDownPressed: {
deviceList.currentIndex = 0
listController.forceActiveFocus()
}
Keys.onUpPressed: page.focusListController(false)
Keys.onDownPressed: page.focusListController()
Item {
id: listController
@ -273,7 +277,11 @@ HColumnPage {
Keys.onBacktabPressed: {
if (parent.currentIndex === 0) {
parent.currentIndex = -1
parent.headerItem.signOutCheckedButton.forceActiveFocus()
parent.headerItem.signOutCheckedButton.enabled ?
parent.headerItem.signOutCheckedButton.forceActiveFocus() :
parent.headerItem.importButton.forceActiveFocus()
return
}
parent.decrementCurrentIndex()