Skip to content

Commit 28d3936

Browse files
authored
Merge pull request #8045 from nextcloud/bugfix/header-colours
explicitly set colours for header items
2 parents b5c3b08 + 0f84c80 commit 28d3936

5 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/gui/tray/CurrentAccountHeaderButton.qml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ Button {
162162
id: currentAccountStatusIndicatorBackground
163163
visible: UserModel.currentUser && UserModel.currentUser.isConnected
164164
&& UserModel.currentUser.serverHasUserStatus
165+
&& UserModel.currentUser.status !== UserStatus.Invisible
166+
&& UserModel.currentUser.status !== UserStatus.Offline
165167
width: Style.accountAvatarStateIndicatorSize + + Style.trayFolderStatusIndicatorSizeOffset
166168
height: width
167-
color: root.parentBackgroundColor
169+
color: "white"
168170
anchors.bottom: currentAccountAvatar.bottom
169171
anchors.right: currentAccountAvatar.right
170172
radius: width * Style.trayFolderStatusIndicatorRadiusFactor
@@ -174,6 +176,8 @@ Button {
174176
id: currentAccountStatusIndicator
175177
visible: UserModel.currentUser && UserModel.currentUser.isConnected
176178
&& UserModel.currentUser.serverHasUserStatus
179+
&& UserModel.currentUser.status !== UserStatus.Invisible
180+
&& UserModel.currentUser.status !== UserStatus.Offline
177181
source: UserModel.currentUser ? UserModel.currentUser.statusIcon : ""
178182
cache: false
179183
x: currentAccountStatusIndicatorBackground.x + 1
@@ -198,6 +202,7 @@ Button {
198202
id: currentAccountUser
199203
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
200204
width: Style.currentAccountLabelWidth
205+
color: Style.currentUserHeaderTextColor
201206
text: UserModel.currentUser ? UserModel.currentUser.name : ""
202207
elide: Text.ElideRight
203208

@@ -209,6 +214,7 @@ Button {
209214
id: currentAccountServer
210215
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
211216
width: Style.currentAccountLabelWidth
217+
color: Style.currentUserHeaderTextColor
212218
text: UserModel.currentUser ? UserModel.currentUser.server : ""
213219
elide: Text.ElideRight
214220
visible: UserModel.numUsers() > 1
@@ -225,6 +231,7 @@ Button {
225231
id: emoji
226232
visible: UserModel.currentUser && UserModel.currentUser.statusEmoji !== ""
227233
width: Style.userStatusEmojiSize
234+
color: Style.currentUserHeaderTextColor
228235
text: UserModel.currentUser ? UserModel.currentUser.statusEmoji : ""
229236
}
230237
EnforcedPlainTextLabel {
@@ -233,6 +240,7 @@ Button {
233240
Layout.fillWidth: true
234241
visible: UserModel.currentUser && UserModel.currentUser.statusMessage !== ""
235242
width: Style.currentAccountLabelWidth
243+
color: Style.currentUserHeaderTextColor
236244
text: UserModel.currentUser && UserModel.currentUser.statusMessage !== ""
237245
? UserModel.currentUser.statusMessage
238246
: UserModel.currentUser ? UserModel.currentUser.server : ""

src/gui/tray/HeaderButton.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Button {
3232

3333
icon.width: Style.headerButtonIconSize
3434
icon.height: Style.headerButtonIconSize
35+
icon.color: "transparent"
3536

3637
Layout.alignment: Qt.AlignRight
3738
Layout.preferredWidth: Style.trayWindowHeaderHeight

src/gui/tray/UserLine.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ AbstractButton {
5050
visible: model.isConnected && model.serverHasUserStatus
5151
width: accountStatusIndicator.sourceSize.width + 2
5252
height: width
53+
color: "white"
5354
anchors.bottom: accountAvatar.bottom
5455
anchors.right: accountAvatar.right
55-
radius: width * Style.trayFolderStatusIndicatorRadiusFactor
56+
radius: width * Style.trayFolderStatusIndicatorRadiusFactor
5657
}
5758

5859
Image {

src/gui/tray/usermodel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,8 +1349,9 @@ void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent)
13491349
});
13501350

13511351
connect(u, &User::statusChanged, this, [this, row] {
1352-
emit dataChanged(index(row, 0), index(row, 0), {UserModel::StatusIconRole,
1353-
UserModel::StatusEmojiRole,
1352+
emit dataChanged(index(row, 0), index(row, 0), {UserModel::StatusRole,
1353+
UserModel::StatusIconRole,
1354+
UserModel::StatusEmojiRole,
13541355
UserModel::StatusMessageRole});
13551356
});
13561357

@@ -1542,6 +1543,8 @@ QVariant UserModel::data(const QModelIndex &index, int role) const
15421543
return _users[index.row()]->server();
15431544
} else if (role == ServerHasUserStatusRole) {
15441545
return _users[index.row()]->serverHasUserStatus();
1546+
} else if (role == StatusRole) {
1547+
return QVariant::fromValue(_users[index.row()]->status());
15451548
} else if (role == StatusIconRole) {
15461549
return _users[index.row()]->statusIcon();
15471550
} else if (role == StatusEmojiRole) {
@@ -1568,6 +1571,7 @@ QHash<int, QByteArray> UserModel::roleNames() const
15681571
roles[NameRole] = "name";
15691572
roles[ServerRole] = "server";
15701573
roles[ServerHasUserStatusRole] = "serverHasUserStatus";
1574+
roles[StatusRole] = "status";
15711575
roles[StatusIconRole] = "statusIcon";
15721576
roles[StatusEmojiRole] = "statusEmoji";
15731577
roles[StatusMessageRole] = "statusMessage";

src/gui/tray/usermodel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class User : public QObject
5151
Q_PROPERTY(QColor headerTextColor READ headerTextColor NOTIFY headerTextColorChanged)
5252
Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentColorChanged)
5353
Q_PROPERTY(bool serverHasUserStatus READ serverHasUserStatus CONSTANT)
54+
Q_PROPERTY(UserStatus::OnlineStatus status READ status NOTIFY statusChanged)
5455
Q_PROPERTY(QUrl statusIcon READ statusIcon NOTIFY statusChanged)
5556
Q_PROPERTY(QString statusEmoji READ statusEmoji NOTIFY statusChanged)
5657
Q_PROPERTY(QString statusMessage READ statusMessage NOTIFY statusChanged)
@@ -238,6 +239,7 @@ class UserModel : public QAbstractListModel
238239
NameRole = Qt::UserRole + 1,
239240
ServerRole,
240241
ServerHasUserStatusRole,
242+
StatusRole,
241243
StatusIconRole,
242244
StatusEmojiRole,
243245
StatusMessageRole,

0 commit comments

Comments
 (0)