diff --git a/NAPS2.Lib.Mac/ImportExport/AppleMailEmailProvider.cs b/NAPS2.Lib.Mac/ImportExport/AppleMailEmailProvider.cs new file mode 100644 index 000000000..825ce6bcd --- /dev/null +++ b/NAPS2.Lib.Mac/ImportExport/AppleMailEmailProvider.cs @@ -0,0 +1,57 @@ +using NAPS2.ImportExport.Email; + +namespace NAPS2.ImportExport; + +public class AppleMailEmailProvider : IAppleMailEmailProvider +{ + public Task SendEmail(EmailMessage emailMessage, ProgressHandler progress = default) + { + return Task.Run(async () => + { + EmailServiceDelegate d = null!; + Invoker.Current.Invoke(() => + { + var service = NSSharingService.GetSharingService(NSSharingServiceName.ComposeEmail); + if (emailMessage.Subject != null) + { + service.Subject = emailMessage.Subject; + } + if (emailMessage.Recipients.Any()) + { + service.Recipients = emailMessage.Recipients.Select(x => (NSObject) new NSString(x.Address)) + .ToArray(); + } + var items = new List(); + if (emailMessage.BodyText != null) + { + items.Add(new NSString(emailMessage.BodyText)); + } + foreach (var attachment in emailMessage.Attachments) + { + items.Add(NSUrl.FromFilename(attachment.FilePath)); + } + d = new EmailServiceDelegate(); + service.Delegate = d; + service.PerformWithItems(items.ToArray()); + }); + return await d.Task; + }); + } + + private class EmailServiceDelegate : NSSharingServiceDelegate + { + private readonly TaskCompletionSource _tcs = new(); + + public override void DidShareItems(NSSharingService sharingService, NSObject[] items) + { + _tcs.SetResult(true); + } + + public override void DidFailToShareItems(NSSharingService sharingService, NSObject[] items, NSError error) + { + _tcs.SetResult(false); + } + + public Task Task => _tcs.Task; + } +} \ No newline at end of file diff --git a/NAPS2.Lib.Mac/Modules/MacModule.cs b/NAPS2.Lib.Mac/Modules/MacModule.cs index f9c1e2e94..2a4dc0ade 100644 --- a/NAPS2.Lib.Mac/Modules/MacModule.cs +++ b/NAPS2.Lib.Mac/Modules/MacModule.cs @@ -4,6 +4,7 @@ using NAPS2.EtoForms.Mac; using NAPS2.EtoForms.Ui; using NAPS2.Images.Mac; using NAPS2.ImportExport; +using NAPS2.ImportExport.Email; using NAPS2.Pdf; using NAPS2.Update; @@ -17,6 +18,7 @@ public class MacModule : GuiModule builder.RegisterType().As().SingleInstance(); builder.RegisterType().As(); + builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().AsSelf(); diff --git a/NAPS2.Lib/AutofacEmailProviderFactory.cs b/NAPS2.Lib/AutofacEmailProviderFactory.cs index 25331c6ab..84a413359 100644 --- a/NAPS2.Lib/AutofacEmailProviderFactory.cs +++ b/NAPS2.Lib/AutofacEmailProviderFactory.cs @@ -24,6 +24,8 @@ public class AutofacEmailProviderFactory : IEmailProviderFactory return _container.Resolve(); case EmailProviderType.Thunderbird: return _container.Resolve(); + case EmailProviderType.AppleMail: + return _container.Resolve(); default: return _container.Resolve(); } diff --git a/NAPS2.Lib/EtoForms/Ui/EmailSettingsForm.cs b/NAPS2.Lib/EtoForms/Ui/EmailSettingsForm.cs index 213d38535..a0271dca9 100644 --- a/NAPS2.Lib/EtoForms/Ui/EmailSettingsForm.cs +++ b/NAPS2.Lib/EtoForms/Ui/EmailSettingsForm.cs @@ -79,6 +79,9 @@ public class EmailSettingsForm : EtoDialogBase case EmailProviderType.Thunderbird: _provider.Text = SettingsResources.EmailProviderType_Thunderbird; break; + case EmailProviderType.AppleMail: + _provider.Text = SettingsResources.EmailProviderType_AppleMail; + break; case EmailProviderType.CustomSmtp: _provider.Text = config.Get(c => c.EmailSetup.SmtpHost) + '\n' + config.Get(c => c.EmailSetup.SmtpUser); break; diff --git a/NAPS2.Lib/Icons.Designer.cs b/NAPS2.Lib/Icons.Designer.cs index e982300a4..6916d62e4 100644 --- a/NAPS2.Lib/Icons.Designer.cs +++ b/NAPS2.Lib/Icons.Designer.cs @@ -11,46 +11,32 @@ namespace NAPS2 { using System; - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Icons { - private static global::System.Resources.ResourceManager resourceMan; + private static System.Resources.ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Icons() { } - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NAPS2.Icons", typeof(Icons).Assembly); + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("NAPS2.Icons", typeof(Icons).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -59,59 +45,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] accept { - get { - object obj = ResourceManager.GetObject("accept", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] accept_small { - get { - object obj = ResourceManager.GetObject("accept_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] add { - get { - object obj = ResourceManager.GetObject("add", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] add_small { - get { - object obj = ResourceManager.GetObject("add_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] application_cascade { - get { - object obj = ResourceManager.GetObject("application_cascade", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_down { get { object obj = ResourceManager.GetObject("arrow_down", resourceCulture); @@ -119,29 +52,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_down_small { - get { - object obj = ResourceManager.GetObject("arrow_down_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_left { - get { - object obj = ResourceManager.GetObject("arrow_left", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_out { get { object obj = ResourceManager.GetObject("arrow_out", resourceCulture); @@ -149,29 +59,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_refresh { - get { - object obj = ResourceManager.GetObject("arrow_refresh", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_right { - get { - object obj = ResourceManager.GetObject("arrow_right", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_rotate_anticlockwise { get { object obj = ResourceManager.GetObject("arrow_rotate_anticlockwise", resourceCulture); @@ -179,19 +66,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_rotate_anticlockwise_small { - get { - object obj = ResourceManager.GetObject("arrow_rotate_anticlockwise_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_rotate_clockwise { get { object obj = ResourceManager.GetObject("arrow_rotate_clockwise", resourceCulture); @@ -199,19 +73,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_rotate_clockwise_small { - get { - object obj = ResourceManager.GetObject("arrow_rotate_clockwise_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_switch { get { object obj = ResourceManager.GetObject("arrow_switch", resourceCulture); @@ -219,19 +80,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_switch_small { - get { - object obj = ResourceManager.GetObject("arrow_switch_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] arrow_up { get { object obj = ResourceManager.GetObject("arrow_up", resourceCulture); @@ -239,19 +87,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] arrow_up_small { - get { - object obj = ResourceManager.GetObject("arrow_up_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] blueprints { get { object obj = ResourceManager.GetObject("blueprints", resourceCulture); @@ -259,159 +94,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] blueprints_small { - get { - object obj = ResourceManager.GetObject("blueprints_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] btn_donate_LG { - get { - object obj = ResourceManager.GetObject("btn_donate_LG", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] cancel { - get { - object obj = ResourceManager.GetObject("cancel", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] cancel_small { - get { - object obj = ResourceManager.GetObject("cancel_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] close { - get { - object obj = ResourceManager.GetObject("close", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] cog { - get { - object obj = ResourceManager.GetObject("cog", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] cog_small { - get { - object obj = ResourceManager.GetObject("cog_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] color_gradient { - get { - object obj = ResourceManager.GetObject("color_gradient", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] color_management { - get { - object obj = ResourceManager.GetObject("color_management", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] color_wheel { - get { - object obj = ResourceManager.GetObject("color_wheel", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] contrast { - get { - object obj = ResourceManager.GetObject("contrast", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] contrast_high { - get { - object obj = ResourceManager.GetObject("contrast_high", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] contrast_with_sun { - get { - object obj = ResourceManager.GetObject("contrast_with_sun", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] control_play_blue { - get { - object obj = ResourceManager.GetObject("control_play_blue", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] control_play_blue_small { - get { - object obj = ResourceManager.GetObject("control_play_blue_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] cross { get { object obj = ResourceManager.GetObject("cross", resourceCulture); @@ -419,169 +101,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] cross_small { - get { - object obj = ResourceManager.GetObject("cross_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] diskette { - get { - object obj = ResourceManager.GetObject("diskette", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] email_attach { - get { - object obj = ResourceManager.GetObject("email_attach", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] email_setting { - get { - object obj = ResourceManager.GetObject("email_setting", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] email_small { - get { - object obj = ResourceManager.GetObject("email_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] exclamation { - get { - object obj = ResourceManager.GetObject("exclamation", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] favicon { - get { - object obj = ResourceManager.GetObject("favicon", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] file_extension_pdf { - get { - object obj = ResourceManager.GetObject("file_extension_pdf", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] file_extension_pdf_small { - get { - object obj = ResourceManager.GetObject("file_extension_pdf_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] folder_picture { - get { - object obj = ResourceManager.GetObject("folder_picture", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] gmail { - get { - object obj = ResourceManager.GetObject("gmail", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] hourglass_grey { - get { - object obj = ResourceManager.GetObject("hourglass_grey", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] image_edit { - get { - object obj = ResourceManager.GetObject("image_edit", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] info_rhombus { - get { - object obj = ResourceManager.GetObject("info_rhombus", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] information { - get { - object obj = ResourceManager.GetObject("information", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] information_small { - get { - object obj = ResourceManager.GetObject("information_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] key_small { get { object obj = ResourceManager.GetObject("key_small", resourceCulture); @@ -589,39 +108,48 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] mail_yellow { + internal static byte[] email_small { get { - object obj = ResourceManager.GetObject("mail_yellow", resourceCulture); + object obj = ResourceManager.GetObject("email_small", resourceCulture); return ((byte[])(obj)); } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] outlookweb { + internal static byte[] email_attach { get { - object obj = ResourceManager.GetObject("outlookweb", resourceCulture); + object obj = ResourceManager.GetObject("email_attach", resourceCulture); return ((byte[])(obj)); } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] thunderbird { + internal static byte[] file_extension_pdf { get { - object obj = ResourceManager.GetObject("thunderbird", resourceCulture); + object obj = ResourceManager.GetObject("file_extension_pdf", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] file_extension_pdf_small { + get { + object obj = ResourceManager.GetObject("file_extension_pdf_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] information { + get { + object obj = ResourceManager.GetObject("information", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] info_rhombus { + get { + object obj = ResourceManager.GetObject("info_rhombus", resourceCulture); return ((byte[])(obj)); } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] pdf_email { get { object obj = ResourceManager.GetObject("pdf_email", resourceCulture); @@ -629,29 +157,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] pencil { - get { - object obj = ResourceManager.GetObject("pencil", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] pencil_small { - get { - object obj = ResourceManager.GetObject("pencil_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] picture { get { object obj = ResourceManager.GetObject("picture", resourceCulture); @@ -659,69 +164,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] picture_edit { - get { - object obj = ResourceManager.GetObject("picture_edit", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] picture_save { - get { - object obj = ResourceManager.GetObject("picture_save", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] picture_small { - get { - object obj = ResourceManager.GetObject("picture_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] pictures { - get { - object obj = ResourceManager.GetObject("pictures", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] printer { - get { - object obj = ResourceManager.GetObject("printer", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] scanner_128 { - get { - object obj = ResourceManager.GetObject("scanner_128", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] scanner_16 { get { object obj = ResourceManager.GetObject("scanner_16", resourceCulture); @@ -729,9 +171,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] scanner_32 { get { object obj = ResourceManager.GetObject("scanner_32", resourceCulture); @@ -739,19 +178,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] scanner_48 { - get { - object obj = ResourceManager.GetObject("scanner_48", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] scanner_48_old { get { object obj = ResourceManager.GetObject("scanner_48_old", resourceCulture); @@ -759,9 +185,13 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// + internal static byte[] scanner_48 { + get { + object obj = ResourceManager.GetObject("scanner_48", resourceCulture); + return ((byte[])(obj)); + } + } + internal static byte[] scanner_64 { get { object obj = ResourceManager.GetObject("scanner_64", resourceCulture); @@ -769,9 +199,13 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// + internal static byte[] scanner_128 { + get { + object obj = ResourceManager.GetObject("scanner_128", resourceCulture); + return ((byte[])(obj)); + } + } + internal static byte[] scanner_default { get { object obj = ResourceManager.GetObject("scanner_default", resourceCulture); @@ -779,19 +213,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] scanner_lock { - get { - object obj = ResourceManager.GetObject("scanner_lock", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] scanner_lock_default { get { object obj = ResourceManager.GetObject("scanner_lock_default", resourceCulture); @@ -799,69 +220,13 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] sharpen { + internal static byte[] scanner_lock { get { - object obj = ResourceManager.GetObject("sharpen", resourceCulture); + object obj = ResourceManager.GetObject("scanner_lock", resourceCulture); return ((byte[])(obj)); } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] text { - get { - object obj = ResourceManager.GetObject("text", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] text_small { - get { - object obj = ResourceManager.GetObject("text_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] tick { - get { - object obj = ResourceManager.GetObject("tick", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] tick_small { - get { - object obj = ResourceManager.GetObject("tick_small", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] transform_crop { - get { - object obj = ResourceManager.GetObject("transform_crop", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] transform_flip { get { object obj = ResourceManager.GetObject("transform_flip", resourceCulture); @@ -869,49 +234,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] weather_sun { - get { - object obj = ResourceManager.GetObject("weather_sun", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] wireless16 { - get { - object obj = ResourceManager.GetObject("wireless16", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] world { - get { - object obj = ResourceManager.GetObject("world", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] zoom { - get { - object obj = ResourceManager.GetObject("zoom", resourceCulture); - return ((byte[])(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] zoom_actual { get { object obj = ResourceManager.GetObject("zoom_actual", resourceCulture); @@ -919,9 +241,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] zoom_in { get { object obj = ResourceManager.GetObject("zoom_in", resourceCulture); @@ -929,9 +248,6 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// internal static byte[] zoom_out { get { object obj = ResourceManager.GetObject("zoom_out", resourceCulture); @@ -939,9 +255,419 @@ namespace NAPS2 { } } - /// - /// Looks up a localized resource of type System.Byte[]. - /// + internal static byte[] accept { + get { + object obj = ResourceManager.GetObject("accept", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] accept_small { + get { + object obj = ResourceManager.GetObject("accept_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] add { + get { + object obj = ResourceManager.GetObject("add", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] add_small { + get { + object obj = ResourceManager.GetObject("add_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] cancel { + get { + object obj = ResourceManager.GetObject("cancel", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] cancel_small { + get { + object obj = ResourceManager.GetObject("cancel_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] cross_small { + get { + object obj = ResourceManager.GetObject("cross_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] pencil { + get { + object obj = ResourceManager.GetObject("pencil", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] pencil_small { + get { + object obj = ResourceManager.GetObject("pencil_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] tick { + get { + object obj = ResourceManager.GetObject("tick", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] tick_small { + get { + object obj = ResourceManager.GetObject("tick_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] blueprints_small { + get { + object obj = ResourceManager.GetObject("blueprints_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] world { + get { + object obj = ResourceManager.GetObject("world", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] folder_picture { + get { + object obj = ResourceManager.GetObject("folder_picture", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_refresh { + get { + object obj = ResourceManager.GetObject("arrow_refresh", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_rotate_anticlockwise_small { + get { + object obj = ResourceManager.GetObject("arrow_rotate_anticlockwise_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_rotate_clockwise_small { + get { + object obj = ResourceManager.GetObject("arrow_rotate_clockwise_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_switch_small { + get { + object obj = ResourceManager.GetObject("arrow_switch_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] text { + get { + object obj = ResourceManager.GetObject("text", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] text_small { + get { + object obj = ResourceManager.GetObject("text_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] control_play_blue { + get { + object obj = ResourceManager.GetObject("control_play_blue", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] control_play_blue_small { + get { + object obj = ResourceManager.GetObject("control_play_blue_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] color_wheel { + get { + object obj = ResourceManager.GetObject("color_wheel", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] contrast { + get { + object obj = ResourceManager.GetObject("contrast", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] image_edit { + get { + object obj = ResourceManager.GetObject("image_edit", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] transform_crop { + get { + object obj = ResourceManager.GetObject("transform_crop", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] weather_sun { + get { + object obj = ResourceManager.GetObject("weather_sun", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_down_small { + get { + object obj = ResourceManager.GetObject("arrow_down_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_up_small { + get { + object obj = ResourceManager.GetObject("arrow_up_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] pictures { + get { + object obj = ResourceManager.GetObject("pictures", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] picture_edit { + get { + object obj = ResourceManager.GetObject("picture_edit", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] picture_save { + get { + object obj = ResourceManager.GetObject("picture_save", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_left { + get { + object obj = ResourceManager.GetObject("arrow_left", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] arrow_right { + get { + object obj = ResourceManager.GetObject("arrow_right", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] printer { + get { + object obj = ResourceManager.GetObject("printer", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] application_cascade { + get { + object obj = ResourceManager.GetObject("application_cascade", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] close { + get { + object obj = ResourceManager.GetObject("close", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] picture_small { + get { + object obj = ResourceManager.GetObject("picture_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] color_gradient { + get { + object obj = ResourceManager.GetObject("color_gradient", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] color_management { + get { + object obj = ResourceManager.GetObject("color_management", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] contrast_high { + get { + object obj = ResourceManager.GetObject("contrast_high", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] contrast_with_sun { + get { + object obj = ResourceManager.GetObject("contrast_with_sun", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] sharpen { + get { + object obj = ResourceManager.GetObject("sharpen", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] btn_donate_LG { + get { + object obj = ResourceManager.GetObject("btn_donate_LG", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] gmail { + get { + object obj = ResourceManager.GetObject("gmail", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] outlookweb { + get { + object obj = ResourceManager.GetObject("outlookweb", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] thunderbird { + get { + object obj = ResourceManager.GetObject("thunderbird", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] apple_mail { + get { + object obj = ResourceManager.GetObject("apple_mail", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] email_setting { + get { + object obj = ResourceManager.GetObject("email_setting", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] mail_yellow { + get { + object obj = ResourceManager.GetObject("mail_yellow", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] hourglass_grey { + get { + object obj = ResourceManager.GetObject("hourglass_grey", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] wireless16 { + get { + object obj = ResourceManager.GetObject("wireless16", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] cog { + get { + object obj = ResourceManager.GetObject("cog", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] cog_small { + get { + object obj = ResourceManager.GetObject("cog_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] information_small { + get { + object obj = ResourceManager.GetObject("information_small", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] favicon { + get { + object obj = ResourceManager.GetObject("favicon", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] exclamation { + get { + object obj = ResourceManager.GetObject("exclamation", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] diskette { + get { + object obj = ResourceManager.GetObject("diskette", resourceCulture); + return ((byte[])(obj)); + } + } + + internal static byte[] zoom { + get { + object obj = ResourceManager.GetObject("zoom", resourceCulture); + return ((byte[])(obj)); + } + } + internal static byte[] zoom_small { get { object obj = ResourceManager.GetObject("zoom_small", resourceCulture); diff --git a/NAPS2.Lib/Icons.resx b/NAPS2.Lib/Icons.resx index be7a8ba3e..a9e756f66 100644 --- a/NAPS2.Lib/Icons.resx +++ b/NAPS2.Lib/Icons.resx @@ -349,6 +349,9 @@ Icons\thunderbird.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Icons\apple_mail.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + Icons\email_setting.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/NAPS2.Lib/Icons/apple_mail.png b/NAPS2.Lib/Icons/apple_mail.png new file mode 100644 index 000000000..55de5209f Binary files /dev/null and b/NAPS2.Lib/Icons/apple_mail.png differ diff --git a/NAPS2.Lib/ImportExport/Email/EmailProviderController.cs b/NAPS2.Lib/ImportExport/Email/EmailProviderController.cs index 8527efea2..49a6be293 100644 --- a/NAPS2.Lib/ImportExport/Email/EmailProviderController.cs +++ b/NAPS2.Lib/ImportExport/Email/EmailProviderController.cs @@ -60,6 +60,7 @@ public class EmailProviderController #if NET6_0_OR_GREATER // For Windows we expect Thunderbird to be used through MAPI. For Linux we need to handle it specially. MaybeAddWidget(EmailProviderType.Thunderbird, OperatingSystem.IsLinux()); + MaybeAddWidget(EmailProviderType.AppleMail, OperatingSystem.IsMacOS()); #endif MaybeAddWidget(EmailProviderType.Gmail, _gmailOauthProvider.HasClientCreds); MaybeAddWidget(EmailProviderType.OutlookWeb, _outlookWebOauthProvider.HasClientCreds); @@ -89,6 +90,13 @@ public class EmailProviderController // The point is to give a hint to the user that Thunderbird support is present. Enabled = _thunderbirdProvider.IsAvailable }, + EmailProviderType.AppleMail => new EmailProviderWidget + { + ProviderType = EmailProviderType.AppleMail, + ProviderIcon = Icons.apple_mail.ToEtoImage(), + ProviderName = EmailProviderType.AppleMail.Description(), + Choose = ChooseAppleMail + }, EmailProviderType.Gmail => new EmailProviderWidget { ProviderType = EmailProviderType.Gmail, @@ -145,6 +153,15 @@ public class EmailProviderController return true; } + private bool ChooseAppleMail() + { + var transact = _config.User.BeginTransaction(); + transact.Remove(c => c.EmailSetup); + transact.Set(c => c.EmailSetup.ProviderType, EmailProviderType.AppleMail); + transact.Commit(); + return true; + } + private bool ChooseOauth(OauthProvider provider) { var authForm = _formFactory.Create(); diff --git a/NAPS2.Lib/ImportExport/Email/EmailProviderType.cs b/NAPS2.Lib/ImportExport/Email/EmailProviderType.cs index 1fffa20d9..c57d4fb34 100644 --- a/NAPS2.Lib/ImportExport/Email/EmailProviderType.cs +++ b/NAPS2.Lib/ImportExport/Email/EmailProviderType.cs @@ -12,5 +12,7 @@ public enum EmailProviderType [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_OutlookWeb")] OutlookWeb, [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_Thunderbird")] - Thunderbird + Thunderbird, + [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_AppleMail")] + AppleMail } \ No newline at end of file diff --git a/NAPS2.Lib/ImportExport/Email/IAppleMailEmailProvider.cs b/NAPS2.Lib/ImportExport/Email/IAppleMailEmailProvider.cs new file mode 100644 index 000000000..4df446260 --- /dev/null +++ b/NAPS2.Lib/ImportExport/Email/IAppleMailEmailProvider.cs @@ -0,0 +1,5 @@ +namespace NAPS2.ImportExport.Email; + +public interface IAppleMailEmailProvider : IEmailProvider +{ +} \ No newline at end of file diff --git a/NAPS2.Lib/Lang/Resources/SettingsResources.Designer.cs b/NAPS2.Lib/Lang/Resources/SettingsResources.Designer.cs index 59d59e4a5..b5ca5d12f 100644 --- a/NAPS2.Lib/Lang/Resources/SettingsResources.Designer.cs +++ b/NAPS2.Lib/Lang/Resources/SettingsResources.Designer.cs @@ -93,6 +93,12 @@ namespace NAPS2.Lang.Resources { } } + internal static string EmailProviderType_AppleMail { + get { + return ResourceManager.GetString("EmailProviderType_AppleMail", resourceCulture); + } + } + internal static string EmailProvider_NotSelected { get { return ResourceManager.GetString("EmailProvider_NotSelected", resourceCulture); diff --git a/NAPS2.Lib/Lang/Resources/SettingsResources.resx b/NAPS2.Lib/Lang/Resources/SettingsResources.resx index b1870eea1..e57c66238 100644 --- a/NAPS2.Lib/Lang/Resources/SettingsResources.resx +++ b/NAPS2.Lib/Lang/Resources/SettingsResources.resx @@ -141,6 +141,9 @@ Thunderbird + + Apple Mail + No provider selected.