From 791e37a3badd0a09db1f1e976d775bb1c850523f Mon Sep 17 00:00:00 2001 From: Ben Olden-Cooligan Date: Sun, 5 Aug 2018 12:12:41 -0400 Subject: [PATCH] Email provider form --- NAPS2.Core/Icons.Designer.cs | 20 +++ NAPS2.Core/Icons.resx | 6 + NAPS2.Core/Icons/gmail.png | Bin 0 -> 899 bytes NAPS2.Core/Icons/outlookweb.png | Bin 0 -> 817 bytes .../ImportExport/Email/EmailProviderType.cs | 5 + NAPS2.Core/ImportExport/Email/EmailSetup.cs | 16 ++ .../Resources/SettingsResources.Designer.cs | 27 ++++ .../Lang/Resources/SettingsResources.resx | 9 ++ NAPS2.Core/NAPS2.Core.csproj | 20 +++ .../WinForms/EmailProviderWidget.Designer.cs | 71 +++++++++ NAPS2.Core/WinForms/EmailProviderWidget.cs | 34 ++++ NAPS2.Core/WinForms/EmailProviderWidget.resx | 120 +++++++++++++++ .../WinForms/FEmailProvider.Designer.cs | 64 ++++++++ NAPS2.Core/WinForms/FEmailProvider.cs | 118 ++++++++++++++ NAPS2.Core/WinForms/FEmailProvider.resx | 145 ++++++++++++++++++ .../WinForms/FEmailSettings.Designer.cs | 38 +++++ NAPS2.Core/WinForms/FEmailSettings.cs | 7 + NAPS2.Core/WinForms/FEmailSettings.resx | 133 ++++++++++++++-- 18 files changed, 816 insertions(+), 17 deletions(-) create mode 100644 NAPS2.Core/Icons/gmail.png create mode 100644 NAPS2.Core/Icons/outlookweb.png create mode 100644 NAPS2.Core/WinForms/EmailProviderWidget.Designer.cs create mode 100644 NAPS2.Core/WinForms/EmailProviderWidget.cs create mode 100644 NAPS2.Core/WinForms/EmailProviderWidget.resx create mode 100644 NAPS2.Core/WinForms/FEmailProvider.Designer.cs create mode 100644 NAPS2.Core/WinForms/FEmailProvider.cs create mode 100644 NAPS2.Core/WinForms/FEmailProvider.resx diff --git a/NAPS2.Core/Icons.Designer.cs b/NAPS2.Core/Icons.Designer.cs index 060963b12..7865dca31 100644 --- a/NAPS2.Core/Icons.Designer.cs +++ b/NAPS2.Core/Icons.Designer.cs @@ -450,6 +450,16 @@ namespace NAPS2 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap gmail { + get { + object obj = ResourceManager.GetObject("gmail", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -480,6 +490,16 @@ namespace NAPS2 { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap outlookweb { + get { + object obj = ResourceManager.GetObject("outlookweb", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/NAPS2.Core/Icons.resx b/NAPS2.Core/Icons.resx index 172780200..772fc5f45 100644 --- a/NAPS2.Core/Icons.resx +++ b/NAPS2.Core/Icons.resx @@ -322,4 +322,10 @@ Icons\btn_donate_LG.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Icons\gmail.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Icons\outlookweb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/NAPS2.Core/Icons/gmail.png b/NAPS2.Core/Icons/gmail.png new file mode 100644 index 0000000000000000000000000000000000000000..58d553360abf174db54e438bf179f35d4792bf2c GIT binary patch literal 899 zcmV-}1AP36P)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00009 za7bBm000id000id0mpBsWB>pF2XskIMF-&s4G1bSdU-vI0000PbVXQnQ*UN;cVTj6 z0B~VxZgehgWpp4kE-)@KG4UX2l>h(&!AV3xR9HvtmEB8IaTv$X|Kg-8Zz`iGbEZqp zX{HlqZx_Y935u?QF7hS{@oRoATUz}-MI6x)?8vx$ZJ)5dH($GMxTje(XLO_OA4KzyJdnRH5b__m}{ zh`;VvXB5tL)>Y!ev9hfKUUN0v7pfq%)@nBVx_=ibS<(;EfqH3A;hbR0Iee+AfTPl& zFF-8RpMw8dn`X0oy&cKv&$@y6B&Vm;-opKUwl;b4h#J1F0I@hY0JptY_xNJZdXZU8 zYJ$^jjh+?uOC60+UcG>4n145p(9KTG(C{4_)|R}R;cGrGTkF#F zNnKZ=%zQ;S9A*N8yAy~+BC3RQW(L0Qdz#_0)r`c%mPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00N;&L_t(oN9~tAXcR#d$H$0h;YYOa3&lnd zK}AeqXD?RTDIx(wFlw?lJH}{rO=>&AN+VcBMJyD=;yiC>_P_%bK|v8xL=h4N@uP^r z^*`@6dwaXIlGAkD$+O6XsQi0Lhc)(K3Jr5ONp#H;u&Anc@LT)kBG~Bylyb3G3#Z&DZnBI zyg~aK?Vm`jB_jYii}U1|zXeS8fP6;Zb;&N*caSeBHw!=?VpuiJBjjerox2$T@*_K6 zSxW;fcQ3P?J=7m})}h!;EdPH1Tz$f^9jqG9r=U3<%K&hOXn^gG(6c@fxpUh0S+RT# zU{(6jK5Y5jDK=8uNMkNI+c8HdmIY9%ZbNVd-o%%{r}u(3A@{ZAHe;=GfUD!kX|39J z29fhEIwl1`{-%Lr?v{vuftAaBw9+;|qygwI3GErXx)ZB@9Lx2U0-%1-1o|z6{ah}x zve(D1;I)SR6w`Y^VGqdffEY&q9QC7lA*BG|drv&wK*el1ANaX?M_`t7usxq*K0w5u zq7(o~xF@KXa7ELnuVr_Td|Xb%@(Tyxs=L-v9DpS6(f3}m z=4GSec~Ex%wB#>LF42F1HsdJn3V@+<1IXFp0ra`S)p(|a;%Ijl50KNA0a^fDO=6NK z*ce}96Pv0dfWUD3VRHcFBu=|)Pz}#N6AMOF3_yZSdn?)4^8+Yw7GO8fHqdtIubHWp vD{F8^97fTLfVmC5MgP7ZHMRhtckmoy literal 0 HcmV?d00001 diff --git a/NAPS2.Core/ImportExport/Email/EmailProviderType.cs b/NAPS2.Core/ImportExport/Email/EmailProviderType.cs index 492edc363..fa677724c 100644 --- a/NAPS2.Core/ImportExport/Email/EmailProviderType.cs +++ b/NAPS2.Core/ImportExport/Email/EmailProviderType.cs @@ -1,14 +1,19 @@ using System; using System.Collections.Generic; using System.Linq; +using NAPS2.Lang.Resources; +using NAPS2.Scan; namespace NAPS2.ImportExport.Email { public enum EmailProviderType { System, + [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_CustomSmtp")] CustomSmtp, + [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_Gmail")] Gmail, + [LocalizedDescription(typeof(SettingsResources), "EmailProviderType_OutlookWeb")] OutlookWeb } } \ No newline at end of file diff --git a/NAPS2.Core/ImportExport/Email/EmailSetup.cs b/NAPS2.Core/ImportExport/Email/EmailSetup.cs index 4951a4ff0..53e326a83 100644 --- a/NAPS2.Core/ImportExport/Email/EmailSetup.cs +++ b/NAPS2.Core/ImportExport/Email/EmailSetup.cs @@ -9,10 +9,26 @@ namespace NAPS2.ImportExport.Email { public EmailProviderType ProviderType { get; set; } + public string SystemAppName { get; set; } + public string GmailUser { get; set; } + public string GmailTokenSecure { get; set; } + public string OutlookWebUser { get; set; } + public string OutlookWebTokenSecure { get; set; } + + public string SmtpHost { get; set; } + + public string SmtpFrom { get; set; } + + public int? SmtpPort { get; set; } + + public bool SmtpTls { get; set; } + public string SmtpUser { get; set; } + + public string SmtpPasswordSecure { get; set; } } } diff --git a/NAPS2.Core/Lang/Resources/SettingsResources.Designer.cs b/NAPS2.Core/Lang/Resources/SettingsResources.Designer.cs index 7e0bdc445..89bc0a9c3 100644 --- a/NAPS2.Core/Lang/Resources/SettingsResources.Designer.cs +++ b/NAPS2.Core/Lang/Resources/SettingsResources.Designer.cs @@ -159,6 +159,33 @@ namespace NAPS2.Lang.Resources { } } + /// + /// Looks up a localized string similar to Custom SMTP. + /// + internal static string EmailProviderType_CustomSmtp { + get { + return ResourceManager.GetString("EmailProviderType_CustomSmtp", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gmail. + /// + internal static string EmailProviderType_Gmail { + get { + return ResourceManager.GetString("EmailProviderType_Gmail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Outlook Web Access. + /// + internal static string EmailProviderType_OutlookWeb { + get { + return ResourceManager.GetString("EmailProviderType_OutlookWeb", resourceCulture); + } + } + /// /// Looks up a localized string similar to Center. /// diff --git a/NAPS2.Core/Lang/Resources/SettingsResources.resx b/NAPS2.Core/Lang/Resources/SettingsResources.resx index 721039dad..dac0708d7 100644 --- a/NAPS2.Core/Lang/Resources/SettingsResources.resx +++ b/NAPS2.Core/Lang/Resources/SettingsResources.resx @@ -150,6 +150,15 @@ 800 dpi + + Custom SMTP + + + Gmail + + + Outlook Web Access + Center diff --git a/NAPS2.Core/NAPS2.Core.csproj b/NAPS2.Core/NAPS2.Core.csproj index 0669ffddd..04af07227 100644 --- a/NAPS2.Core/NAPS2.Core.csproj +++ b/NAPS2.Core/NAPS2.Core.csproj @@ -341,6 +341,12 @@ Component + + UserControl + + + EmailProviderWidget.cs + Form @@ -371,6 +377,12 @@ FBatchScan.cs + + Form + + + FEmailProvider.cs + Form @@ -695,6 +707,9 @@ + + EmailProviderWidget.cs + FAbout.cs @@ -1348,6 +1363,9 @@ FEditProfile.cs + + FEmailProvider.cs + FEmailSettings.cs @@ -5227,7 +5245,9 @@ + + diff --git a/NAPS2.Core/WinForms/EmailProviderWidget.Designer.cs b/NAPS2.Core/WinForms/EmailProviderWidget.Designer.cs new file mode 100644 index 000000000..a527ab6f5 --- /dev/null +++ b/NAPS2.Core/WinForms/EmailProviderWidget.Designer.cs @@ -0,0 +1,71 @@ +namespace NAPS2.WinForms +{ + partial class EmailProviderWidget + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pboxIcon = new System.Windows.Forms.PictureBox(); + this.lblName = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.pboxIcon)).BeginInit(); + this.SuspendLayout(); + // + // pboxIcon + // + this.pboxIcon.Location = new System.Drawing.Point(3, 3); + this.pboxIcon.Name = "pboxIcon"; + this.pboxIcon.Size = new System.Drawing.Size(50, 50); + this.pboxIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pboxIcon.TabIndex = 0; + this.pboxIcon.TabStop = false; + // + // lblName + // + this.lblName.AutoSize = true; + this.lblName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblName.Location = new System.Drawing.Point(59, 18); + this.lblName.Name = "lblName"; + this.lblName.Size = new System.Drawing.Size(0, 20); + this.lblName.TabIndex = 1; + // + // EmailProviderWidget + // + this.Controls.Add(this.lblName); + this.Controls.Add(this.pboxIcon); + this.Name = "EmailProviderWidget"; + this.Size = new System.Drawing.Size(348, 54); + ((System.ComponentModel.ISupportInitialize)(this.pboxIcon)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox pboxIcon; + private System.Windows.Forms.Label lblName; + } +} diff --git a/NAPS2.Core/WinForms/EmailProviderWidget.cs b/NAPS2.Core/WinForms/EmailProviderWidget.cs new file mode 100644 index 000000000..f256eff12 --- /dev/null +++ b/NAPS2.Core/WinForms/EmailProviderWidget.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using NAPS2.ImportExport.Email; + +namespace NAPS2.WinForms +{ + public partial class EmailProviderWidget : UserControl + { + public EmailProviderWidget() + { + InitializeComponent(); + } + + public IEmailProvider Provider { get; set; } + + public Image ProviderIcon + { + get => pboxIcon.Image; + set => pboxIcon.Image = value; + } + + public string ProviderName + { + get => lblName.Text; + set => lblName.Text = value; + } + } +} diff --git a/NAPS2.Core/WinForms/EmailProviderWidget.resx b/NAPS2.Core/WinForms/EmailProviderWidget.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/NAPS2.Core/WinForms/EmailProviderWidget.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NAPS2.Core/WinForms/FEmailProvider.Designer.cs b/NAPS2.Core/WinForms/FEmailProvider.Designer.cs new file mode 100644 index 000000000..95ca62bbc --- /dev/null +++ b/NAPS2.Core/WinForms/FEmailProvider.Designer.cs @@ -0,0 +1,64 @@ +namespace NAPS2.WinForms +{ + partial class FEmailProvider + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FEmailProvider)); + this.panel1 = new System.Windows.Forms.Panel(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.Location = new System.Drawing.Point(12, 12); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(480, 56); + this.panel1.TabIndex = 0; + // + // FEmailProvider + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(504, 80); + this.Controls.Add(this.panel1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximumSize = new System.Drawing.Size(1000, 119); + this.MinimumSize = new System.Drawing.Size(300, 119); + this.Name = "FEmailProvider"; + this.Text = "Choose Email Provider"; + this.Load += new System.EventHandler(this.FEmailProvider_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + } +} \ No newline at end of file diff --git a/NAPS2.Core/WinForms/FEmailProvider.cs b/NAPS2.Core/WinForms/FEmailProvider.cs new file mode 100644 index 000000000..9e42e4c56 --- /dev/null +++ b/NAPS2.Core/WinForms/FEmailProvider.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Microsoft.Win32; +using NAPS2.ImportExport.Email; +using NAPS2.Scan; + +namespace NAPS2.WinForms +{ + public partial class FEmailProvider : FormBase + { + private readonly IEmailProviderFactory emailProviderFactory; + private List providerWidgets; + private string[] systemClientNames; + private string defaultSystemClientName; + + public FEmailProvider(IEmailProviderFactory emailProviderFactory) + { + this.emailProviderFactory = emailProviderFactory; + + InitializeComponent(); + } + + private void FEmailProvider_Load(object sender, EventArgs e) + { + providerWidgets = new List(); + systemClientNames = GetSystemClientNames(); + defaultSystemClientName = GetDefaultSystemClientName(); + + foreach (var clientName in systemClientNames.OrderBy(x => x == defaultSystemClientName ? 0 : 1)) + { + providerWidgets.Add(new EmailProviderWidget + { + Provider = emailProviderFactory.Create(EmailProviderType.System), + ProviderIcon = GetSystemClientIcon(clientName), + ProviderName = clientName + }); + } + providerWidgets.Add(new EmailProviderWidget + { + Provider = emailProviderFactory.Create(EmailProviderType.Gmail), + ProviderIcon = Icons.gmail, + ProviderName = EmailProviderType.Gmail.Description() + }); + providerWidgets.Add(new EmailProviderWidget + { + Provider = emailProviderFactory.Create(EmailProviderType.OutlookWeb), + ProviderIcon = Icons.outlookweb, + ProviderName = EmailProviderType.OutlookWeb.Description() + }); + providerWidgets.Add(new EmailProviderWidget + { + Provider = emailProviderFactory.Create(EmailProviderType.CustomSmtp), + ProviderIcon = null, + ProviderName = EmailProviderType.CustomSmtp.Description() + }); + + // A lot of little fiddling here. This just makes the widgets display nicely + int heightDiff = Height - panel1.Height; + panel1.Height = 0; + foreach (var widget in providerWidgets) + { + panel1.Controls.Add(widget); + widget.BorderStyle = BorderStyle.FixedSingle; + widget.Top = panel1.Height; + widget.Width = panel1.Width; + widget.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + panel1.Height += widget.Height - 1; + } + panel1.Height += 1; + MaximumSize = new Size(MaximumSize.Width, panel1.Height + heightDiff); + MinimumSize = new Size(MinimumSize.Width, panel1.Height + heightDiff); + } + + private string GetDefaultSystemClientName() + { + using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Clients\Mail", false)) + { + return key?.GetValue(null).ToString(); + } + } + + private string[] GetSystemClientNames() + { + // TODO: Swallow errors + using (var clientList = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Clients\Mail", false)) + { + return clientList?.GetSubKeyNames().Where(clientName => + { + using (var clientKey = Registry.LocalMachine.OpenSubKey($@"SOFTWARE\Clients\Mail\{clientName}")) + { + return clientKey?.GetValue("DllPath") != null; + } + }).ToArray() ?? new string[0]; + } + } + + private Image GetSystemClientIcon(string clientName) + { + using (var command = Registry.LocalMachine.OpenSubKey($@"SOFTWARE\Clients\Mail\{clientName}\shell\open\command", false)) + { + string commandText = command?.GetValue(null).ToString() ?? ""; + if (!commandText.StartsWith("\"")) + { + return null; + } + string exePath = commandText.Substring(1, commandText.IndexOf("\"", 1, StringComparison.InvariantCulture) - 1); + var icon = Icon.ExtractAssociatedIcon(exePath); + return icon?.ToBitmap(); + } + } + } +} diff --git a/NAPS2.Core/WinForms/FEmailProvider.resx b/NAPS2.Core/WinForms/FEmailProvider.resx new file mode 100644 index 000000000..2e2ac793c --- /dev/null +++ b/NAPS2.Core/WinForms/FEmailProvider.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AAAAADAAAAAzAAAAMwAAADMAAAAzAAAAMwAAADMAAAAzAAAAMwAAADMAAAAzAAAAMwAA + ADMAAAAzAAAAMwAAADDLomryzKBm/8qeY//KnmP/yp5j/8qeYv/KnmL/yp5i/8qeYv/KnmL/yp5i/8qe + Y//KnmP/yp5j/8ygZv/LomryzKBm////9f///+3///7r///96////er///3p///96f///en///3p///9 + 6v///ev///7r////7f///uz/zKBm/8qeY////u3/5sqh//fkxf//9t////Tc///z2///89v///Pb///z + 2///9Nz///bf//fkxf/myqH///7t/8qeY//KnmP///vp///77//atoT/48SX///z2P//89n///Ta///0 + 2v//89n///PY/+PEl//atoT///vv///76f/KnmP/yp5j///56P//79D///31/9u1gv//9Nj/3LmI/8SV + Vv/ElVb/3LmI///02P/btYL///31///v0P//+ej/yp5j/8qeY///+uj//+vK///sy/////7/5MOT/9y6 + iP///////////9y6iP/kw5P////+///sy///68r///ro/8qeY//KnmP///rq///pxf//6sf/68ue/9u2 + hP///////+/P///vz///////27aE/+vLnv//6sf//+nF///66v/KnmP/yp5j///77P//6MH/9tmv/966 + h/////r//+nH///pxv//6cb//+nH////+v/euof/9tmv///owf//++z/yp5j/8qeY////PH//uG1/962 + gv//++///+a9///mvf//5r7//+a+///mvf//5r3///vv/962gv/+4bX///zx/8qeY//Kn2P///70/+a+ + iP//9eP//+Gy///gsv//4bP//+Gz///hs///4bP//+Cy///hsv//9eP/5r6I///+9P/Kn2P/zKBl//// + /f////j////3////9/////f////3////9/////f////3////9/////f////3////+P////3/zKBl/82k + a7DMoGX/yp5j/8qeYv/KnmL/yp5i/8qeYv/KnmL/yp5i/8qeYv/KnmL/yp5i/8qeYv/KnmP/zKBl/82k + a8X///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A//8AAP//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAA== + + + \ No newline at end of file diff --git a/NAPS2.Core/WinForms/FEmailSettings.Designer.cs b/NAPS2.Core/WinForms/FEmailSettings.Designer.cs index ec9c2b73a..34069ccd7 100644 --- a/NAPS2.Core/WinForms/FEmailSettings.Designer.cs +++ b/NAPS2.Core/WinForms/FEmailSettings.Designer.cs @@ -42,6 +42,11 @@ namespace NAPS2.WinForms this.txtAttachmentName = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.linkPlaceholders = new System.Windows.Forms.LinkLabel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lblUser = new System.Windows.Forms.Label(); + this.lblProvider = new System.Windows.Forms.Label(); + this.btnChangeProvider = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // btnOK @@ -88,10 +93,37 @@ namespace NAPS2.WinForms this.linkPlaceholders.TabStop = true; this.linkPlaceholders.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkPlaceholders_LinkClicked); // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lblUser); + this.groupBox1.Controls.Add(this.lblProvider); + this.groupBox1.Controls.Add(this.btnChangeProvider); + resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.TabStop = false; + // + // lblUser + // + resources.ApplyResources(this.lblUser, "lblUser"); + this.lblUser.Name = "lblUser"; + // + // lblProvider + // + resources.ApplyResources(this.lblProvider, "lblProvider"); + this.lblProvider.Name = "lblProvider"; + // + // btnChangeProvider + // + resources.ApplyResources(this.btnChangeProvider, "btnChangeProvider"); + this.btnChangeProvider.Name = "btnChangeProvider"; + this.btnChangeProvider.UseVisualStyleBackColor = true; + this.btnChangeProvider.Click += new System.EventHandler(this.btnChangeProvider_Click); + // // FEmailSettings // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox1); this.Controls.Add(this.linkPlaceholders); this.Controls.Add(this.txtAttachmentName); this.Controls.Add(this.label1); @@ -102,6 +134,8 @@ namespace NAPS2.WinForms this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FEmailSettings"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -117,5 +151,9 @@ namespace NAPS2.WinForms private System.Windows.Forms.TextBox txtAttachmentName; private System.Windows.Forms.Label label1; private System.Windows.Forms.LinkLabel linkPlaceholders; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button btnChangeProvider; + private System.Windows.Forms.Label lblProvider; + private System.Windows.Forms.Label lblUser; } } diff --git a/NAPS2.Core/WinForms/FEmailSettings.cs b/NAPS2.Core/WinForms/FEmailSettings.cs index 67f2a0ad1..50c91bf02 100644 --- a/NAPS2.Core/WinForms/FEmailSettings.cs +++ b/NAPS2.Core/WinForms/FEmailSettings.cs @@ -73,5 +73,12 @@ namespace NAPS2.WinForms txtAttachmentName.Text = form.FileName; } } + + private void btnChangeProvider_Click(object sender, EventArgs e) + { + var form = FormFactory.Create(); + // TODO: This should provide a result (though we might ignore it here except to update the UI) + form.ShowDialog(); + } } } diff --git a/NAPS2.Core/WinForms/FEmailSettings.resx b/NAPS2.Core/WinForms/FEmailSettings.resx index 0dde575c7..43cfe6f02 100644 --- a/NAPS2.Core/WinForms/FEmailSettings.resx +++ b/NAPS2.Core/WinForms/FEmailSettings.resx @@ -123,7 +123,7 @@ - 264, 89 + 264, 267 75, 23 @@ -145,13 +145,13 @@ $this - 6 + 7 NoControl - 345, 89 + 345, 267 75, 23 @@ -172,7 +172,7 @@ $this - 5 + 6 17, 17 @@ -181,7 +181,7 @@ True - 12, 68 + 12, 246 145, 17 @@ -202,13 +202,13 @@ $this - 4 + 5 True - 12, 89 + 12, 267 145, 23 @@ -229,10 +229,10 @@ $this - 3 + 4 - 12, 22 + 12, 200 396, 20 @@ -250,7 +250,7 @@ $this - 1 + 2 True @@ -259,7 +259,7 @@ NoControl - 12, 6 + 12, 184 95, 13 @@ -280,7 +280,7 @@ $this - 2 + 3 True @@ -289,7 +289,7 @@ NoControl - 12, 45 + 12, 223 68, 13 @@ -310,6 +310,105 @@ $this + 1 + + + True + + + 6, 35 + + + 0, 13 + + + 35 + + + lblUser + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + True + + + 6, 19 + + + 108, 13 + + + 34 + + + No provider selected. + + + lblProvider + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + 327, 19 + + + 75, 23 + + + 33 + + + Change + + + btnChangeProvider + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + 12, 12 + + + 408, 57 + + + 32 + + + Provider + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 0 @@ -319,7 +418,7 @@ 6, 13 - 432, 124 + 432, 302 @@ -346,7 +445,7 @@ - 800, 163 + 800, 500 400, 163 @@ -358,12 +457,12 @@ ilProfileIcons - NAPS2.WinForms.ILProfileIcons, NAPS2.Core, Version=4.4.1.24470, Culture=neutral, PublicKeyToken=null + NAPS2.WinForms.ILProfileIcons, NAPS2.Core, Version=5.8.2.20106, Culture=neutral, PublicKeyToken=null FEmailSettings - NAPS2.WinForms.FormBase, NAPS2.Core, Version=4.4.1.24470, Culture=neutral, PublicKeyToken=null + NAPS2.WinForms.FormBase, NAPS2.Core, Version=5.8.2.20106, Culture=neutral, PublicKeyToken=null \ No newline at end of file