FEATURE-731: reducing some of the logic, the upload form automatically takes the most recent.

This commit is contained in:
Robin 2016-09-03 23:42:04 +02:00
commit 099813b5b6
4 changed files with 9 additions and 15 deletions

View file

@ -27,9 +27,8 @@ using Greenshot.IniFile;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Dapplo.Jira;
namespace GreenshotJiraPlugin.Forms {
public partial class JiraForm : Form {
@ -84,14 +83,11 @@ namespace GreenshotJiraPlugin.Forms {
jiraFilterBox.SelectedIndex = 0;
}
ChangeModus(true);
if (JiraConfig.LastUsedJira != null)
if (_jiraConnector.Monitor.RecentJiras.Any())
{
_selectedIssue = await _jiraConnector.GetIssueAsync(JiraConfig.LastUsedJira);
if (_selectedIssue != null)
{
jiraKey.Text = JiraConfig.LastUsedJira;
uploadButton.Enabled = true;
}
_selectedIssue = _jiraConnector.Monitor.RecentJiras.First().JiraIssue;
jiraKey.Text = _selectedIssue.Key;
uploadButton.Enabled = true;
}
}
}
@ -118,7 +114,6 @@ namespace GreenshotJiraPlugin.Forms {
}
public async Task UploadAsync(IBinaryContainer attachment) {
JiraConfig.LastUsedJira = _selectedIssue.Key;
attachment.Filename = jiraFilenameBox.Text;
await _jiraConnector.AttachAsync(_selectedIssue.Key, attachment);

View file

@ -39,7 +39,7 @@ namespace GreenshotJiraPlugin
{
_jiraApi = jiraApi;
// Set the expire timeout to an hour
ExpireTimeSpan = TimeSpan.FromHours(1);
ExpireTimeSpan = TimeSpan.FromHours(4);
}
protected override string CreateKey(IssueType keyObject)

View file

@ -37,13 +37,12 @@ namespace GreenshotJiraPlugin {
[IniProperty("Timeout", Description="Session timeout in minutes", DefaultValue="30")]
public int Timeout { get; set; }
[IniProperty("LastUsedJira", Description="Last used Jira")]
public string LastUsedJira { get; set; }
[IniProperty("UploadFormat", Description="What file type to use for uploading", DefaultValue="png")]
public OutputFormat UploadFormat { get; set; }
[IniProperty("UploadJpegQuality", Description="JPEG file save quality in %.", DefaultValue="80")]
public int UploadJpegQuality { get; set; }
[IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")]
public bool UploadReduceColors { get; set; }
}

View file

@ -196,7 +196,7 @@ namespace GreenshotJiraPlugin
return;
}
// We detected an unknown JIRA, so add it to our list
currentJiraDetails = new JiraDetails()
currentJiraDetails = new JiraDetails
{
Id = jiraId,
ProjectKey = projectKey