Hide share button for deleted and ignored files in tray activity

Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
This commit is contained in:
Claudio Cambra 2021-12-16 12:22:04 +01:00 committed by Claudio Cambra (Rebase PR Action)
parent fc366933e4
commit 8c091a2daa
3 changed files with 5 additions and 1 deletions

View file

@ -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"

View file

@ -68,6 +68,7 @@ QHash<int, QByteArray> 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();
}

View file

@ -60,6 +60,7 @@ public:
AccountConnectedRole,
SyncFileStatusRole,
DisplayActions,
ShareableRole,
};
Q_ENUM(DataRole)