Auto mark as read fix and del keyboard accelerator.
This commit is contained in:
@@ -326,16 +326,16 @@ public partial class MailListPageViewModel : MailBaseViewModel,
|
|||||||
|
|
||||||
if (markAsPreference == MailMarkAsOption.WhenSelected)
|
if (markAsPreference == MailMarkAsOption.WhenSelected)
|
||||||
{
|
{
|
||||||
//var operation = MailOperation.MarkAsRead;
|
var operation = MailOperation.MarkAsRead;
|
||||||
//var package = new MailOperationPreperationRequest(operation, _activeMailItem.MailCopy);
|
var package = new MailOperationPreperationRequest(operation, _activeMailItem.MailCopy);
|
||||||
|
|
||||||
//if (ActiveFolder?.SpecialFolderType == SpecialFolderType.Unread &&
|
if (ActiveFolder?.SpecialFolderType == SpecialFolderType.Unread &&
|
||||||
// !gmailUnreadFolderMarkedAsReadUniqueIds.Contains(_activeMailItem.UniqueId))
|
!gmailUnreadFolderMarkedAsReadUniqueIds.Contains(_activeMailItem.UniqueId))
|
||||||
//{
|
{
|
||||||
// gmailUnreadFolderMarkedAsReadUniqueIds.Add(_activeMailItem.UniqueId);
|
gmailUnreadFolderMarkedAsReadUniqueIds.Add(_activeMailItem.UniqueId);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//await ExecuteMailOperationAsync(package);
|
await ExecuteMailOperationAsync(package);
|
||||||
}
|
}
|
||||||
else if (markAsPreference == MailMarkAsOption.AfterDelay && PreferencesService.MarkAsDelay >= 0)
|
else if (markAsPreference == MailMarkAsOption.AfterDelay && PreferencesService.MarkAsDelay >= 0)
|
||||||
{
|
{
|
||||||
@@ -582,6 +582,7 @@ public partial class MailListPageViewModel : MailBaseViewModel,
|
|||||||
public void RemoveFirst()
|
public void RemoveFirst()
|
||||||
{
|
{
|
||||||
var fi = MailCollection.GetFirst();
|
var fi = MailCollection.GetFirst();
|
||||||
|
if (fi == null) return;
|
||||||
|
|
||||||
Messenger.Send(new MailRemovedMessage(fi.MailCopy));
|
Messenger.Send(new MailRemovedMessage(fi.MailCopy));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Microsoft.UI.Xaml.Navigation;
|
|||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.System;
|
using Windows.System;
|
||||||
|
using Wino.Controls;
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
@@ -163,33 +164,26 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
args.IsContainerPrepared = false;
|
args.IsContainerPrepared = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
|
private async void MailItemContextRequested(UIElement sender, ContextRequestedEventArgs args)
|
||||||
{
|
{
|
||||||
// TODO: New ItemsView implementation.
|
|
||||||
|
|
||||||
// Context is requested from a single mail point, but we might have multiple selected items.
|
// Context is requested from a single mail point, but we might have multiple selected items.
|
||||||
// This menu should be calculated based on all selected items by providers.
|
// This menu should be calculated based on all selected items by providers.
|
||||||
|
|
||||||
//if (sender is MailItemDisplayInformationControl control && args.TryGetPosition(sender, out Point p))
|
if (sender is MailItemDisplayInformationControl control && args.TryGetPosition(sender, out Point p))
|
||||||
//{
|
{
|
||||||
// if (control.DataContext is MailItemViewModel clickedMailItemContext)
|
var targetItems = ViewModel.MailCollection.SelectedItems;
|
||||||
// {
|
var availableActions = ViewModel.GetAvailableMailActions(targetItems);
|
||||||
// var targetItems = ViewModel.MailCollection.AllItems.Where(a => a.IsSelected);
|
|
||||||
// var availableActions = ViewModel.GetAvailableMailActions(targetItems);
|
|
||||||
|
|
||||||
// if (!availableActions?.Any() ?? false) return;
|
if (!availableActions?.Any() ?? false) return;
|
||||||
|
|
||||||
// var clickedOperation = await GetMailOperationFromFlyoutAsync(availableActions, control, p.X, p.Y);
|
var clickedOperation = await GetMailOperationFromFlyoutAsync(availableActions, control, p.X, p.Y);
|
||||||
|
|
||||||
// if (clickedOperation == null) return;
|
if (clickedOperation == null) return;
|
||||||
|
|
||||||
// var prepRequest = new MailOperationPreperationRequest(clickedOperation.Operation, targetItems.Select(a => a.MailCopy));
|
var prepRequest = new MailOperationPreperationRequest(clickedOperation.Operation, targetItems.Select(a => a.MailCopy));
|
||||||
|
|
||||||
// await ViewModel.ExecuteMailOperationAsync(prepRequest);
|
await ViewModel.ExecuteMailOperationAsync(prepRequest);
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<MailOperationMenuItem> GetMailOperationFromFlyoutAsync(IEnumerable<MailOperationMenuItem> availableActions,
|
private async Task<MailOperationMenuItem> GetMailOperationFromFlyoutAsync(IEnumerable<MailOperationMenuItem> availableActions,
|
||||||
@@ -210,9 +204,9 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
return await source.Task;
|
return await source.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRecipient<ClearMailSelectionsRequested>.Receive(ClearMailSelectionsRequested message)
|
async void IRecipient<ClearMailSelectionsRequested>.Receive(ClearMailSelectionsRequested message)
|
||||||
{
|
{
|
||||||
// MailListView.ClearSelections(null, preserveThreadExpanding: true);
|
await ViewModel.MailCollection.UnselectAllAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRecipient<ActiveMailItemChangedEvent>.Receive(ActiveMailItemChangedEvent message)
|
void IRecipient<ActiveMailItemChangedEvent>.Receive(ActiveMailItemChangedEvent message)
|
||||||
@@ -465,6 +459,7 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
public void Receive(DisposeRenderingFrameRequested message)
|
public void Receive(DisposeRenderingFrameRequested message)
|
||||||
{
|
{
|
||||||
ViewModel.NavigationService.Navigate(WinoPage.IdlePage, null, NavigationReferenceFrame.RenderingFrame, NavigationTransitionType.DrillIn);
|
ViewModel.NavigationService.Navigate(WinoPage.IdlePage, null, NavigationReferenceFrame.RenderingFrame, NavigationTransitionType.DrillIn);
|
||||||
|
UpdateAdaptiveness();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void RegisterRecipients()
|
protected override void RegisterRecipients()
|
||||||
@@ -525,8 +520,7 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteAllInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
|
||||||
=> ViewModel.ExecuteMailOperationCommand.Execute(MailOperation.SoftDelete);
|
|
||||||
|
|
||||||
private void WinoMailCollectionSelectionChanged(object? sender, EventArgs args)
|
private void WinoMailCollectionSelectionChanged(object? sender, EventArgs args)
|
||||||
{
|
{
|
||||||
@@ -536,14 +530,14 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
|
|
||||||
private async void WinoListViewProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args)
|
private async void WinoListViewProcessKeyboardAccelerators(UIElement sender, ProcessKeyboardAcceleratorEventArgs args)
|
||||||
{
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
|
||||||
if (args.Key == VirtualKey.Delete)
|
if (args.Key == VirtualKey.Delete)
|
||||||
{
|
{
|
||||||
|
ViewModel.ExecuteMailOperationCommand.Execute(MailOperation.SoftDelete);
|
||||||
}
|
}
|
||||||
else
|
else if (args.Key == VirtualKey.A && args.Modifiers.HasFlag(VirtualKeyModifiers.Control))
|
||||||
{
|
{
|
||||||
args.Handled = true;
|
|
||||||
|
|
||||||
await ViewModel.MailCollection.ToggleSelectAllAsync();
|
await ViewModel.MailCollection.ToggleSelectAllAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -627,6 +621,14 @@ public sealed partial class MailListPage : MailListPageAbstract,
|
|||||||
{
|
{
|
||||||
// No Ctrl pressed, toggle expansion state (default behavior)
|
// No Ctrl pressed, toggle expansion state (default behavior)
|
||||||
threadMailItemViewModel.IsThreadExpanded = !threadMailItemViewModel.IsThreadExpanded;
|
threadMailItemViewModel.IsThreadExpanded = !threadMailItemViewModel.IsThreadExpanded;
|
||||||
|
|
||||||
|
// Select the first item in the thread if none is selected
|
||||||
|
if (!threadMailItemViewModel.IsSelected)
|
||||||
|
{
|
||||||
|
threadMailItemViewModel.IsSelected = true;
|
||||||
|
var firstEmail = threadMailItemViewModel.ThreadEmails.FirstOrDefault();
|
||||||
|
firstEmail?.IsSelected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user