private void InitPlaceholdersBox()
        {
            const string VkcBreak = @"<break />";

            string[] vSpecialKeyCodes = new string[] {
                "TAB", "ENTER", "UP", "DOWN", "LEFT", "RIGHT",
                "HOME", "END", "PGUP", "PGDN",
                "INSERT", "DELETE", VkcBreak,
                "BACKSPACE", "BREAK", "CAPSLOCK",
                "ESC", "HELP", "NUMLOCK", "PRTSC", "SCROLLLOCK", VkcBreak,
                "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
                "F13", "F14", "F15", "F16", VkcBreak,
                "ADD", "SUBTRACT", "MULTIPLY", "DIVIDE"
            };

            string[] vSpecialPlaceholders = new string[] {
                "GROUP", "GROUPPATH", "PASSWORD_ENC",
                "URL:RMVSCM", "URL:SCM", "URL:HOST", "URL:PORT", "URL:PATH",
                "URL:QUERY",
                "C:Comment", VkcBreak,
                "DELAY 1000", "DELAY=200", "VKEY 65",
                "PICKCHARS", "PICKCHARS:Password:C=3",
                "NEWPASSWORD", "HMACOTP", "CLEARFIELD", VkcBreak,
                "APPDIR", "DB_PATH", "DB_DIR", "DB_NAME", "DB_BASENAME", "DB_EXT",
                "ENV_DIRSEP", VkcBreak,
                "DT_SIMPLE", "DT_YEAR", "DT_MONTH", "DT_DAY", "DT_HOUR", "DT_MINUTE",
                "DT_SECOND", "DT_UTC_SIMPLE", "DT_UTC_YEAR", "DT_UTC_MONTH",
                "DT_UTC_DAY", "DT_UTC_HOUR", "DT_UTC_MINUTE", "DT_UTC_SECOND"
            };

            RichTextBuilder rb = new RichTextBuilder();
            rb.AppendLine(KPRes.StandardFields, FontStyle.Bold, null, null, ":", null);

            rb.Append("{" + PwDefs.TitleField + "} ");
            rb.Append("{" + PwDefs.UserNameField + "} ");
            rb.Append("{" + PwDefs.PasswordField + "} ");
            rb.Append("{" + PwDefs.UrlField + "} ");
            rb.Append("{" + PwDefs.NotesField + "}");

            bool bCustomInitialized = false, bFirst = true;
            foreach(KeyValuePair<string, ProtectedString> kvp in m_vStringDict)
            {
                if(!PwDefs.IsStandardField(kvp.Key))
                {
                    if(bCustomInitialized == false)
                    {
                        rb.AppendLine();
                        rb.AppendLine();
                        rb.AppendLine(KPRes.CustomFields, FontStyle.Bold, null, null, ":", null);
                        bCustomInitialized = true;
                    }

                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + PwDefs.AutoTypeStringPrefix + kvp.Key + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.KeyboardKeyModifiers, FontStyle.Bold, null, null, ":", null);
            rb.Append(KPRes.KeyboardKeyShift + @": +, ");
            rb.Append(KPRes.KeyboardKeyCtrl + @": ^, ");
            rb.Append(KPRes.KeyboardKeyAlt + @": %");

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.SpecialKeys, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strNav in vSpecialKeyCodes)
            {
                if(strNav == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strNav + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.OtherPlaceholders, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strPH in vSpecialPlaceholders)
            {
                if(strPH == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strPH + "}");
                    bFirst = false;
                }
            }

            rb.Build(m_rtbPlaceholders);

            LinkifyRtf(m_rtbPlaceholders);
        }
