Rename isDesktopNotificationsAllowed property to desktopNotificationsAllowed.

- User !== instead of !=.
- Fix code style.

Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
Camila 2021-04-26 20:40:38 +02:00 committed by Camila (Rebase PR Action)
parent 820e97cd9b
commit f7e9e31bc9
4 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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<int, QByteArray> 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";

View file

@ -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)

View file

@ -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")
}
}