Disable some account settings while offline

This commit is contained in:
miruka 2020-07-10 13:04:40 -04:00
parent e34bfd48a7
commit 9caaf41eae
2 changed files with 11 additions and 6 deletions

View File

@ -115,9 +115,11 @@ HFlickableColumnPage {
(
(! avatar.mxc && ! avatar.changed) ||
avatar.hovered ||
! ready
! ready ||
account.presence === "offline"
) ?
1 : 0
1 :
0
color: utils.hsluv(
0, 0, 0, (! avatar.mxc && overlayHover.hovered) ? 0.8 : 0.7,
@ -130,7 +132,7 @@ HFlickableColumnPage {
MouseArea {
anchors.fill: parent
enabled: ready
enabled: ready && account.presence !== "offline"
acceptedButtons: Qt.NoButton
cursorShape:
overlayHover.hovered ?
@ -154,7 +156,7 @@ HFlickableColumnPage {
anchors.centerIn: parent
spacing: currentSpacing
width: parent.width
opacity: ready ? 1 : 0
opacity: ready && account.presence !== "offline" ? 1 : 0
visible: opacity > 0
Behavior on opacity { HNumberAnimation {} }
@ -219,7 +221,7 @@ HFlickableColumnPage {
HTextField {
width: parent.width
enabled: ready
enabled: ready && account.presence !== "offline"
defaultText: ready ? account.display_name : ""
maximumLength: 255

View File

@ -3,6 +3,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../.."
import "../../Base"
import "../../Base/ButtonLayout"
import "../../PythonBridge"
@ -10,6 +11,7 @@ import "../../ShortcutBundles"
HColumnPage {
id: page
enabled: ModelStore.get("accounts").find(userId).presence !== "offline"
contentHeight: Math.min(
window.height,
Math.max(
@ -40,7 +42,8 @@ HColumnPage {
loadFuture = null
deviceList.sectionItemCounts = getSectionItemCounts()
if (! deviceList.currentItem) deviceList.currentIndex = 0
if (page.enabled && ! deviceList.currentItem)
deviceList.currentIndex = 0
})
}