Пример #2
0
		private void ShowEntryDetails(PwEntry pe)
		{
			if(pe == null)
			{
				m_richEntryView.Text = string.Empty;
				return;
			}

			RichTextBuilder rb = new RichTextBuilder();

			AceFont af = Program.Config.UI.StandardFont;
			Font fontUI = (UISystemFonts.ListFont ?? m_lvEntries.Font);
			// string strFontFace = (af.OverrideUIDefault ? af.Family : fontUI.Name);
			// float fFontSize = (af.OverrideUIDefault ? af.ToFont().SizeInPoints : fontUI.SizeInPoints);
			if(af.OverrideUIDefault) rb.DefaultFont = af.ToFont();
			else rb.DefaultFont = fontUI;

			string strItemSeparator = ((m_splitHorizontal.Orientation == Orientation.Horizontal) ?
				", " : Environment.NewLine);

			// StringBuilder sb = new StringBuilder();
			// StrUtil.InitRtf(sb, strFontFace, fFontSize);

			rb.Append(KPRes.Group, FontStyle.Bold, null, null, ":", " ");
			int nGroupUrlStart = KPRes.Group.Length + 2;
			PwGroup pg = pe.ParentGroup;
			if(pg != null) rb.Append(pg.Name);

			AceMainWindow mw = Program.Config.MainWindow;
			EvAppendEntryField(rb, strItemSeparator, KPRes.Title,
				mw.IsColumnHidden(AceColumnType.Title) ? PwDefs.HiddenPassword :
				pe.Strings.ReadSafe(PwDefs.TitleField), pe);
			EvAppendEntryField(rb, strItemSeparator, KPRes.UserName,
				mw.IsColumnHidden(AceColumnType.UserName) ? PwDefs.HiddenPassword :
				pe.Strings.ReadSafe(PwDefs.UserNameField), pe);
			EvAppendEntryField(rb, strItemSeparator, KPRes.Password,
				mw.IsColumnHidden(AceColumnType.Password) ? PwDefs.HiddenPassword :
				pe.Strings.ReadSafe(PwDefs.PasswordField), pe);
			EvAppendEntryField(rb, strItemSeparator, KPRes.Url,
				mw.IsColumnHidden(AceColumnType.Url) ? PwDefs.HiddenPassword :
				pe.Strings.ReadSafe(PwDefs.UrlField), pe);

			foreach(KeyValuePair<string, ProtectedString> kvp in pe.Strings)
			{
				if(PwDefs.IsStandardField(kvp.Key)) continue;

				string strCustomValue = (mw.ShouldHideCustomString(kvp.Key,
					kvp.Value) ? PwDefs.HiddenPassword : kvp.Value.ReadString());
				EvAppendEntryField(rb, strItemSeparator, kvp.Key, strCustomValue, pe);
			}

			EvAppendEntryField(rb, strItemSeparator, KPRes.CreationTime,
				TimeUtil.ToDisplayString(pe.CreationTime), null);
			EvAppendEntryField(rb, strItemSeparator, KPRes.LastModificationTime,
				TimeUtil.ToDisplayString(pe.LastModificationTime), null);

			if((Program.Config.UI.UIFlags & (ulong)AceUIFlags.ShowLastAccessTime) != 0)
				EvAppendEntryField(rb, strItemSeparator, KPRes.LastAccessTime,
					TimeUtil.ToDisplayString(pe.LastAccessTime), null);

			if(pe.Expires)
				EvAppendEntryField(rb, strItemSeparator, KPRes.ExpiryTime,
					TimeUtil.ToDisplayString(pe.ExpiryTime), null);

			if(pe.Binaries.UCount > 0)
				EvAppendEntryField(rb, strItemSeparator, KPRes.Attachments,
					pe.Binaries.KeysToString(), null);

			EvAppendEntryField(rb, strItemSeparator, KPRes.UrlOverride,
				pe.OverrideUrl, pe);
			EvAppendEntryField(rb, strItemSeparator, KPRes.Tags,
				StrUtil.TagsToString(pe.Tags, true), null);

			string strNotes = (mw.IsColumnHidden(AceColumnType.Notes) ?
				PwDefs.HiddenPassword : pe.Strings.ReadSafe(PwDefs.NotesField));
			if(strNotes.Length != 0)
			{
				rb.AppendLine();
				rb.AppendLine();

				KeyValuePair<string, string> kvpBold = RichTextBuilder.GetStyleIdCodes(
					FontStyle.Bold);
				KeyValuePair<string, string> kvpItalic = RichTextBuilder.GetStyleIdCodes(
					FontStyle.Italic);
				KeyValuePair<string, string> kvpUnderline = RichTextBuilder.GetStyleIdCodes(
					FontStyle.Underline);

				strNotes = strNotes.Replace(@"<b>", kvpBold.Key);
				strNotes = strNotes.Replace(@"</b>", kvpBold.Value);
				strNotes = strNotes.Replace(@"<i>", kvpItalic.Key);
				strNotes = strNotes.Replace(@"</i>", kvpItalic.Value);
				strNotes = strNotes.Replace(@"<u>", kvpUnderline.Key);
				strNotes = strNotes.Replace(@"</u>", kvpUnderline.Value);

				rb.Append(strNotes);
			}

			// sb.Append("\\pard }");
			// m_richEntryView.Rtf = sb.ToString();
			rb.Build(m_richEntryView);

			UIUtil.RtfLinkifyReferences(m_richEntryView, false);

			Debug.Assert(m_richEntryView.HideSelection); // Flicker otherwise
			if(pg != null)
			{
				m_richEntryView.Select(nGroupUrlStart, pg.Name.Length);
				UIUtil.RtfSetSelectionLink(m_richEntryView);
			}

			// Linkify the URL
			string strUrl = SprEngine.Compile(pe.Strings.ReadSafe(PwDefs.UrlField),
				GetEntryListSprContext(pe, m_docMgr.SafeFindContainerOf(pe)));
			if(strUrl != PwDefs.HiddenPassword)
				UIUtil.RtfLinkifyText(m_richEntryView, strUrl, false);

			// Linkify the attachments
			foreach(KeyValuePair<string, ProtectedBinary> kvpBin in pe.Binaries)
				UIUtil.RtfLinkifyText(m_richEntryView, kvpBin.Key, false);

			m_richEntryView.Select(0, 0);
		}
