Skip to content

Commit f592c17

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 <[email protected]>
1 parent d67a855 commit f592c17

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/gui/tray/UserLine.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ MenuItem {
220220
MenuItem {
221221
id: removeAccountButton
222222
width: parent.width
223-
text: qsTr("Remove account")
223+
text: model.removeAccountText
224224
font.pixelSize: Style.topLinePixelSize
225225
palette.windowText: Style.ncTextColor
226226
hoverEnabled: true

src/gui/tray/usermodel.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,11 @@ bool User::canLogout() const
632632
return !_account->account()->isPublicShareLink();
633633
}
634634

635+
bool User::isPublicShareLink() const
636+
{
637+
return _account->account()->isPublicShareLink();
638+
}
639+
635640
void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
636641
{
637642
auto folderInstance = FolderMan::instance()->folder(folder);
@@ -1100,6 +1105,9 @@ QVariant UserModel::data(const QModelIndex &index, int role) const
11001105
case CanLogoutRole:
11011106
result = _users[index.row()]->canLogout();
11021107
break;
1108+
case RemoveAccountTextRole:
1109+
result = _users[index.row()]->isPublicShareLink() ? tr("Leave share") : tr("Remove account");
1110+
break;
11031111
}
11041112

11051113
return result;
@@ -1112,6 +1120,7 @@ QHash<int, QByteArray> UserModel::roleNames() const
11121120
roles[ServerRole] = "server";
11131121
roles[ServerHasUserStatusRole] = "serverHasUserStatus";
11141122
roles[CanLogoutRole] = "canLogout";
1123+
roles[RemoveAccountTextRole] = "removeAccountText";
11151124
roles[StatusIconRole] = "statusIcon";
11161125
roles[StatusEmojiRole] = "statusEmoji";
11171126
roles[StatusMessageRole] = "statusMessage";

src/gui/tray/usermodel.h

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class User : public QObject
7575
QString statusEmoji() const;
7676
void processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr &item);
7777
bool canLogout() const;
78+
bool isPublicShareLink() const;
7879

7980
signals:
8081
void nameChanged();
@@ -182,6 +183,7 @@ class UserModel : public QAbstractListModel
182183
ServerRole,
183184
ServerHasUserStatusRole,
184185
CanLogoutRole,
186+
RemoveAccountTextRole,
185187
StatusIconRole,
186188
StatusEmojiRole,
187189
StatusMessageRole,

0 commit comments

Comments
 (0)