From f7e9e31bc90c41320d5e1a2fe40d99261c1b8e71 Mon Sep 17 00:00:00 2001 From: Camila Date: Mon, 26 Apr 2021 20:40:38 +0200 Subject: [PATCH] Rename isDesktopNotificationsAllowed property to desktopNotificationsAllowed. - User !== instead of !=. - Fix code style. Signed-off-by: Camila --- src/gui/tray/UserLine.qml | 8 ++++---- src/gui/tray/UserModel.cpp | 7 ++++--- src/gui/tray/UserModel.h | 2 +- src/gui/tray/Window.qml | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index 63ee2da75..b7d5edd77 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -93,7 +93,7 @@ MenuItem { sourceSize.height: Style.accountAvatarStateIndicatorSize Accessible.role: Accessible.Indicator - Accessible.name: model.isDesktopNotificationsAllowed ? qsTr("Current user status is online") : qsTr("Current user status is do not disturb") + Accessible.name: model.desktopNotificationsAllowed ? qsTr("Current user status is online") : qsTr("Current user status is do not disturb") } } @@ -113,9 +113,9 @@ MenuItem { } Label { id: userStatusMessage - visible: model.isConnected - && model.serverUserStatus - && statusMessage != "" + visible: model.isConnected && + model.serverUserStatus && + statusMessage !== "" width: 128 text: statusMessage elide: Text.ElideRight diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp index 840c2f19e..2eab7588a 100644 --- a/src/gui/tray/UserModel.cpp +++ b/src/gui/tray/UserModel.cpp @@ -57,7 +57,7 @@ User::User(AccountStatePtr &account, const bool &isCurrent, QObject *parent) connect(_account->account().data(), &Account::accountChangedAvatar, this, &User::avatarChanged); connect(_account.data(), &AccountState::statusChanged, this, &User::statusChanged); connect(_account.data(), &AccountState::desktopNotificationsAllowedChanged, this, &User::desktopNotificationsAllowedChanged); - + connect(_activityModel, &ActivityListModel::sendNotificationRequest, this, &User::slotSendNotificationRequest); } @@ -576,7 +576,8 @@ QUrl User::statusIcon() const return _account->statusIcon(); } -bool User::serverHasUserStatus() const { +bool User::serverHasUserStatus() const +{ return _account->account()->capabilities().userStatus(); } @@ -918,7 +919,7 @@ QHash UserModel::roleNames() const roles[ServerUserStatusRole] = "serverUserStatus"; roles[StatusIconRole] = "statusIcon"; roles[StatusMessageRole] = "statusMessage"; - roles[DesktopNotificationsAllowedRole] = "isDesktopNotificationsAllowed"; + roles[DesktopNotificationsAllowedRole] = "desktopNotificationsAllowed"; roles[AvatarRole] = "avatar"; roles[IsCurrentUserRole] = "isCurrentUser"; roles[IsConnectedRole] = "isConnected"; diff --git a/src/gui/tray/UserModel.h b/src/gui/tray/UserModel.h index 278d8c89e..d88f01030 100644 --- a/src/gui/tray/UserModel.h +++ b/src/gui/tray/UserModel.h @@ -24,7 +24,7 @@ class User : public QObject Q_PROPERTY(bool serverHasUserStatus READ serverHasUserStatus) Q_PROPERTY(QUrl statusIcon READ statusIcon NOTIFY statusChanged) Q_PROPERTY(QString statusMessage READ statusMessage NOTIFY statusChanged) - Q_PROPERTY(QString isDesktopNotificationsAllowed READ isDesktopNotificationsAllowed NOTIFY desktopNotificationsAllowedChanged) + Q_PROPERTY(QString desktopNotificationsAllowed READ isDesktopNotificationsAllowed NOTIFY desktopNotificationsAllowedChanged) Q_PROPERTY(bool hasLocalFolder READ hasLocalFolder NOTIFY hasLocalFolderChanged) Q_PROPERTY(bool serverHasTalk READ serverHasTalk NOTIFY serverHasTalkChanged) Q_PROPERTY(QString avatar READ avatarUrl NOTIFY avatarChanged) diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index df2aa83a1..b77b3762d 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -381,7 +381,7 @@ Window { sourceSize.height: Style.accountAvatarStateIndicatorSize Accessible.role: Accessible.Indicator - Accessible.name: UserModel.isDesktopNotificationsAllowed ? qsTr("Current user status is online") : qsTr("Current user status is do not disturb") + Accessible.name: UserModel.desktopNotificationsAllowed ? qsTr("Current user status is online") : qsTr("Current user status is do not disturb") } }