Пример #3
0
		private void EvAppendEntryField(RichTextBuilder rb,
			string strItemSeparator, string strName, string strValue,
			PwEntry peSprCompile)
		{
			if(string.IsNullOrEmpty(strValue)) return;

			rb.Append(strName, FontStyle.Bold, strItemSeparator, null, ":", " ");

			if((peSprCompile == null) || !SprEngine.MightDeref(strValue))
				rb.Append(strValue);
			else
			{
				string strCmp = SprEngine.Compile(strValue,
					GetEntryListSprContext(peSprCompile,
					m_docMgr.SafeFindContainerOf(peSprCompile)));
				if(strCmp == strValue) rb.Append(strValue);
				else
				{
					rb.Append(strCmp + " - ");
					rb.Append(strValue, FontStyle.Italic);
				}
			}
		}
Пример #4
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_vStringDict != null); if(m_vStringDict == null) throw new InvalidOperationException();
            Debug.Assert(m_atConfig != null); if(m_atConfig == null) throw new InvalidOperationException();

            GlobalWindowManager.AddWindow(this);

            m_ctxKeySeq.Attach(m_rbKeySeq, this);
            m_ctxKeyCodes.Attach(m_rtbPlaceholders, this);

            if(!m_bEditSequenceOnly)
            {
                BannerFactory.CreateBannerEx(this, m_bannerImage,
                    Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureAutoTypeItem,
                    KPRes.ConfigureAutoTypeItemDesc);
            }
            else // Edit keystrokes only
            {
                BannerFactory.CreateBannerEx(this, m_bannerImage,
                    Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureKeystrokeSeq,
                    KPRes.ConfigureKeystrokeSeqDesc);
            }

            this.Icon = Properties.Resources.KeePass;

            UIUtil.EnableAutoCompletion(m_cmbWindow, false);

            // m_clrOriginalForeground = m_lblOpenHint.ForeColor;
            // m_clrOriginalBackground = m_cmbWindow.BackColor;
            // m_strOriginalWindowHint = m_lblTargetWindowInfo.Text;

            RichTextBuilder rb = new RichTextBuilder();
            rb.AppendLine(KPRes.StandardFields, FontStyle.Bold, null, null, ":", null);

            rb.Append("{" + PwDefs.TitleField + "} ");
            rb.Append("{" + PwDefs.UserNameField + "} ");
            rb.Append("{" + PwDefs.PasswordField + "} ");
            rb.Append("{" + PwDefs.UrlField + "} ");
            rb.Append("{" + PwDefs.NotesField + "}");

            bool bCustomInitialized = false, bFirst = true;
            foreach(KeyValuePair<string, ProtectedString> kvp in m_vStringDict)
            {
                if(!PwDefs.IsStandardField(kvp.Key))
                {
                    if(bCustomInitialized == false)
                    {
                        rb.AppendLine();
                        rb.AppendLine();
                        rb.AppendLine(KPRes.CustomFields, FontStyle.Bold, null, null, ":", null);
                        bCustomInitialized = true;
                    }

                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + PwDefs.AutoTypeStringPrefix + kvp.Key + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.KeyboardKeyModifiers, FontStyle.Bold, null, null, ":", null);
            rb.Append(KPRes.KeyboardKeyShift + @": +, ");
            rb.Append(KPRes.KeyboardKeyCtrl + @": ^, ");
            rb.Append(KPRes.KeyboardKeyAlt + @": %");

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.SpecialKeys, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strNav in SpecialKeyCodes)
            {
                if(strNav == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strNav + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.OtherPlaceholders, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strPH in SpecialPlaceholders)
            {
                if(strPH == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strPH + "}");
                    bFirst = false;
                }
            }

            rb.Build(m_rtbPlaceholders);

            LinkifyRtf(m_rtbPlaceholders);

            if(m_iOrgIndex >= 0)
            {
                AutoTypeAssociation asInit = m_atConfig.GetAt(m_iOrgIndex);
                m_cmbWindow.Text = asInit.WindowName;

                if(!m_bEditSequenceOnly)
                    m_rbKeySeq.Text = asInit.Sequence;
                else
                    m_rbKeySeq.Text = m_atConfig.DefaultSequence;
            }
            else if(m_bEditSequenceOnly)
                m_cmbWindow.Text = "(" + KPRes.Default + ")";

            m_bBlockUpdates = true;
            if(m_rbKeySeq.Text.Length > 0) m_rbSeqCustom.Checked = true;
            else m_rbSeqDefault.Checked = true;
            m_bBlockUpdates = false;

            try
            {
                if(NativeLib.IsUnix()) PopulateWindowsListUnix();
                else PopulateWindowsListWin();
            }
            catch(Exception) { Debug.Assert(false); }

            EnableControlsEx();
        }
Пример #5
0
        private static void EvAppendEntryField(RichTextBuilder rb,
            string strItemSeparator, string strName, string strValue)
        {
            if(string.IsNullOrEmpty(strValue)) return;

            rb.Append(strName, FontStyle.Bold, strItemSeparator, null, ":", " ");
            rb.Append(strValue);
        }
Пример #6
0
        private void InitPlaceholdersBox()
        {
            const string VkcBreak = @"<break />";

            string[] vSpecialKeyCodes = new string[] {
                "TAB", "ENTER", "UP", "DOWN", "LEFT", "RIGHT",
                "HOME", "END", "PGUP", "PGDN",
                "INSERT", "DELETE", "SPACE", VkcBreak,
                "BACKSPACE", "BREAK", "CAPSLOCK", "ESC",
                "WIN", "LWIN", "RWIN", "APPS",
                "HELP", "NUMLOCK", "PRTSC", "SCROLLLOCK", VkcBreak,
                "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
                "F13", "F14", "F15", "F16", VkcBreak,
                "ADD", "SUBTRACT", "MULTIPLY", "DIVIDE",
                "NUMPAD0", "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD4",
                "NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9"
            };

            string[] vSpecialPlaceholders = new string[] {
                "GROUP", "GROUPPATH", "PASSWORD_ENC",
                "URL:RMVSCM", "URL:SCM", "URL:HOST", "URL:PORT", "URL:PATH",
                "URL:QUERY", "URL:USERINFO", "URL:USERNAME", "URL:PASSWORD",
                // "BASE",
                "T-REPLACE-RX:/T/S/R/", "T-CONV:/T/C/",
                "C:Comment", VkcBreak,
                "DELAY 1000", "DELAY=200", "VKEY 13", "VKEY-NX 13", "VKEY-EX 13",
                "PICKCHARS", "PICKCHARS:Password:C=3",
                "NEWPASSWORD", "NEWPASSWORD:/Profile/", "HMACOTP", "CLEARFIELD",
                "APPACTIVATE " + KPRes.Title, VkcBreak,
                "APPDIR", "DB_PATH", "DB_DIR", "DB_NAME", "DB_BASENAME", "DB_EXT",
                "ENV_DIRSEP", "ENV_PROGRAMFILES_X86", VkcBreak,
                // "INTERNETEXPLORER", "FIREFOX", "OPERA", "GOOGLECHROME",
                // "SAFARI", VkcBreak,
                "DT_SIMPLE", "DT_YEAR", "DT_MONTH", "DT_DAY", "DT_HOUR", "DT_MINUTE",
                "DT_SECOND", "DT_UTC_SIMPLE", "DT_UTC_YEAR", "DT_UTC_MONTH",
                "DT_UTC_DAY", "DT_UTC_HOUR", "DT_UTC_MINUTE", "DT_UTC_SECOND"
            };

            RichTextBuilder rb = new RichTextBuilder();
            rb.AppendLine(KPRes.StandardFields, FontStyle.Bold, null, null, ":", null);

            rb.Append("{" + PwDefs.TitleField + "} ");
            rb.Append("{" + PwDefs.UserNameField + "} ");
            rb.Append("{" + PwDefs.PasswordField + "} ");
            rb.Append("{" + PwDefs.UrlField + "} ");
            rb.Append("{" + PwDefs.NotesField + "}");

            bool bCustomInitialized = false, bFirst = true;
            foreach(KeyValuePair<string, ProtectedString> kvp in m_vStringDict)
            {
                if(!PwDefs.IsStandardField(kvp.Key))
                {
                    if(bCustomInitialized == false)
                    {
                        rb.AppendLine();
                        rb.AppendLine();
                        rb.AppendLine(KPRes.CustomFields, FontStyle.Bold, null, null, ":", null);
                        bCustomInitialized = true;
                    }

                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + PwDefs.AutoTypeStringPrefix + kvp.Key + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.KeyboardKeyModifiers, FontStyle.Bold, null, null, ":", null);
            rb.Append(KPRes.KeyboardKeyShift + @": +, ");
            rb.Append(KPRes.KeyboardKeyCtrl + @": ^, ");
            rb.Append(KPRes.KeyboardKeyAlt + @": %");

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.SpecialKeys, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strNav in vSpecialKeyCodes)
            {
                if(strNav == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strNav + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.OtherPlaceholders, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strPH in vSpecialPlaceholders)
            {
                if(strPH == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strPH + "}");
                    bFirst = false;
                }
            }

            if(SprEngine.FilterPlaceholderHints.Count > 0)
            {
                rb.AppendLine();
                rb.AppendLine();
                rb.AppendLine(KPRes.PluginProvided, FontStyle.Bold, null, null, ":", null);
                bFirst = true;
                foreach(string strP in SprEngine.FilterPlaceholderHints)
                {
                    if(string.IsNullOrEmpty(strP)) continue;

                    if(!bFirst) rb.Append(" ");
                    rb.Append(strP);
                    bFirst = false;
                }
            }

            rb.Build(m_rtbPlaceholders);

            LinkifyRtf(m_rtbPlaceholders);
        }
