diff --git a/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.Designer.cs b/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.Designer.cs index 9375177e4..e4fd7251d 100644 --- a/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.Designer.cs +++ b/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.Designer.cs @@ -28,6 +28,7 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GeneratedFilenameOptions)); this.label1 = new System.Windows.Forms.Label(); this.FilePrefixEnabled = new System.Windows.Forms.CheckBox(); this.UseShortFilenames = new System.Windows.Forms.CheckBox(); @@ -37,54 +38,36 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(40, 24); + resources.ApplyResources(this.label1, "label1"); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(92, 13); - this.label1.TabIndex = 0; - this.label1.Text = "File time seperator"; // // FilePrefixEnabled // - this.FilePrefixEnabled.AutoSize = true; - this.FilePrefixEnabled.Location = new System.Drawing.Point(24, 56); + resources.ApplyResources(this.FilePrefixEnabled, "FilePrefixEnabled"); this.FilePrefixEnabled.Name = "FilePrefixEnabled"; - this.FilePrefixEnabled.Size = new System.Drawing.Size(133, 17); - this.FilePrefixEnabled.TabIndex = 1; - this.FilePrefixEnabled.Text = "Change filename prefix"; this.FilePrefixEnabled.UseVisualStyleBackColor = true; this.FilePrefixEnabled.CheckedChanged += new System.EventHandler(this.FilePrefixEnabled_CheckedChanged); // // UseShortFilenames // - this.UseShortFilenames.AutoSize = true; - this.UseShortFilenames.Location = new System.Drawing.Point(24, 88); + resources.ApplyResources(this.UseShortFilenames, "UseShortFilenames"); this.UseShortFilenames.Name = "UseShortFilenames"; - this.UseShortFilenames.Size = new System.Drawing.Size(118, 17); - this.UseShortFilenames.TabIndex = 2; - this.UseShortFilenames.Text = "Use short filenames"; this.UseShortFilenames.UseVisualStyleBackColor = true; // // FilePrefix // - this.FilePrefix.Enabled = false; - this.FilePrefix.Location = new System.Drawing.Point(168, 56); + resources.ApplyResources(this.FilePrefix, "FilePrefix"); this.FilePrefix.Name = "FilePrefix"; - this.FilePrefix.Size = new System.Drawing.Size(128, 20); - this.FilePrefix.TabIndex = 3; // // FileTimeSeperator // - this.FileTimeSeperator.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + resources.ApplyResources(this.FileTimeSeperator, "FileTimeSeperator"); this.FileTimeSeperator.FormattingEnabled = true; this.FileTimeSeperator.Items.AddRange(new object[] { - "\'", - ":", - "_"}); - this.FileTimeSeperator.Location = new System.Drawing.Point(168, 24); + resources.GetString("FileTimeSeperator.Items"), + resources.GetString("FileTimeSeperator.Items1"), + resources.GetString("FileTimeSeperator.Items2")}); this.FileTimeSeperator.Name = "FileTimeSeperator"; - this.FileTimeSeperator.Size = new System.Drawing.Size(56, 22); - this.FileTimeSeperator.TabIndex = 4; // // GeneratedFilenameOptions // @@ -94,7 +77,7 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup this.Controls.Add(this.FilePrefixEnabled); this.Controls.Add(this.label1); this.Name = "GeneratedFilenameOptions"; - this.Size = new System.Drawing.Size(506, 242); + resources.ApplyResources(this, "$this"); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.cs b/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.cs index 8fdf5f5a1..4213578a3 100644 --- a/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.cs +++ b/Duplicati/GUI/Wizard pages/Add backup/GeneratedFilenameOptions.cs @@ -32,7 +32,7 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup private WizardSettingsWrapper m_wrapper; public GeneratedFilenameOptions() - : base("Generated filenames", "On this page you can control how filenames are generated. This can be used if the remote server does not support the default filenames.") + : base(Strings.GeneratedFilenameOptions.PageTitle, Strings.GeneratedFilenameOptions.PageDescription) { InitializeComponent(); @@ -49,7 +49,9 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup m_wrapper.FilePrefix = FilePrefixEnabled.Checked ? "" : FilePrefix.Text; m_wrapper.ShortFilenames = UseShortFilenames.Checked; - if ((bool)m_settings["Advanced:Overrides"]) + if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) + args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + else if ((bool)m_settings["Advanced:Overrides"]) args.NextPage = new Wizard_pages.Add_backup.SettingOverrides(); else args.NextPage = new Wizard_pages.Add_backup.FinishedAdd(); @@ -75,5 +77,5 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup FilePrefix.Enabled = FilePrefixEnabled.Checked; } } -} - +} + diff --git a/Duplicati/GUI/Wizard pages/Backends/FTP/FTPOptions.cs b/Duplicati/GUI/Wizard pages/Backends/FTP/FTPOptions.cs index be068e13b..21f5d6e41 100644 --- a/Duplicati/GUI/Wizard pages/Backends/FTP/FTPOptions.cs +++ b/Duplicati/GUI/Wizard pages/Backends/FTP/FTPOptions.cs @@ -88,7 +88,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.FTP m_wrapper.Passive = PassiveConnection.Checked; if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) - args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + args.NextPage = new Add_backup.GeneratedFilenameOptions(); else args.NextPage = new Add_backup.AdvancedOptions(); } diff --git a/Duplicati/GUI/Wizard pages/Backends/File/FileOptions.cs b/Duplicati/GUI/Wizard pages/Backends/File/FileOptions.cs index bad06e48a..f79bc94c7 100644 --- a/Duplicati/GUI/Wizard pages/Backends/File/FileOptions.cs +++ b/Duplicati/GUI/Wizard pages/Backends/File/FileOptions.cs @@ -124,7 +124,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.File } if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) - args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + args.NextPage = new Add_backup.GeneratedFilenameOptions(); else args.NextPage = new Add_backup.AdvancedOptions(); } diff --git a/Duplicati/GUI/Wizard pages/Backends/S3/S3Options.cs b/Duplicati/GUI/Wizard pages/Backends/S3/S3Options.cs index b5b3d272a..0b5fc105b 100644 --- a/Duplicati/GUI/Wizard pages/Backends/S3/S3Options.cs +++ b/Duplicati/GUI/Wizard pages/Backends/S3/S3Options.cs @@ -88,7 +88,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.S3 m_wrapper.UseSubDomains = bucketname.ToLower() == bucketname; if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) - args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + args.NextPage = new Add_backup.GeneratedFilenameOptions(); else args.NextPage = new Add_backup.AdvancedOptions(); } diff --git a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs index afa1aced3..4a8302dc2 100644 --- a/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs +++ b/Duplicati/GUI/Wizard pages/Backends/SSH/SSHOptions.cs @@ -81,7 +81,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.SSH m_wrapper.Username = Username.Text; if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) - args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + args.NextPage = new Add_backup.GeneratedFilenameOptions(); else args.NextPage = new Add_backup.AdvancedOptions(); } diff --git a/Duplicati/GUI/Wizard pages/Backends/WebDAV/WebDAVOptions.cs b/Duplicati/GUI/Wizard pages/Backends/WebDAV/WebDAVOptions.cs index 7c42856a2..337f38d5b 100644 --- a/Duplicati/GUI/Wizard pages/Backends/WebDAV/WebDAVOptions.cs +++ b/Duplicati/GUI/Wizard pages/Backends/WebDAV/WebDAVOptions.cs @@ -97,7 +97,7 @@ namespace Duplicati.GUI.Wizard_pages.Backends.WebDAV m_wrapper.ForceDigestAuthentication = DigestAuth.Checked; if (new WizardSettingsWrapper(m_settings).PrimayAction == WizardSettingsWrapper.MainAction.RestoreSetup) - args.NextPage = new RestoreSetup.FinishedRestoreSetup(); + args.NextPage = new Add_backup.GeneratedFilenameOptions(); else args.NextPage = new Add_backup.AdvancedOptions(); diff --git a/Duplicati/GUI/Wizard pages/FirstLaunch.cs b/Duplicati/GUI/Wizard pages/FirstLaunch.cs index 7ba799ee0..a0a914726 100644 --- a/Duplicati/GUI/Wizard pages/FirstLaunch.cs +++ b/Duplicati/GUI/Wizard pages/FirstLaunch.cs @@ -63,6 +63,7 @@ namespace Duplicati.GUI.Wizard_pages } else { + wrapper.SetupDefaults(); args.NextPage = new Add_backup.PasswordSettings(); wrapper.PrimayAction = WizardSettingsWrapper.MainAction.RestoreSetup; } diff --git a/Duplicati/GUI/Wizard pages/MainPage.cs b/Duplicati/GUI/Wizard pages/MainPage.cs index 0c7265f08..203ab7bcd 100644 --- a/Duplicati/GUI/Wizard pages/MainPage.cs +++ b/Duplicati/GUI/Wizard pages/MainPage.cs @@ -84,7 +84,7 @@ namespace Duplicati.GUI.Wizard_pages if (m_wrapper.PrimayAction == WizardSettingsWrapper.MainAction.Add) { args.NextPage = new Add_backup.SelectName(); - SetupDefaults(); + m_wrapper.SetupDefaults(); m_wrapper.PrimayAction = WizardSettingsWrapper.MainAction.Add; } else @@ -102,56 +102,6 @@ namespace Duplicati.GUI.Wizard_pages UpdateButtonState(); } - /// - /// The purpose of this function is to set the default - /// settings on the new backup. - /// - private void SetupDefaults() - { - m_settings.Clear(); - - ApplicationSettings appset = new ApplicationSettings(Program.DataConnection); - if (appset.UseCommonPassword) - { - m_wrapper.BackupPassword = appset.CommonPassword; - m_wrapper.GPGEncryption = appset.CommonPasswordUseGPG; - } - - System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); - doc.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Program), "Backup defaults.xml")); - - System.Xml.XmlNode root = doc.SelectSingleNode("settings"); - - List nodes = new List(); - - if (root != null) - foreach(System.Xml.XmlNode n in root.ChildNodes) - nodes.Add(n); - - //Load user supplied settings - string filename = System.IO.Path.Combine(Application.StartupPath, "Backup defaults.xml"); - if (System.IO.File.Exists(filename)) - { - doc.Load(filename); - root = doc.SelectSingleNode("settings"); - if (root != null) - foreach (System.Xml.XmlNode n in root.ChildNodes) - nodes.Add(n); - } - - foreach(System.Xml.XmlNode n in nodes) - if (n.NodeType == System.Xml.XmlNodeType.Element) - { - System.Reflection.PropertyInfo pi = m_wrapper.GetType().GetProperty(n.Name); - if (pi != null && pi.CanWrite) - if (pi.PropertyType == typeof(DateTime)) - pi.SetValue(m_wrapper,Library.Core.Timeparser.ParseTimeInterval(n.InnerText, DateTime.Now.Date), null); - else - pi.SetValue(m_wrapper, Convert.ChangeType(n.InnerText, pi.PropertyType), null); - } - - } - private void RadioButton_DoubleClick(object sender, EventArgs e) { m_owner.NextButton.PerformClick(); diff --git a/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs b/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs index 439a495f2..0c1613399 100644 --- a/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs +++ b/Duplicati/GUI/Wizard pages/WizardSettingsWrapper.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Text; +using Duplicati.Datamodel; namespace Duplicati.GUI.Wizard_pages { @@ -57,6 +58,57 @@ namespace Duplicati.GUI.Wizard_pages m_settings = settings; } + + /// + /// The purpose of this function is to set the default + /// settings on the new backup. + /// + public void SetupDefaults() + { + m_settings.Clear(); + + ApplicationSettings appset = new ApplicationSettings(Program.DataConnection); + if (appset.UseCommonPassword) + { + this.BackupPassword = appset.CommonPassword; + this.GPGEncryption = appset.CommonPasswordUseGPG; + } + + System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); + doc.Load(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Program), "Backup defaults.xml")); + + System.Xml.XmlNode root = doc.SelectSingleNode("settings"); + + List nodes = new List(); + + if (root != null) + foreach (System.Xml.XmlNode n in root.ChildNodes) + nodes.Add(n); + + //Load user supplied settings, if any + string filename = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "Backup defaults.xml"); + if (System.IO.File.Exists(filename)) + { + doc.Load(filename); + root = doc.SelectSingleNode("settings"); + if (root != null) + foreach (System.Xml.XmlNode n in root.ChildNodes) + nodes.Add(n); + } + + foreach (System.Xml.XmlNode n in nodes) + if (n.NodeType == System.Xml.XmlNodeType.Element) + { + System.Reflection.PropertyInfo pi = this.GetType().GetProperty(n.Name); + if (pi != null && pi.CanWrite) + if (pi.PropertyType == typeof(DateTime)) + pi.SetValue(this, Library.Core.Timeparser.ParseTimeInterval(n.InnerText, DateTime.Now.Date), null); + else + pi.SetValue(this, Convert.ChangeType(n.InnerText, pi.PropertyType), null); + } + + } + /// /// Clears all settings, and makes the setting object reflect the schedule ///