From 41539458d2d114cb714b72315c482e33340a9ee3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 11 Aug 2010 05:22:07 +0300 Subject: modified: init.cpp modified: main.cpp modified: messages.cpp modified: new_gpg.rc modified: options.cpp modified: resource.h modified: utilities.cpp --- main.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 25 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index b93f9f5..7adec85 100644 --- a/main.cpp +++ b/main.cpp @@ -21,30 +21,79 @@ void test() { - DWORD exitcode; - string output; - TCHAR *bin_path = UniGetContactSettingUtf(NULL, szModuleName, "szGpgBinPath", _T("")); + string out; + DWORD code; + TCHAR cmd[512]; + _tcscpy(cmd, _T("--list-secret-keys")); + pxExecute(cmd, "", &out, &code); + MessageBoxA(0, out.c_str(), "test", MB_OK); +} + + +HWND hwndFirstRun = NULL; + +static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hwndDlg); + return TRUE; + } + + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case ID_OK: + DestroyWindow(hwndDlg); + break; + } + break; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + return TRUE; + } + } + } + break; + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + hwndFirstRun = NULL; + break; + + } + + return FALSE; +} + +extern HINSTANCE hInst; + +void ShowFirstRunDialog() +{ + if (hwndFirstRun == NULL) { - if(_waccess(bin_path, 0) == -1) - if(errno == ENOENT) - { - mir_free(bin_path); - return; - } + hwndFirstRun = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, DlgProcFirstRun); } - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("")); - TCHAR bin[512]; - _tcscpy(bin, bin_path); - _tcscat(bin, _T(" --homedir ")); - _tcscat(bin, _T("\"")); - _tcscat(bin, home_dir); - _tcscat(bin, _T("\"")); - _tcscat(bin, _T(" --help")); - pxResult pxresult=pxExecute(bin,"",&output,&exitcode); - mir_free(bin_path); - mir_free(home_dir); -/* fstream f("c:\\str.txt", std::ios::out); - f<