Пример #7
0
        private void EvAppendEntryField(RichTextBuilder rb,
			string strItemSeparator, string strName, string strRawValue,
			PwEntry peSprCompile)
        {
            if(strRawValue == null) { Debug.Assert(false); return; }

            string strValue = strRawValue.Trim();
            if(strValue.Length == 0) return;

            rb.Append(strName, FontStyle.Bold, strItemSeparator, null, ":", " ");

            if((peSprCompile == null) || !SprEngine.MightDeref(strValue))
                rb.Append(strValue);
            else
            {
                string strCmp = SprEngine.Compile(strValue,
                    GetEntryListSprContext(peSprCompile,
                    m_docMgr.SafeFindContainerOf(peSprCompile)));
                if(strCmp == strValue) rb.Append(strValue);
                else
                {
                    rb.Append(strCmp.Trim() + " - ");
                    rb.Append(strValue, FontStyle.Italic);
                }
            }
        }
Пример #8
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            Debug.Assert(m_vStringDict != null); if(m_vStringDict == null) throw new InvalidOperationException();
            Debug.Assert(m_atConfig != null); if(m_atConfig == null) throw new InvalidOperationException();

            GlobalWindowManager.AddWindow(this);

            m_ctxKeySeq.Attach(m_rbKeySeq);
            m_ctxKeyCodes.Attach(m_rtbPlaceholders);

            if(!m_bEditSequenceOnly)
            {
                m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width,
                    m_bannerImage.Height, BannerStyle.Default,
                    Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureAutoTypeItem,
                    KPRes.ConfigureAutoTypeItemDesc);
            }
            else // Edit keystrokes only
            {
                m_bannerImage.Image = BannerFactory.CreateBanner(m_bannerImage.Width,
                    m_bannerImage.Height, BannerStyle.Default,
                    Properties.Resources.B48x48_KCMSystem, KPRes.ConfigureKeystrokeSeq,
                    KPRes.ConfigureKeystrokeSeqDesc);
            }

            this.Icon = Properties.Resources.KeePass;

            UIUtil.EnableAutoCompletion(m_cmbWindow, false);

            // m_clrOriginalForeground = m_lblOpenHint.ForeColor;
            m_clrOriginalBackground = m_cmbWindow.BackColor;
            // m_strOriginalWindowHint = m_lblTargetWindowInfo.Text;

            RichTextBuilder rb = new RichTextBuilder();
            rb.AppendLine(KPRes.StandardFields, FontStyle.Bold, null, null, ":", null);

            rb.Append("{" + PwDefs.TitleField + "} ");
            rb.Append("{" + PwDefs.UserNameField + "} ");
            rb.Append("{" + PwDefs.PasswordField + "} ");
            rb.Append("{" + PwDefs.UrlField + "} ");
            rb.Append("{" + PwDefs.NotesField + "}");

            bool bCustomInitialized = false, bFirst = true;
            foreach(KeyValuePair<string, ProtectedString> kvp in m_vStringDict)
            {
                if(!PwDefs.IsStandardField(kvp.Key))
                {
                    if(bCustomInitialized == false)
                    {
                        rb.AppendLine();
                        rb.AppendLine();
                        rb.AppendLine(KPRes.CustomFields, FontStyle.Bold, null, null, ":", null);
                        bCustomInitialized = true;
                    }

                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + PwDefs.AutoTypeStringPrefix + kvp.Key + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.KeyboardKeyModifiers, FontStyle.Bold, null, null, ":", null);
            rb.Append(KPRes.KeyboardKeyShift + @": +, ");
            rb.Append(KPRes.KeyboardKeyCtrl + @": ^, ");
            rb.Append(KPRes.KeyboardKeyAlt + @": %");

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.SpecialKeys, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strNav in SpecialKeyCodes)
            {
                if(strNav == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strNav + "}");
                    bFirst = false;
                }
            }

            rb.AppendLine();
            rb.AppendLine();
            rb.AppendLine(KPRes.OtherPlaceholders, FontStyle.Bold, null, null, ":", null);
            bFirst = true;
            foreach(string strPH in SpecialPlaceholders)
            {
                if(strPH == VkcBreak) { rb.AppendLine(); rb.AppendLine(); bFirst = true; }
                else
                {
                    if(!bFirst) rb.Append(" ");
                    rb.Append("{" + strPH + "}");
                    bFirst = false;
                }
            }

            rb.Build(m_rtbPlaceholders);

            LinkifyRtf(m_rtbPlaceholders);

            if(m_strOriginalName != null)
            {
                m_cmbWindow.Text = m_strOriginalName;

                if(!m_bEditSequenceOnly)
                    m_rbKeySeq.Text = m_atConfig.GetSafe(m_strOriginalName);
                else
                    m_rbKeySeq.Text = m_atConfig.DefaultSequence;
            }

            m_bBlockUpdates = true;
            if(m_rbKeySeq.Text.Length > 0) m_rbSeqCustom.Checked = true;
            else m_rbSeqDefault.Checked = true;
            m_bBlockUpdates = false;

            try
            {
                NativeMethods.EnumWindowsProc procEnum = delegate(IntPtr hWnd,
                    IntPtr lParam)
                {
                    string strName = NativeMethods.GetWindowText(hWnd, true);
                    if((strName != null) && (strName.Length > 0))
                    {
                        if((NativeMethods.GetWindowStyle(hWnd) &
                            NativeMethods.WS_VISIBLE) != 0)
                        {
                            m_cmbWindow.Items.Add(strName);
                        }
                    }

                    return true;
                };

                NativeMethods.EnumWindows(procEnum, IntPtr.Zero);
            }
            catch(Exception) { Debug.Assert(false); }

            EnableControlsEx();
        }