From 1dbcb0630d8e5c61d528f0f6fb5dfcb3395615c2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Apr 2011 20:23:04 +0300 Subject: modified: main.cpp modified: messages.cpp --- main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 7fdf27c..e75ec4d 100644 --- a/main.cpp +++ b/main.cpp @@ -989,14 +989,15 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); + HANDLE hContact = INVALID_HANDLE_VALUE; void ImportKey(); TCHAR *tmp = NULL; switch (msg) { case WM_INITDIALOG: { + hContact = new_key_hcnt; + new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); @@ -1622,12 +1623,13 @@ static BOOL CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); + HANDLE hContact = INVALID_HANDLE_VALUE; switch (msg) { case WM_INITDIALOG: { + hContact = new_key_hcnt; + new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0 , import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0); -- cgit v1.2.3 From d783b07eeb0776f3763e3ce8d725748b7290c257 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 7 Nov 2011 02:46:59 +0200 Subject: removed old warning about gpg version small ui corrections possible translation fixes --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 main.cpp (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp old mode 100644 new mode 100755 index e75ec4d..913ecbf --- a/main.cpp +++ b/main.cpp @@ -1803,14 +1803,14 @@ void InitCheck() mir_free(home_dir); tmp_dir += _T("\\tmp"); _wmkdir(tmp_dir.c_str()); - string question = "Your secret key whith id: "; + string question = Translate("Your secret key whith id: "); char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); question += keyid; mir_free(keyid); - question += " deleted from gpg secret keyring\nDo you want to set another key ?"; + question += Translate(" deleted from gpg secret keyring\nDo you want to set another key ?"); void ShowFirstRunDialog(); if(out.find(keyid) == string::npos) - if(MessageBoxA(0, question.c_str(), "Own secret key warning", MB_YESNO) == IDYES) + if(MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } { -- cgit v1.2.3 From 1abe0e83270a64e2a51e7c2cbb66b76bc406a5a0 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 11 Feb 2012 14:12:04 +0200 Subject: fix possible export key problem --- main.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 913ecbf..c5a8847 100755 --- a/main.cpp +++ b/main.cpp @@ -1568,10 +1568,25 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, { out.erase(s, 1); } - TCHAR *tmp = mir_a2t(out.c_str()); + std::string::size_type p1 = 0, p2 = 0; + p1 = out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----"); + if(p1 != std::string::npos) + { + p2 = out.find("-----END PGP PUBLIC KEY BLOCK-----", p1); + if(p2 != std::string::npos) + { + p2 += strlen("-----END PGP PUBLIC KEY BLOCK-----"); + out = out.substr(p1, p2-p1); + TCHAR *tmp = mir_a2t(out.c_str()); + SetWindowText(hPubKeyEdit, tmp); + mir_free(tmp); + } + else + MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + } + else + MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); // SetDlgItemText(hPubKeyEdit, IDC_PUBLIC_KEY_EDIT, tmp); - SetWindowText(hPubKeyEdit, tmp); - mir_free(tmp); } DestroyWindow(hwndDlg); break; -- cgit v1.2.3 From 9e02dc6e39a6073f496cb920394c6396596bb1a3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 14:51:02 +0200 Subject: translation support for some messageboxes --- main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index c5a8847..56ec91e 100755 --- a/main.cpp +++ b/main.cpp @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBox(0, _T("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, _T("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in wollowing diallog."), _T("Info"), MB_OK); + MessageBox(0, TranslateW("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in following diallog."), _T("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From 6a42053a9796fb2a2cdc0ef795fda101a0167247 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 15:01:50 +0200 Subject: modified: main.cpp --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 56ec91e..14a93a7 100755 --- a/main.cpp +++ b/main.cpp @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, TranslateW("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in following diallog."), _T("Info"), MB_OK); + MessageBox(0, TranslateW("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), _T("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From bb5528246b71975133456bc5e54ed84b4ff4a4a8 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 16:56:52 +0200 Subject: modified: main.cpp --- main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 14a93a7..588fa03 100755 --- a/main.cpp +++ b/main.cpp @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBox(0, TranslateW("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), "Warning", MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, TranslateW("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("wrong gpg binary location found in system.\nplease choose another location"), "Warning", MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, TranslateW("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); } if(bad_version) - MessageBox(0, TranslateW("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, TranslateW("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), _T("Info"), MB_OK); + MessageBoxA(0, Translate("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), "Info", MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From b854bd5561c7101a03d4cb0f14b31ef640e0e913 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 16:45:19 +0200 Subject: translation support fixes --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 588fa03..3fee85e 100755 --- a/main.cpp +++ b/main.cpp @@ -1001,9 +1001,9 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?_T("There is existing key for contact, would you like to replace with new key ?"):_T("New public key was received, do you want to import it?")); + SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); - SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?_T("Replace"):_T("Accept")); + SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); mir_free(tmp); tmp = new TCHAR [256]; _tcscpy(tmp, _T("Received key from ")); -- cgit v1.2.3 From f92386e190df0a638aadc90afbc3d0bed01716f6 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 17:21:43 +0200 Subject: translations fixes --- main.cpp | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 3fee85e..f6a5e77 100755 --- a/main.cpp +++ b/main.cpp @@ -389,7 +389,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, _T("Failed to open file"), _T("Error"), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: RSA"; @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBoxA(0, Translate("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), "Warning", MB_OK); + MessageBox(0, TranslateT("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), TranslateT("Warning"), MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBoxA(0, Translate("wrong gpg binary location found in system.\nplease choose another location"), "Warning", MB_OK); + MessageBox(0, TranslateT("wrong gpg binary location found in system.\nplease choose another location"), TranslateT("Warning"), MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBoxA(0, Translate("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBoxA(0, Translate("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBoxA(0, Translate("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), "Info", MB_OK); + MessageBox(0, TranslateT("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), TranslateT("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; @@ -690,14 +690,14 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("gpg binary does not exists.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("gpg binary does not exists.\nplease choose another location"), TranslateT("Warning"), MB_OK); break; } } } else { - MessageBox(0, _T("please choose gpg binary location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please choose gpg binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -734,10 +734,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); @@ -745,7 +745,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) { - MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); @@ -779,14 +779,14 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("gpg binary does not exists.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("gpg binary does not exists.\nplease choose another location"), TranslateT("Warning"), MB_OK); break; } } } else { - MessageBox(0, _T("please choose gpg binary location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please choose gpg binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -823,10 +823,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); @@ -834,7 +834,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) { - MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); @@ -859,7 +859,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, _T("Failed to open file"), _T("Error"), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: RSA"; @@ -1006,7 +1006,7 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); mir_free(tmp); tmp = new TCHAR [256]; - _tcscpy(tmp, _T("Received key from ")); + _tcscpy(tmp, TranslateT("Received key from ")); _tcscat(tmp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR)); SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp); delete [] tmp; @@ -1073,7 +1073,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { SetWindowPos(hwndDlg, 0, key_gen_rect.left, key_gen_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); - SetWindowText(hwndDlg, TranslateW(_T("Key Generation dialog"))); + SetWindowText(hwndDlg, TranslateT("Key Generation dialog")); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("RSA"), 0); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1); SendDlgItemMessage(hwndDlg, IDC_KEY_TYPE, CB_SETCURSEL, (WPARAM)1, 0); @@ -1099,7 +1099,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, if(_tcslen(tmp) < 3) { mir_free(tmp); - MessageBox(0, TranslateW(_T("You must set encryption algorythm first")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("You must set encryption algorythm first"), TranslateT("Error"), MB_OK); break; } mir_free(tmp); @@ -1109,14 +1109,14 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, mir_free(tmp); if(length < 1024 || length > 4096) { - MessageBox(0, TranslateW(_T("Key length must be of length from 1024 to 4096 bits")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK); break; } tmp = new TCHAR [12]; GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 12); if(_tcslen(tmp) != 10 && tmp[0] != '0') { - MessageBox(0, TranslateW(_T("Invalid date")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1125,13 +1125,13 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 128); if(_tcslen(tmp) < 5) { - MessageBox(0, TranslateW(_T("Name must contain at least 5 characters")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); delete [] tmp; break; } else if (_tcschr(tmp, _T('(')) || _tcschr(tmp, _T(')'))) { - MessageBox(0, TranslateW(_T("Name cannot contain '(' or ')'")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1140,7 +1140,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128); if((_tcslen(tmp)) < 5 || (!_tcschr(tmp, _T('@'))) || (!_tcschr(tmp, _T('.')))) { - MessageBox(0, TranslateW(_T("Invalid Email")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1156,7 +1156,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, TranslateW(_T("Failed to open file")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: "; @@ -1582,10 +1582,10 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, mir_free(tmp); } else - MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); } else - MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); // SetDlgItemText(hPubKeyEdit, IDC_PUBLIC_KEY_EDIT, tmp); } DestroyWindow(hwndDlg); @@ -1859,7 +1859,7 @@ void ImportKey() new_key_hcnt_mutex.unlock(); bool for_all_sub = false; if(metaIsProtoMetaContacts(hContact)) - if(MessageBox(0, _T("Do you want load key for all subcontacts ?"), _T("Metacontact detected"), MB_YESNO) == IDYES) + if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) for_all_sub = true; if(metaIsProtoMetaContacts(hContact)) { -- cgit v1.2.3 From 8f104752a2373b6ef330f31e5aa4653ad5ba5622 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 22:31:11 +0200 Subject: modified: ../main.cpp modified: ../new_gpg.rc modified: ../new_gpg.sln modified: ../options.cpp --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index f6a5e77..55b4d25 100755 --- a/main.cpp +++ b/main.cpp @@ -217,7 +217,8 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd); } { - wstring keyinfo = _T("Current private key id: "); + wstring keyinfo = TranslateT("Current private key id"); + keyinfo += _T(": "); keyinfo += (fp[0])?fp:_T("not set"); extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, keyinfo.c_str()); -- cgit v1.2.3 From bf88761455597a47f1074d01c4a29c41e0fe270c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 10 Mar 2012 21:13:22 +0200 Subject: copyrights --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 55b4d25..abd6982 100755 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010-2011 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -- cgit v1.2.3 From 365d949d8ec2712fbdec479e73e78cbbe80b3399 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 18 May 2012 22:28:05 +0300 Subject: fixed (#33 Settings) --- main.cpp | 54 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index abd6982..36a037f 100755 --- a/main.cpp +++ b/main.cpp @@ -226,7 +226,8 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM delete [] name; } bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); - gpg_configured = isGPGConfigured(); + gpg_valid = isGPGValid(); + gpg_keyexist = isGPGKeyExist(); DestroyWindow(hwndDlg); break; case IDC_OTHER: @@ -570,9 +571,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(tmp, 0) == -1) { if(errno == ENOENT) - { MessageBox(0, TranslateT("wrong gpg binary location found in system.\nplease choose another location"), TranslateT("Warning"), MB_OK); - } } } } @@ -594,7 +593,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP params.out = &out; params.code = &code; params.result = &result; - gpg_configured = true; + gpg_valid = true; boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::seconds(10))) { @@ -603,7 +602,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP params.hProcess = NULL; debuglog< Date: Sat, 2 Jun 2012 08:00:48 +0300 Subject: removed unneeded key warning on first run --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 36a037f..9444dd6 100755 --- a/main.cpp +++ b/main.cpp @@ -1823,7 +1823,7 @@ void InitCheck() char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); void ShowFirstRunDialog(); - if(!keyid[0] || !key[0]) + if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) { question = Translate("You have not set public key for gpg, it's recommended to do it.\nDo you want to do it now ?"); if(MessageBoxA(0, question.c_str(), Translate("Own public key warning"), MB_YESNO) == IDYES) -- cgit v1.2.3 From dd580e5cae07351821fa52c24fe7ac254bc8004f Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 08:58:30 +0300 Subject: typo fixes --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 9444dd6..cbc36a9 100755 --- a/main.cpp +++ b/main.cpp @@ -396,7 +396,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } f<<"Key-Type: RSA"; f<<"\n"; - f<<"Key-Length: 2048"; + f<<"Key-Length: 4096"; f<<"\n"; f<<"Subkey-Type: RSA"; f<<"\n"; @@ -1078,7 +1078,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1); SendDlgItemMessage(hwndDlg, IDC_KEY_TYPE, CB_SETCURSEL, (WPARAM)1, 0); SetDlgItemInt(hwndDlg, IDC_KEY_EXPIRE_DATE, 0, 0); - SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 2048, 0); + SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 4096, 0); return TRUE; } -- cgit v1.2.3 From 0711166b41c6e4f0b788ab34ef15289e98e46a31 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 14:54:56 +0300 Subject: fixed "accept and turn on encryption" on key inport --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index cbc36a9..5e4034e 100755 --- a/main.cpp +++ b/main.cpp @@ -989,7 +989,7 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = INVALID_HANDLE_VALUE; + static HANDLE hContact = INVALID_HANDLE_VALUE; void ImportKey(); TCHAR *tmp = NULL; switch (msg) @@ -1001,9 +1001,9 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); + SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); - SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); + SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept")); mir_free(tmp); tmp = new TCHAR [256]; _tcscpy(tmp, TranslateT("Received key from ")); -- cgit v1.2.3 From 9d905146c450baed1ecb180652cca904879ab9c8 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 6 Jun 2012 00:05:40 +0300 Subject: implemented #44 (access rights checking) --- main.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 5e4034e..23d486b 100755 --- a/main.cpp +++ b/main.cpp @@ -1787,6 +1787,45 @@ void InitCheck() { {//parse gpg output gpg_valid = isGPGValid(); + bool home_dir_access = false, temp_access = false; + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + std::wstring test_path = home_dir; + mir_free(home_dir); + test_path += _T("/"); + test_path += toUTF16(get_random(13)); + wfstream test_file; + test_file.open(test_path, std::ios::trunc | std::ios::out); + if(test_file.is_open() && test_file.good()) + { + test_file<<_T("access_test\n"); + if(test_file.good()) + home_dir_access = true; + test_file.close(); + DeleteFile(test_path.c_str()); + } + home_dir = _tgetenv(_T("TEMP")); + test_path = home_dir; + test_path += _T("/"); + test_path += toUTF16(get_random(13)); + test_file.open(test_path, std::ios::trunc | std::ios::out); + if(test_file.is_open() && test_file.good()) + { + test_file<<_T("access_test\n"); + if(test_file.good()) + temp_access = true; + test_file.close(); + DeleteFile(test_path.c_str()); + } + if(!home_dir_access || !temp_access || !gpg_valid) + { + char buf[4096]; + strcpy(buf, gpg_valid?Translate("GPG binary is set and valid (this is good).\n"):Translate("GPG binary unset or invalid (plugin will not work).\n")); + strcat(buf, home_dir_access?Translate("Home dir write access granted (this is good).\n"):Translate("Home dir have not write access (plugin most probably will not work).\n")); + strcat(buf, temp_access?Translate("Temp dir write access granted (this is good).\n"):Translate("Temp dir have not write access (plugin should work, but may have some problems, filetransfers will not work).")); + if(!gpg_valid) + strcat(buf, Translate("\nGPG will be disabled until you solve this problems")); + MessageBoxA(0, buf, Translate("GPG plugin problems"), MB_OK); + } if(!gpg_valid) return; gpg_keyexist = isGPGKeyExist(); @@ -1814,7 +1853,7 @@ void InitCheck() if(result == pxNotFound) return; } - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); wstring tmp_dir = home_dir; mir_free(home_dir); tmp_dir += _T("\\tmp"); -- cgit v1.2.3 From 7ca9ddf39c89968fbaa81e61598a7d3f8d09d2ac Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 6 Jun 2012 21:40:16 +0300 Subject: fixed #48 (key generation tab order) implemented #49 (key generation notification) --- main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 23d486b..dce18cd 100755 --- a/main.cpp +++ b/main.cpp @@ -426,6 +426,12 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM params.out = &out; params.code = &code; params.result = &result; + SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_KEY), Translate("Generating new random key, please wait")); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENERATE_KEY), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_OTHER), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_KEY), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_LIST), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENERATE_RANDOM), 0); boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) { @@ -1248,6 +1254,16 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, params.out = &out; params.code = &code; params.result = &result; + SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_TEXT), Translate("Generating new key, please wait...")); + EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), 0); + EnableWindow(GetDlgItem(hwndDlg, IDOK), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_TYPE), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_LENGTH), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_PASSWD), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_REAL_NAME), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_EMAIL), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_COMMENT), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_EXPIRE_DATE), 0); boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) { -- cgit v1.2.3 From e0db8851abe880553f48a0b2454dde293ffb22b2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 2 Jul 2012 23:26:17 +0300 Subject: =?UTF-8?q?added=20ability=20to=20set=20private=20key=20for=20each?= =?UTF-8?q?=20protocol=20(#50=20=09=D0=A1=D0=B2=D0=BE=D0=B9=20=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=B0=D0=B6=D0=B4?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=83=D1=87=D0=B5=D1=82=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 137 insertions(+), 19 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index dce18cd..dcb0384 100755 --- a/main.cpp +++ b/main.cpp @@ -148,7 +148,27 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } } } - + { + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)Translate("Default")); + int count = 0; + PROTOACCOUNT **accounts; + ProtoEnumAccounts(&count, &accounts); + for(int i = 0; i < count; i++) + { + if(StriStr(accounts[i]->szModuleName, "metacontacts")) + continue; + if(StriStr(accounts[i]->szModuleName, "weather")) + continue; + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)accounts[i]->szModuleName); + } + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } return TRUE; } @@ -201,10 +221,30 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBWriteContactSettingString(NULL, szGPGModuleName, setting, out.c_str()); + strcpy(setting, buf); + strcat(setting, "_KeyMainName"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, name); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, fp); + } } - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); TCHAR passwd[64]; GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, 64); if(passwd[0]) @@ -217,7 +257,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd); } { - wstring keyinfo = TranslateT("Current private key id"); + wstring keyinfo = TranslateT("Default private key id"); keyinfo += _T(": "); keyinfo += (fp[0])?fp:_T("not set"); extern HWND hwndCurKey_p; @@ -371,13 +411,42 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } if(result == pxNotFound) break; + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType"); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyMainName"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyComment"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyMainEmail"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyType"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + } } - DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType"); ListView_DeleteItem(hwndList, itemnum); break; case IDC_GENERATE_RANDOM: @@ -479,15 +548,60 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBWriteContactSettingString(NULL, szGPGModuleName, setting, out.c_str()); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, fp); + } } - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", path.c_str()); extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, path.c_str()); } } DestroyWindow(hwndDlg); break; + case IDC_ACCOUNT: + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } + else + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_KeyID"); + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } + } + break; + } break; } @@ -502,12 +616,16 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM itemnum = hdr->iItem; } } -// switch (((LPNMHDR)lParam)->code) - // { -// default: -// break; - -// } +/* switch(LOWORD(wParam)) + { + default: + break; + }; */ +/* switch (((LPNMHDR)lParam)->code) + { + default: + break; + } */ } break; case WM_CLOSE: -- cgit v1.2.3 From 64c6452c697a05ab0b0d4bbbda167ddc35215397 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 14 Jul 2012 22:10:58 +0300 Subject: hz ... --- main.cpp | 60 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index dcb0384..3857f38 100755 --- a/main.cpp +++ b/main.cpp @@ -161,10 +161,10 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM continue; SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)accounts[i]->szModuleName); } - SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); - string keyinfo = Translate("key id"); - keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); @@ -221,10 +221,10 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); - } - { - char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -411,9 +411,9 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } if(result == pxNotFound) break; - } - { - char buf[64]; + } + { + char buf[64]; GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { @@ -548,9 +548,9 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); - } - { - char buf[64]; + } + { + char buf[64]; GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { @@ -575,27 +575,27 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DestroyWindow(hwndDlg); break; case IDC_ACCOUNT: - { - char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); - if(!strcmp(buf, Translate("Default"))) - { - string keyinfo = Translate("key id"); - keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } else { - string keyinfo = Translate("key id"); - keyinfo += ": "; - char setting[64]; - strcpy(setting, buf); - strcat(setting, "_KeyID"); - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_KeyID"); + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } -- cgit v1.2.3