diff --git a/GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs b/GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs index 94c021bb9..eb786979d 100644 --- a/GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs +++ b/GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs @@ -46,17 +46,18 @@ namespace GreenshotJiraPlugin { /// private void InitializeComponent() { - this.buttonOK = new System.Windows.Forms.Button(); - this.buttonCancel = new System.Windows.Forms.Button(); - this.label_url = new System.Windows.Forms.Label(); - this.textBoxUrl = new System.Windows.Forms.TextBox(); - this.combobox_uploadimageformat = new System.Windows.Forms.ComboBox(); - this.label_upload_format = new System.Windows.Forms.Label(); + this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton(); + this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton(); + this.label_url = new GreenshotPlugin.Controls.GreenshotLabel(); + this.textBoxUrl = new GreenshotPlugin.Controls.GreenshotTextBox(); + this.combobox_uploadimageformat = new GreenshotPlugin.Controls.GreenshotComboBox(); + this.label_upload_format = new GreenshotPlugin.Controls.GreenshotLabel(); this.SuspendLayout(); // // buttonOK // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.LanguageKey = "OK"; this.buttonOK.Location = new System.Drawing.Point(222, 84); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); @@ -68,6 +69,7 @@ namespace GreenshotJiraPlugin { // buttonCancel // this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.LanguageKey = "CANCEL"; this.buttonCancel.Location = new System.Drawing.Point(303, 84); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); @@ -89,6 +91,8 @@ namespace GreenshotJiraPlugin { this.textBoxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.textBoxUrl.Location = new System.Drawing.Point(102, 21); this.textBoxUrl.Name = "textBoxUrl"; + this.textBoxUrl.PropertyName = "Url"; + this.textBoxUrl.SectionName = "Jira"; this.textBoxUrl.Size = new System.Drawing.Size(276, 20); this.textBoxUrl.TabIndex = 6; // @@ -98,6 +102,8 @@ namespace GreenshotJiraPlugin { this.combobox_uploadimageformat.FormattingEnabled = true; this.combobox_uploadimageformat.Location = new System.Drawing.Point(102, 47); this.combobox_uploadimageformat.Name = "combobox_uploadimageformat"; + this.combobox_uploadimageformat.PropertyName = "UploadFormat"; + this.combobox_uploadimageformat.SectionName = "Jira"; this.combobox_uploadimageformat.Size = new System.Drawing.Size(276, 21); this.combobox_uploadimageformat.TabIndex = 8; // @@ -120,18 +126,20 @@ namespace GreenshotJiraPlugin { this.Controls.Add(this.textBoxUrl); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonOK); + this.LanguageKey = "settings_title"; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SettingsForm"; this.Text = "Please enter your Jira data"; this.ResumeLayout(false); this.PerformLayout(); + } - private System.Windows.Forms.ComboBox combobox_uploadimageformat; - private System.Windows.Forms.Label label_upload_format; - private System.Windows.Forms.TextBox textBoxUrl; - private System.Windows.Forms.Label label_url; - private System.Windows.Forms.Button buttonCancel; - private System.Windows.Forms.Button buttonOK; + private GreenshotPlugin.Controls.GreenshotComboBox combobox_uploadimageformat; + private GreenshotPlugin.Controls.GreenshotLabel label_upload_format; + private GreenshotPlugin.Controls.GreenshotTextBox textBoxUrl; + private GreenshotPlugin.Controls.GreenshotLabel label_url; + private GreenshotPlugin.Controls.GreenshotButton buttonCancel; + private GreenshotPlugin.Controls.GreenshotButton buttonOK; } } diff --git a/GreenshotJiraPlugin/Forms/SettingsForm.cs b/GreenshotJiraPlugin/Forms/SettingsForm.cs index 0e4c9c83f..a4e60c06f 100644 --- a/GreenshotJiraPlugin/Forms/SettingsForm.cs +++ b/GreenshotJiraPlugin/Forms/SettingsForm.cs @@ -26,7 +26,7 @@ namespace GreenshotJiraPlugin { /// /// Description of PasswordRequestForm. /// - public partial class SettingsForm : Form { + public partial class SettingsForm : GreenshotPlugin.Controls.GreenshotForm { private ILanguage lang = Language.GetInstance(); public SettingsForm(JiraConfiguration config) { @@ -35,32 +35,8 @@ namespace GreenshotJiraPlugin { // InitializeComponent(); this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); - InitializeTexts(); - - combobox_uploadimageformat.Items.Clear(); - foreach(OutputFormat format in Enum.GetValues(typeof(OutputFormat))) { - combobox_uploadimageformat.Items.Add(format.ToString()); - } } - private void InitializeTexts() { - this.label_url.Text = lang.GetString(LangKey.label_url); - this.buttonOK.Text = lang.GetString(LangKey.OK); - this.buttonCancel.Text = lang.GetString(LangKey.CANCEL); - this.Text = lang.GetString(LangKey.settings_title); - this.label_upload_format.Text = lang.GetString(LangKey.label_upload_format); - } - - public string Url { - get {return textBoxUrl.Text;} - set {textBoxUrl.Text = value;} - } - - public string UploadFormat { - get {return combobox_uploadimageformat.Text;} - set {combobox_uploadimageformat.Text = value;} - } - void ButtonOKClick(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; } diff --git a/GreenshotJiraPlugin/JiraConfiguration.cs b/GreenshotJiraPlugin/JiraConfiguration.cs index e9ec0b973..6ee61a00f 100644 --- a/GreenshotJiraPlugin/JiraConfiguration.cs +++ b/GreenshotJiraPlugin/JiraConfiguration.cs @@ -54,15 +54,8 @@ namespace GreenshotJiraPlugin { /// bool true if OK was pressed, false if cancel public bool ShowConfigDialog() { SettingsForm settingsForm = new SettingsForm(this); - settingsForm.Url = Url; - settingsForm.UploadFormat = UploadFormat.ToString(); DialogResult result = settingsForm.ShowDialog(); if (result == DialogResult.OK) { - if (!settingsForm.Url.Equals(Url) || !settingsForm.UploadFormat.Equals(UploadFormat.ToString())) { - Url = settingsForm.Url; - UploadFormat = (OutputFormat)Enum.Parse(typeof(OutputFormat), settingsForm.UploadFormat.ToLower()); - } - IniConfig.Save(); return true; } return false; diff --git a/GreenshotJiraPlugin/JiraPlugin.cs b/GreenshotJiraPlugin/JiraPlugin.cs index 019e1ae2a..54e8fdf23 100644 --- a/GreenshotJiraPlugin/JiraPlugin.cs +++ b/GreenshotJiraPlugin/JiraPlugin.cs @@ -119,7 +119,15 @@ namespace GreenshotJiraPlugin { /// Implementation of the IPlugin.Configure /// public virtual void Configure() { + string url = config.Url; config.ShowConfigDialog(); + // check for re-login + if (jiraConnector.isLoggedIn && !string.IsNullOrEmpty(url)) { + if (!url.Equals(config.Url)) { + jiraConnector.logout(); + jiraConnector.login(); + } + } } ///