View message source (#541)
* Added view message source * Change condition to when button available
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
DarkEditor,
|
||||
LightEditor,
|
||||
Print,
|
||||
ViewMessageSource,
|
||||
DiscardLocalDraft,
|
||||
Navigate // For toast activation
|
||||
}
|
||||
|
||||
@@ -45,5 +45,9 @@ namespace Wino.Core.Domain.Interfaces
|
||||
/// <returns>Created alias model if not canceled.</returns>
|
||||
Task<ICreateAccountAliasDialog> ShowCreateAccountAliasDialogAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Presents a dialog to the user to show email source.
|
||||
/// </summary>
|
||||
Task ShowMessageSourceDialogAsync(string messageSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,6 +366,7 @@
|
||||
"MailOperation_SetFlag": "Set flag",
|
||||
"MailOperation_Unarchive": "Unarchive",
|
||||
"MailOperation_Zoom": "Zoom",
|
||||
"MailOperation_ViewMessageSource": "View message source",
|
||||
"MailsSelected": "{0} item(s) selected",
|
||||
"MarkFlagUnflag": "Mark as flagged/unflagged",
|
||||
"MarkReadUnread": "Mark as read/unread",
|
||||
@@ -382,6 +383,7 @@
|
||||
"NewAccountDialog_AccountNameDefaultValue": "Personal",
|
||||
"NewAccountDialog_AccountNamePlaceholder": "eg. Personal Mail",
|
||||
"NewAccountDialog_Title": "Add New Account",
|
||||
"MessageSourceDialog_Title": "Message source",
|
||||
"NoMailSelected": "No message selected",
|
||||
"NoMessageCrieteria": "No messages match your search criteria",
|
||||
"NoMessageEmptyFolder": "This folder is empty",
|
||||
|
||||
Binary file not shown.
@@ -98,6 +98,7 @@ namespace Wino.Core.UWP.Controls
|
||||
{ WinoIconGlyph.EventRespond, "\uE924" },
|
||||
{ WinoIconGlyph.EventReminder, "\uE923" },
|
||||
{ WinoIconGlyph.EventJoinOnline, "\uE926" },
|
||||
{ WinoIconGlyph.ViewMessageSource, "\uE943" }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Wino.Core.UWP.Controls
|
||||
EventReminder,
|
||||
EventEditSeries,
|
||||
EventJoinOnline,
|
||||
ViewMessageSource,
|
||||
}
|
||||
|
||||
public class WinoFontIcon : FontIcon
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace Wino.Helpers
|
||||
MailOperation.Forward => WinoIconGlyph.Forward,
|
||||
MailOperation.DarkEditor => WinoIconGlyph.DarkEditor,
|
||||
MailOperation.LightEditor => WinoIconGlyph.LightEditor,
|
||||
MailOperation.ViewMessageSource => WinoIconGlyph.ViewMessageSource,
|
||||
_ => WinoIconGlyph.None,
|
||||
};
|
||||
}
|
||||
@@ -321,6 +322,7 @@ namespace Wino.Helpers
|
||||
MailOperation.DarkEditor => string.Empty,
|
||||
MailOperation.LightEditor => string.Empty,
|
||||
MailOperation.Print => Translator.MailOperation_Print,
|
||||
MailOperation.ViewMessageSource => Translator.MailOperation_ViewMessageSource,
|
||||
MailOperation.Navigate => Translator.MailOperation_Navigate,
|
||||
_ => "unknown",
|
||||
};
|
||||
|
||||
@@ -261,6 +261,10 @@ namespace Wino.Mail.ViewModels
|
||||
{
|
||||
await PrintAsync();
|
||||
}
|
||||
else if (operation == MailOperation.ViewMessageSource)
|
||||
{
|
||||
await _dialogService.ShowMessageSourceDialogAsync(initializedMimeMessageInformation.MimeMessage.ToString());
|
||||
}
|
||||
else if (operation == MailOperation.Reply || operation == MailOperation.ReplyAll || operation == MailOperation.Forward)
|
||||
{
|
||||
if (initializedMailItemViewModel == null) return;
|
||||
@@ -549,6 +553,11 @@ namespace Wino.Mail.ViewModels
|
||||
MenuItems.Add(MailOperationMenuItem.Create(MailOperation.Forward));
|
||||
}
|
||||
|
||||
if (initializedMimeMessageInformation?.MimeMessage != null)
|
||||
{
|
||||
MenuItems.Add(MailOperationMenuItem.Create(MailOperation.ViewMessageSource, true, true));
|
||||
}
|
||||
|
||||
// Archive - Unarchive
|
||||
if (initializedMailItemViewModel.AssignedFolder.SpecialFolderType == SpecialFolderType.Archive)
|
||||
MenuItems.Add(MailOperationMenuItem.Create(MailOperation.UnArchive));
|
||||
|
||||
28
Wino.Mail/Dialogs/MessageSourceDialog.xaml
Normal file
28
Wino.Mail/Dialogs/MessageSourceDialog.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<ContentDialog
|
||||
x:Class="Wino.Mail.Dialogs.MessageSourceDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:local="using:Wino.Mail.Dialogs"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{x:Bind domain:Translator.MessageSourceDialog_Title}"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
||||
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Copy}"
|
||||
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Close}"
|
||||
Style="{StaticResource WinoDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ContentDialog.Resources>
|
||||
<x:Double x:Key="ContentDialogMaxWidth">1200</x:Double>
|
||||
</ContentDialog.Resources>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled">
|
||||
<TextBlock
|
||||
MaxWidth="1000"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="{x:Bind MessageSource, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</ScrollViewer>
|
||||
</ContentDialog>
|
||||
24
Wino.Mail/Dialogs/MessageSourceDialog.xaml.cs
Normal file
24
Wino.Mail/Dialogs/MessageSourceDialog.xaml.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
|
||||
namespace Wino.Mail.Dialogs
|
||||
{
|
||||
public sealed partial class MessageSourceDialog : ContentDialog
|
||||
{
|
||||
private readonly IClipboardService _clipboardService = App.Current.Services.GetService<IClipboardService>();
|
||||
public string MessageSource { get; set; }
|
||||
public bool Copied { get; set; }
|
||||
public MessageSourceDialog()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
_clipboardService.CopyClipboardAsync(MessageSource);
|
||||
Copied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using Wino.Core.Domain.Models.Synchronization;
|
||||
using Wino.Core.UWP.Extensions;
|
||||
using Wino.Core.UWP.Services;
|
||||
using Wino.Dialogs;
|
||||
using Wino.Mail.Dialogs;
|
||||
using Wino.Messaging.Server;
|
||||
using Wino.Messaging.UI;
|
||||
|
||||
@@ -169,6 +170,20 @@ namespace Wino.Services
|
||||
return result == ContentDialogResult.Primary ? signatureEditorDialog.Result : null;
|
||||
}
|
||||
|
||||
public async Task ShowMessageSourceDialogAsync(string messageSource)
|
||||
{
|
||||
var dialog = new MessageSourceDialog()
|
||||
{
|
||||
MessageSource = messageSource,
|
||||
RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme()
|
||||
};
|
||||
|
||||
await HandleDialogPresentationAsync(dialog);
|
||||
|
||||
if(dialog.Copied)
|
||||
InfoBarMessage(Translator.ClipboardTextCopied_Title, string.Format(Translator.ClipboardTextCopied_Message, Translator.MessageSourceDialog_Title), InfoBarMessageType.Information);
|
||||
}
|
||||
|
||||
public async Task ShowAccountReorderDialogAsync(ObservableCollection<IAccountProviderDetailViewModel> availableAccounts)
|
||||
{
|
||||
var accountReorderDialog = new AccountReorderDialog(availableAccounts)
|
||||
|
||||
@@ -223,6 +223,9 @@
|
||||
<Compile Include="Dialogs\AccountReorderDialog.xaml.cs">
|
||||
<DependentUpon>AccountReorderDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\MessageSourceDialog.xaml.cs">
|
||||
<DependentUpon>MessageSourceDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\MoveMailDialog.xaml.cs">
|
||||
<DependentUpon>MoveMailDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -364,6 +367,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\MessageSourceDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\MoveMailDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user