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

View File

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