From 634d16d7a56e8ba72fda7b6f1896970b96b331ff Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 28 Aug 2010 01:01:27 +0300 Subject: fixed crash when loading existing secret key --- new_gpg.rc | 6 +++--- options.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/new_gpg.rc b/new_gpg.rc index 1ec3e23..7f5117c 100644 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -71,12 +71,12 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "خت",ID_OK,12,175,50,14,WS_DISABLED CONTROL "",IDC_KEY_LIST,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,23,277,105 - PUSHBUTTON "Generate key",IDC_GENERATE_KEY,11,131,54,14 + PUSHBUTTON "Generate key",IDC_GENERATE_KEY,11,131,58,14 LTEXT "Select key for use",IDC_STATIC,16,12,186,8 EDITTEXT IDC_KEY_PASSWORD,94,147,77,14,ES_PASSWORD | ES_AUTOHSCROLL RTEXT "Key password:",IDC_STATIC,12,149,76,8 - PUSHBUTTON "Load other",IDC_OTHER,68,131,50,14 - PUSHBUTTON "Delete key",IDC_DELETE_KEY,121,131,46,14 + PUSHBUTTON "Load other",IDC_OTHER,73,131,56,14 + PUSHBUTTON "Delete key",IDC_DELETE_KEY,132,131,56,14 END IDD_BIN_PATH DIALOGEX 0, 0, 354, 89 diff --git a/options.cpp b/options.cpp index f902d59..9d9b952 100644 --- a/options.cpp +++ b/options.cpp @@ -625,6 +625,13 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "bAlwatsTrust"); { TCHAR *tmp; + + if(output.find("already in secret keyring") != string::npos) + { + MessageBox(0, _T("Key already in scret key ring."), _T("Info"), MB_OK); + DeleteFile(tmp2); + break; + } char *tmp2; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); -- cgit v1.2.3