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 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/options.cpp | 3 +- src/resource.h | 4 +- 3 files changed, 113 insertions(+), 7 deletions(-) (limited to 'src') 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; } } diff --git a/src/options.cpp b/src/options.cpp index d635302..ab54404 100755 --- a/src/options.cpp +++ b/src/options.cpp @@ -381,8 +381,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); std::string str = szKey;; mir_free(szKey); - for(std::string::size_type i = str.find("\n"); i != std::string::npos; i = str.find("\n", i+2)) - str.replace(i, 1, "\r\n"); + boost::algorithm::replace_all(str, "\n", "\r\n"); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() +1); if(!hMem) { diff --git a/src/resource.h b/src/resource.h index 7ffd83c..38f790f 100755 --- a/src/resource.h +++ b/src/resource.h @@ -82,6 +82,7 @@ #define IDC_AUT_EXCHANGE 1065 #define IDC_BUTTON3 1066 #define IDC_COPY_KEY 1066 +#define IDC_COPY_PUBKEY 1066 #define IDC_STRIP_TAGS 1067 #define IDC_CHECK1 1068 #define IDC_PRESCENSE_SUBSCRIPTION 1068 @@ -95,6 +96,7 @@ #define IDC_PUBLIC 1073 #define IDC_PRIVATE 1074 #define IDC_ALL 1075 +#define IDC_EXPORT_PRIVATE 1076 // Next default values for new objects // @@ -102,7 +104,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 115 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1076 +#define _APS_NEXT_CONTROL_VALUE 1077 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3