Skip to content

Commit b670f80

Browse files
committed
show leave share menu item to delete an account for public shared folder
to delete a normal acount show "Remove account" to delete a public share link account show "Leave share" Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent afcd2b6 commit b670f80

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/gui/tray/UserLine.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ MenuItem {
218218
MenuItem {
219219
id: removeAccountButton
220220
width: parent.width
221-
text: qsTr("Remove account")
221+
text: model.removeAccountText
222222
font.pixelSize: Style.topLinePixelSize
223223
hoverEnabled: true
224224
onClicked: {

src/gui/tray/usermodel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,11 @@ bool User::canLogout() const
556556
return !_account->account()->isPublicShareLink();
557557
}
558558

559+
bool User::isPublicShareLink() const
560+
{
561+
return _account->account()->isPublicShareLink();
562+
}
563+
559564
void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
560565
{
561566
auto folderInstance = FolderMan::instance()->folder(folder);
@@ -1000,6 +1005,9 @@ QVariant UserModel::data(const QModelIndex &index, int role) const
10001005
case CanLogoutRole:
10011006
result = _users[index.row()]->canLogout();
10021007
break;
1008+
case RemoveAccountTextRole:
1009+
result = _users[index.row()]->isPublicShareLink() ? tr("Leave share") : tr("Remove account");
1010+
break;
10031011
}
10041012

10051013
return result;
@@ -1012,6 +1020,7 @@ QHash<int, QByteArray> UserModel::roleNames() const
10121020
roles[ServerRole] = "server";
10131021
roles[ServerHasUserStatusRole] = "serverHasUserStatus";
10141022
roles[CanLogoutRole] = "canLogout";
1023+
roles[RemoveAccountTextRole] = "removeAccountText";
10151024
roles[StatusIconRole] = "statusIcon";
10161025
roles[StatusEmojiRole] = "statusEmoji";
10171026
roles[StatusMessageRole] = "statusMessage";

src/gui/tray/usermodel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class User : public QObject
6969
QString statusEmoji() const;
7070
void processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr &item);
7171
bool canLogout() const;
72+
bool isPublicShareLink() const;
7273

7374
signals:
7475
void guiLog(const QString &, const QString &);
@@ -169,6 +170,7 @@ class UserModel : public QAbstractListModel
169170
ServerRole,
170171
ServerHasUserStatusRole,
171172
CanLogoutRole,
173+
RemoveAccountTextRole,
172174
StatusIconRole,
173175
StatusEmojiRole,
174176
StatusMessageRole,

0 commit comments

Comments
 (0)