diff --git a/src/gui/tray/UserLine.qml b/src/gui/tray/UserLine.qml index a6e781d439689..ffcf1be8a71b1 100644 --- a/src/gui/tray/UserLine.qml +++ b/src/gui/tray/UserLine.qml @@ -220,7 +220,7 @@ MenuItem { MenuItem { id: removeAccountButton width: parent.width - text: qsTr("Remove account") + text: model.removeAccountText font.pixelSize: Style.topLinePixelSize palette.windowText: Style.ncTextColor hoverEnabled: true diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index ed46a7c700c2c..af92586aaae42 100644 --- a/src/gui/tray/usermodel.cpp +++ b/src/gui/tray/usermodel.cpp @@ -625,6 +625,11 @@ bool User::canLogout() const return !_account->account()->isPublicShareLink(); } +bool User::isPublicShareLink() const +{ + return _account->account()->isPublicShareLink(); +} + void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item) { auto folderInstance = FolderMan::instance()->folder(folder); @@ -1093,6 +1098,9 @@ QVariant UserModel::data(const QModelIndex &index, int role) const case CanLogoutRole: result = _users[index.row()]->canLogout(); break; + case RemoveAccountTextRole: + result = _users[index.row()]->isPublicShareLink() ? tr("Leave share") : tr("Remove account"); + break; } return result; @@ -1105,6 +1113,7 @@ QHash UserModel::roleNames() const roles[ServerRole] = "server"; roles[ServerHasUserStatusRole] = "serverHasUserStatus"; roles[CanLogoutRole] = "canLogout"; + roles[RemoveAccountTextRole] = "removeAccountText"; roles[StatusIconRole] = "statusIcon"; roles[StatusEmojiRole] = "statusEmoji"; roles[StatusMessageRole] = "statusMessage"; diff --git a/src/gui/tray/usermodel.h b/src/gui/tray/usermodel.h index 779af633ae110..14c4fd0e9da82 100644 --- a/src/gui/tray/usermodel.h +++ b/src/gui/tray/usermodel.h @@ -76,6 +76,7 @@ class User : public QObject QString statusEmoji() const; void processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr &item); bool canLogout() const; + bool isPublicShareLink() const; signals: void guiLog(const QString &, const QString &); @@ -184,6 +185,7 @@ class UserModel : public QAbstractListModel ServerRole, ServerHasUserStatusRole, CanLogoutRole, + RemoveAccountTextRole, StatusIconRole, StatusEmojiRole, StatusMessageRole,