-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSignatureInformationWidget.cs
76 lines (62 loc) · 2.33 KB
/
SignatureInformationWidget.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Linq;
using System.Collections.Generic;
using PublishGUI;
[System.ComponentModel.ToolboxItem(true)]
public partial class SignatureInformationWidget : Gtk.Bin
{
public SignatureType SignatureType { get { return (SignatureType)this.SignatureTypeComboBox.Active; } }
public string PgpKeyringLocation { get { return this.PgpSecretKeyRingLocationFileChooser.Filename; } }
public string PgpSecretKeyPassphrase { get { return this.PgpSecretKeyPassphraseTextBox.Text; } }
public string PgpSecretKeyUsername { get { return this.PgpSecKeyUsernameTextBox.Text; } }
public List<string> PgpPublicKeyLocations
{
get
{
try
{
string[] vals = PgpPublicKeyLocationsTextBox.Text.Split(',');
List<string> retVals = new List<string>();
foreach(var val in vals)
retVals.Add(val);
return retVals;
}
catch { return null; }
}
}
public SignatureInformationWidget ()
{
this.Build ();
this.Shown += UpdateSubcontainerVisibility;
}
protected void UpdateSubcontainerVisibility (object sender, System.EventArgs e)
{
PgpInfoContainer.Visible = this.SignatureTypeComboBox.Active == (int)PublishGUI.SignatureType.LR_PGP;
PgpInfoContainer.ChildVisible = this.SignatureTypeComboBox.Active == (int)PublishGUI.SignatureType.LR_PGP;
}
public void ResetFields()
{
this.SignatureTypeComboBox.Active = 0;
this.PgpPublicKeyLocationsTextBox.Text = String.Empty;
this.PgpSecKeyUsernameTextBox.Text = String.Empty;
this.PgpSecretKeyPassphraseTextBox.Text = String.Empty;
this.PgpSecretKeyRingLocationFileChooser.UnselectAll();
UpdateSubcontainerVisibility(this, null);
}
public List<Gtk.Label> GetMissingFields()
{
List<Gtk.Label> missingFields = new List<Gtk.Label>();
if(this.SignatureTypeComboBox.Active == (int)PublishGUI.SignatureType.LR_PGP)
{
if(String.IsNullOrEmpty(this.PgpSecretKeyRingLocationFileChooser.Filename))
missingFields.Add(this.lbl_PgpSecretKeyRingLocation);
if(String.IsNullOrEmpty(this.PgpSecKeyUsernameTextBox.Text))
missingFields.Add(this.lbl_PgpSecKeyUsername);
if(String.IsNullOrEmpty(this.PgpSecretKeyPassphraseTextBox.Text))
missingFields.Add(this.lbl_PgpSecretKeyPassphrase);
if(String.IsNullOrEmpty(this.PgpPublicKeyLocationsTextBox.Text))
missingFields.Add(this.lbl_PgpPublicKeyLocations);
}
return missingFields;
}
}