Commit 7500f9a1 authored by Kempe's avatar Kempe
Browse files

[FEATURE] Check if station favorite when needed

parent 8451508b
......@@ -11,25 +11,27 @@ ContextMenu {
signal removeFavorite(var station)
signal addFavorite(int id)
property bool isFavorite: FavoritesUtils.isRadIoFavorite(id);
MenuItem {
id: removeFavoritMenuItem
text: qsTr("Remove from favorite")
visible: isFavorite
onClicked: {
remorseAction(qsTr("Deleting"), function() {
removeFavorite(FavoritesUtils.getFavoriteByRadioId(id))
isFavorite = false
});
}
}
MenuItem {
id: addFavoritMenuItem
text: qsTr("Add to favorite")
visible: !isFavorite
onClicked: {
addFavorite(id)
isFavorite = true
}
}
onActiveChanged: {
var isFavorit = FavoritesUtils.isRadIoFavorite(id)
removeFavoritMenuItem.visible = isFavorit
addFavoritMenuItem.visible = !isFavorit
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment