From 2b126859937b2b3d3939fb0666bc0dcf3fcec1e6 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 28 Jan 2013 14:21:06 +0200 Subject: merged with miranda_ng main repo implemented #78 (except menu) --- src/main.cpp | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 109 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 87edd03..495f025 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,8 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR SetWindowPos(hwndDlg, 0, firstrun_rect.left, firstrun_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); SetWindowText(hwndDlg, TranslateT("Set own key")); + EnableWindow(GetDlgItem(hwndDlg, IDC_COPY_PUBKEY), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_EXPORT_PRIVATE), 0); col.pszText = _T("Key ID"); col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; @@ -321,10 +323,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR if(result == pxNotFound) break; string::size_type s = 0; - while((s = out.find("\r", s)) != string::npos) - { - out.erase(s, 1); - } + boost::algorithm::erase_all(out, "\r"); { char buf[64]; GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); @@ -708,6 +707,110 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } } break; + case IDC_COPY_PUBKEY: + { + if(OpenClipboard(hwndDlg)) + { + ListView_GetItemText(hwndList, itemnum, 0, fp, 16); + string out; + DWORD code; + wstring cmd = _T("--batch -a --export "); + cmd += fp; + gpg_execution_params params; + pxResult result; + params.cmd = &cmd; + params.useless = ""; + params.out = &out; + params.code = &code; + params.result = &result; + boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); + if(!gpg_thread.timed_join(boost::posix_time::seconds(10))) + { + gpg_thread.~thread(); + TerminateProcess(params.hProcess, 1); + params.hProcess = NULL; + if(bDebugLog) + debuglog<hdr.code == NM_CLICK) { EnableWindow(GetDlgItem(hwndDlg, ID_OK), 1); + EnableWindow(GetDlgItem(hwndDlg, IDC_COPY_PUBKEY), 1); + EnableWindow(GetDlgItem(hwndDlg, IDC_EXPORT_PRIVATE), 1); itemnum = hdr->iItem; } } -- cgit v1.2.3