1 /* 2 KeePass Password Safe - The Open-Source Password Manager 3 Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 using System; 21 using System.Collections.Generic; 22 using System.ComponentModel; 23 using System.Diagnostics; 24 using System.Drawing; 25 using System.Text; 26 using System.Windows.Forms; 27 28 using KeePass.App; 29 using KeePass.Resources; 30 using KeePass.UI; 31 32 using KeePassLib; 33 34 namespace KeePass.Forms 35 { 36 public partial class ImportMethodForm : Form 37 { 38 PwMergeMethod m_mmSelected = PwMergeMethod.CreateNewUuids; 39 40 public PwMergeMethod MergeMethod 41 { 42 get { return m_mmSelected; } 43 } 44 ImportMethodForm()45 public ImportMethodForm() 46 { 47 InitializeComponent(); 48 GlobalWindowManager.InitializeForm(this); 49 } 50 OnFormLoad(object sender, EventArgs e)51 private void OnFormLoad(object sender, EventArgs e) 52 { 53 GlobalWindowManager.AddWindow(this); 54 try { if(this.Owner == null) this.Owner = Program.MainForm; } 55 catch(Exception) { Debug.Assert(false); } 56 57 BannerFactory.CreateBannerEx(this, m_bannerImage, 58 Properties.Resources.B48x48_Folder_Download, KPRes.ImportBehavior, 59 KPRes.ImportBehaviorDesc); 60 this.Icon = AppIcons.Default; 61 62 this.Text = KPRes.ImportBehavior; 63 64 m_radioCreateNew.Text = KPRes.CreateNewIDs; 65 m_radioKeepExisting.Text = KPRes.KeepExisting; 66 m_radioOverwrite.Text = KPRes.OverwriteExisting; 67 m_radioOverwriteIfNewer.Text = KPRes.OverwriteIfNewer; 68 m_radioSynchronize.Text = KPRes.OverwriteIfNewerAndApplyDel; 69 70 FontUtil.AssignDefaultBold(m_radioCreateNew); 71 FontUtil.AssignDefaultBold(m_radioKeepExisting); 72 FontUtil.AssignDefaultBold(m_radioOverwrite); 73 FontUtil.AssignDefaultBold(m_radioOverwriteIfNewer); 74 FontUtil.AssignDefaultBold(m_radioSynchronize); 75 76 m_radioCreateNew.Checked = true; 77 } 78 OnBtnOK(object sender, EventArgs e)79 private void OnBtnOK(object sender, EventArgs e) 80 { 81 if(m_radioCreateNew.Checked) 82 m_mmSelected = PwMergeMethod.CreateNewUuids; 83 else if(m_radioKeepExisting.Checked) 84 m_mmSelected = PwMergeMethod.KeepExisting; 85 else if(m_radioOverwrite.Checked) 86 m_mmSelected = PwMergeMethod.OverwriteExisting; 87 else if(m_radioOverwriteIfNewer.Checked) 88 m_mmSelected = PwMergeMethod.OverwriteIfNewer; 89 else if(m_radioSynchronize.Checked) 90 m_mmSelected = PwMergeMethod.Synchronize; 91 } 92 OnBtnCancel(object sender, EventArgs e)93 private void OnBtnCancel(object sender, EventArgs e) 94 { 95 } 96 OnFormClosed(object sender, FormClosedEventArgs e)97 private void OnFormClosed(object sender, FormClosedEventArgs e) 98 { 99 GlobalWindowManager.RemoveWindow(this); 100 } 101 } 102 }