Skip to content

Commit b6d42ab

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 edd73ed commit b6d42ab

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
@@ -625,6 +625,11 @@ bool User::canLogout() const
625625
return !_account->account()->isPublicShareLink();
626626
}
627627

628+
bool User::isPublicShareLink() const
629+
{
630+
return _account->account()->isPublicShareLink();
631+
}
632+
628633
void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
629634
{
630635
auto folderInstance = FolderMan::instance()->folder(folder);
@@ -1093,6 +1098,9 @@ QVariant UserModel::data(const QModelIndex &index, int role) const
10931098
case CanLogoutRole:
10941099
result = _users[index.row()]->canLogout();
10951100
break;
1101+
case RemoveAccountTextRole:
1102+
result = _users[index.row()]->isPublicShareLink() ? tr("Leave share") : tr("Remove account");
1103+
break;
10961104
}
10971105

10981106
return result;
@@ -1105,6 +1113,7 @@ QHash<int, QByteArray> UserModel::roleNames() const
11051113
roles[ServerRole] = "server";
11061114
roles[ServerHasUserStatusRole] = "serverHasUserStatus";
11071115
roles[CanLogoutRole] = "canLogout";
1116+
roles[RemoveAccountTextRole] = "removeAccountText";
11081117
roles[StatusIconRole] = "statusIcon";
11091118
roles[StatusEmojiRole] = "statusEmoji";
11101119
roles[StatusMessageRole] = "statusMessage";

src/gui/tray/usermodel.h

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

8081
signals:
8182
void guiLog(const QString &, const QString &);
@@ -184,6 +185,7 @@ class UserModel : public QAbstractListModel
184185
ServerRole,
185186
ServerHasUserStatusRole,
186187
CanLogoutRole,
188+
RemoveAccountTextRole,
187189
StatusIconRole,
188190
StatusEmojiRole,
189191
StatusMessageRole,

0 commit comments

Comments
 (0)