Fixed the issue with single item context menus.

This commit is contained in:
Burak Kaan Köse
2025-11-12 18:52:15 +01:00
parent c277893145
commit 8482171bf2
+13 -2
View File
@@ -177,7 +177,15 @@ public sealed partial class MailListPage : MailListPageAbstract,
if (sender is MailItemDisplayInformationControl control && args.TryGetPosition(sender, out Point p))
{
var targetItems = ViewModel.MailCollection.SelectedItems;
IEnumerable<MailItemViewModel> targetItems;
if (!ViewModel.MailCollection.SelectedItems.Contains(control.ActionItem))
{
// Right clicked item is not selected. Select.
await WinoClickItemInternalAsync(control.ActionItem, true);
}
// Default to all selected items.
targetItems = ViewModel.MailCollection.SelectedItems;
var availableActions = ViewModel.GetAvailableMailActions(targetItems);
if (!availableActions?.Any() ?? false) return;
@@ -575,10 +583,13 @@ public sealed partial class MailListPage : MailListPageAbstract,
// Helper local to collapse all other threads (we always collapse ALL then possibly re-expand the active thread per rules)
async Task CollapseAllThreadsExceptAsync(ThreadMailItemViewModel? except)
{
bool wasExpanded = except != null && except.IsThreadExpanded;
await ViewModel.MailCollection.CollapseAllThreadsAsync();
if (except != null)
if (except != null && wasExpanded)
{
// We'll expand explicitly when required by logic below.
except.IsThreadExpanded = true;
}
}