mirror of
https://github.com/greenshot/greenshot
synced 2025-08-13 18:27:03 -07:00
Fixed problem when changing the URL, also changed the SettingsForm to use Greenshot controls for binding language & settings.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1772 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
84947c8b6e
commit
6dfc75a492
4 changed files with 29 additions and 44 deletions
32
GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs
generated
32
GreenshotJiraPlugin/Forms/SettingsForm.Designer.cs
generated
|
@ -46,17 +46,18 @@ namespace GreenshotJiraPlugin {
|
|||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace GreenshotJiraPlugin {
|
|||
/// <summary>
|
||||
/// Description of PasswordRequestForm.
|
||||
/// </summary>
|
||||
public partial class SettingsForm : Form {
|
||||
public partial class SettingsForm : GreenshotPlugin.Controls.GreenshotForm {
|
||||
private ILanguage lang = Language.GetInstance();
|
||||
|
||||
public SettingsForm(JiraConfiguration config) {
|
||||
|
@ -35,30 +35,6 @@ 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) {
|
||||
|
|
|
@ -54,15 +54,8 @@ namespace GreenshotJiraPlugin {
|
|||
/// <returns>bool true if OK was pressed, false if cancel</returns>
|
||||
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;
|
||||
|
|
|
@ -119,7 +119,15 @@ namespace GreenshotJiraPlugin {
|
|||
/// Implementation of the IPlugin.Configure
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue