~ubuntu-branches/ubuntu/trusty/keepass2/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/use-installed-ico-files.patch/KeePass/Forms/EditStringForm.cs

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2011-12-30 15:45:59 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20111230154559-3en1b9v90hswvs1w
Tags: 2.18+dfsg-1
* New upstream release
  - refresh patches
  - drop upstream applied patches:
    explicitly-PUT-for-webdav-writes.patch
    prefer-4.0-framework-if-available.patch
* add patch to improve autotype when dealing with multiple keyboard layouts
  - Thanks to amiryal for the patch
* disable initial autoupdate popup via patch
* update years in debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
  KeePass Password Safe - The Open-Source Password Manager
3
 
  Copyright (C) 2003-2011 Dominik Reichl <dominik.reichl@t-online.de>
 
3
  Copyright (C) 2003-2012 Dominik Reichl <dominik.reichl@t-online.de>
4
4
 
5
5
  This program is free software; you can redistribute it and/or modify
6
6
  it under the terms of the GNU General Public License as published by
41
41
        {
42
42
                private ProtectedStringDictionary m_vStringDict = null;
43
43
                private string m_strStringName = null;
44
 
                private ProtectedString m_psStringValue = null;
45
 
                private Color m_clrNormalBackground;
 
44
                private ProtectedString m_psStringInitialValue = null;
46
45
                private RichTextBoxContextMenu m_ctxValue = new RichTextBoxContextMenu();
47
46
                private PwDatabase m_pwContext = null;
48
47
 
59
58
                /// </summary>
60
59
                /// <param name="vStringDict">String container. Must not be <c>null</c>.</param>
61
60
                /// <param name="strStringName">Initial name of the string. May be <c>null</c>.</param>
62
 
                /// <param name="psStringValue">Initial value. May be <c>null</c>.</param>
 
61
                /// <param name="psStringInitialValue">Initial value. May be <c>null</c>.</param>
63
62
                public void InitEx(ProtectedStringDictionary vStringDict, string strStringName,
64
 
                        ProtectedString psStringValue, PwDatabase pwContext)
 
63
                        ProtectedString psStringInitialValue, PwDatabase pwContext)
65
64
                {
66
65
                        Debug.Assert(vStringDict != null); if(vStringDict == null) throw new ArgumentNullException("vStringDict");
67
66
                        m_vStringDict = vStringDict;
68
67
 
69
68
                        m_strStringName = strStringName;
70
 
                        m_psStringValue = psStringValue;
 
69
                        m_psStringInitialValue = psStringInitialValue;
71
70
 
72
71
                        m_pwContext = pwContext;
73
72
                }
78
77
 
79
78
                        GlobalWindowManager.AddWindow(this);
80
79
 
81
 
                        m_ctxValue.Attach(m_richStringValue);
 
80
                        m_ctxValue.Attach(m_richStringValue, this);
82
81
 
83
82
                        string strTitle, strDesc;
84
83
                        if(m_strStringName == null)
96
95
                                Properties.Resources.B48x48_Font, strTitle, strDesc);
97
96
                        this.Icon = Properties.Resources.KeePass;
98
97
 
99
 
                        m_clrNormalBackground = m_cmbStringName.BackColor;
100
 
 
101
98
                        UIUtil.EnableAutoCompletion(m_cmbStringName, true);
102
99
                        UIUtil.PrepareStandardMultilineControl(m_richStringValue, true, true);
103
100
 
104
101
                        if(m_strStringName != null) m_cmbStringName.Text = m_strStringName;
105
 
                        if(m_psStringValue != null)
 
102
                        if(m_psStringInitialValue != null)
106
103
                        {
107
 
                                m_richStringValue.Text = m_psStringValue.ReadString();
108
 
                                m_cbProtect.Checked = m_psStringValue.IsProtected;
 
104
                                m_richStringValue.Text = m_psStringInitialValue.ReadString();
 
105
                                m_cbProtect.Checked = m_psStringInitialValue.IsProtected;
109
106
                        }
110
107
 
111
108
                        ValidateStringName();
147
144
                        else if(str.Length <= 0)
148
145
                        {
149
146
                                m_lblValidationInfo.Text = KPRes.FieldNamePrompt;
150
 
                                m_cmbStringName.BackColor = m_clrNormalBackground;
 
147
                                m_cmbStringName.ResetBackColor();
151
148
                                m_btnOK.Enabled = false;
152
149
                                return false;
153
150
 
169
166
                        else
170
167
                        {
171
168
                                m_lblValidationInfo.Text = string.Empty;
172
 
                                m_cmbStringName.BackColor = m_clrNormalBackground;
 
169
                                m_cmbStringName.ResetBackColor();
173
170
                                m_btnOK.Enabled = true;
174
171
                        }
175
172
                        // See ValidateStringNameEx
196
193
                        }
197
194
                        else // Edit string field
198
195
                        {
199
 
                                if(m_strStringName.Equals(strName))
200
 
                                {
201
 
                                        if(m_psStringValue != null)
202
 
                                        {
203
 
                                                m_psStringValue.SetString(m_richStringValue.Text);
204
 
                                                m_psStringValue.EnableProtection(m_cbProtect.Checked);
205
 
                                        }
206
 
                                        else
207
 
                                        {
208
 
                                                ProtectedString ps = new ProtectedString(m_cbProtect.Checked, m_richStringValue.Text);
209
 
                                                m_vStringDict.Set(strName, ps);
210
 
                                        }
211
 
                                }
212
 
                                else
213
 
                                {
 
196
                                if(!m_strStringName.Equals(strName))
214
197
                                        m_vStringDict.Remove(m_strStringName);
215
198
 
216
 
                                        ProtectedString ps = new ProtectedString(m_cbProtect.Checked, m_richStringValue.Text);
217
 
                                        m_vStringDict.Set(strName, ps);
218
 
                                }
 
199
                                ProtectedString ps = new ProtectedString(m_cbProtect.Checked,
 
200
                                        m_richStringValue.Text);
 
201
                                m_vStringDict.Set(strName, ps);
219
202
                        }
220
203
                }
221
204