Fixed issue #78.
There are a little translation changes as well. git-svn-id: https://duplicati.googlecode.com/svn/trunk@192 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
+10
-27
@@ -28,6 +28,7 @@ namespace Duplicati.GUI.Wizard_pages.Add_backup
|
||||
/// </summary>
|
||||
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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Duplicati.GUI.Wizard_pages
|
||||
}
|
||||
else
|
||||
{
|
||||
wrapper.SetupDefaults();
|
||||
args.NextPage = new Add_backup.PasswordSettings();
|
||||
wrapper.PrimayAction = WizardSettingsWrapper.MainAction.RestoreSetup;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The purpose of this function is to set the default
|
||||
/// settings on the new backup.
|
||||
/// </summary>
|
||||
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<System.Xml.XmlNode> nodes = new List<System.Xml.XmlNode>();
|
||||
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The purpose of this function is to set the default
|
||||
/// settings on the new backup.
|
||||
/// </summary>
|
||||
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<System.Xml.XmlNode> nodes = new List<System.Xml.XmlNode>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all settings, and makes the setting object reflect the schedule
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user