From: Claudio Cambra Date: Thu, 16 Dec 2021 11:22:04 +0000 (+0100) Subject: Hide share button for deleted and ignored files in tray activity X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~17^2~231^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8c091a2daab9909e6a934345711d041d9dcb6e29;p=nextcloud-desktop.git Hide share button for deleted and ignored files in tray activity Signed-off-by: Claudio Cambra --- diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index ed85ed9ea..5928346cb 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -152,7 +152,7 @@ MouseArea { Layout.alignment: Qt.AlignRight flat: true hoverEnabled: true - visible: displayActions && (path !== "") + visible: isShareable display: AbstractButton.IconOnly icon.source: "qrc:///client/theme/share.svg" icon.color: "transparent" diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 3d126244d..770074d7d 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -68,6 +68,7 @@ QHash ActivityListModel::roleNames() const roles[ObjectTypeRole] = "objectType"; roles[PointInTimeRole] = "dateTime"; roles[DisplayActions] = "displayActions"; + roles[ShareableRole] = "isShareable"; return roles; } @@ -262,6 +263,8 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const return (ast && ast->isConnected()); case DisplayActions: return _displayActions; + case ShareableRole: + return !data(index, PathRole).toString().isEmpty() && _displayActions && a._fileAction != "file_deleted" && a._status != SyncFileItem::FileIgnored; default: return QVariant(); } diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index 379fc9ba8..89667d1dd 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -60,6 +60,7 @@ public: AccountConnectedRole, SyncFileStatusRole, DisplayActions, + ShareableRole, }; Q_ENUM(DataRole)