diff options
-rw-r--r-- | main.cpp | 10 | ||||
-rw-r--r-- | new_gpg.rc | 19 | ||||
-rw-r--r-- | options.cpp | 21 |
3 files changed, 36 insertions, 14 deletions
@@ -355,7 +355,9 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, {
TranslateDialogDefault(hwndDlg);
ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("RSA"), 0);
- ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 0);
+ ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1);
+ SetDlgItemInt(hwndDlg, IDC_KEY_EXPIRE_DATE, 0, 0);
+ SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 2048, 0);
return TRUE;
}
@@ -655,7 +657,7 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, DWORD code;
string::size_type p = 0, p2 = 0, stop = 0;
{
- wstring cmd = _T("--list-secret-keys");
+ wstring cmd = _T("--list-keys");
if(pxExecute(&cmd, "", &out, &code) == pxNotFound)
{
MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
@@ -665,7 +667,7 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, cp866_to_cp1251(&out);
while(p != string::npos)
{
- if((p = out.find("sec ", p)) == string::npos)
+ if((p = out.find("pub ", p)) == string::npos)
break;
p += 5;
if(p < stop)
@@ -693,7 +695,7 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, tmp = mir_a2t(out.substr(p,p2-p).c_str());
ListView_SetItemText(hwndList, iRow, 1, tmp);
mir_free(tmp);
- p = out.find("ssb ", p2) + 6;
+ p = out.find("sub ", p2) + 6;
p = out.find(" ", p) + 1;
p2 = out.find("\n", p);
tmp = mir_a2t(out.substr(p,p2-p-1).c_str());
@@ -52,20 +52,20 @@ END // Dialog
//
-IDD_LOAD_PUBLIC_KEY DIALOGEX 0, 0, 279, 84
+IDD_LOAD_PUBLIC_KEY DIALOGEX 0, 0, 338, 174
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Load Public GPG key"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "خت",ID_OK,7,63,50,14
- PUSHBUTTON "Load from file",ID_LOAD_FROM_FILE,208,63,54,14
- EDITTEXT IDC_PUBLIC_KEY_EDIT,7,7,255,51,ES_MULTILINE | WS_VSCROLL,WS_EX_STATICEDGE
- PUSHBUTTON "Select existing",IDC_SELECT_EXISTING,109,63,50,14
+ DEFPUSHBUTTON "خت",ID_OK,7,153,50,14
+ PUSHBUTTON "Load from file",ID_LOAD_FROM_FILE,277,153,54,14
+ EDITTEXT IDC_PUBLIC_KEY_EDIT,7,7,324,139,ES_MULTILINE | WS_VSCROLL,WS_EX_STATICEDGE
+ PUSHBUTTON "Select existing",IDC_SELECT_EXISTING,146,153,50,14
END
IDD_FIRST_RUN DIALOGEX 0, 0, 291, 196
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "new GPG Plugin First Run"
+CAPTION "Set own key"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "خت",ID_OK,15,175,50,14,WS_DISABLED
@@ -121,10 +121,11 @@ BEGIN EDITTEXT IDC_KEY_EMAIL,65,76,55,14,ES_AUTOHSCROLL
EDITTEXT IDC_KEY_REAL_NAME,65,61,55,14,ES_AUTOHSCROLL
EDITTEXT IDC_KEY_COMMENT,65,91,55,14,ES_AUTOHSCROLL
- EDITTEXT IDC_KEY_EXPIRE_DATE,65,106,55,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_KEY_EXPIRE_DATE,65,106,55,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "ex.: 2010-08-15 or 0",IDC_STATIC,127,108,68,8
EDITTEXT IDC_KEY_LENGTH,65,30,40,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "From 1024 to 4096",IDC_STATIC,113,33,62,8
+ LTEXT "It can take long time, have patience",IDC_STATIC,15,130,164,8
END
IDD_LOAD_EXISTING_KEY DIALOGEX 0, 0, 316, 156
@@ -149,9 +150,9 @@ BEGIN IDD_LOAD_PUBLIC_KEY, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 272
+ RIGHTMARGIN, 331
TOPMARGIN, 7
- BOTTOMMARGIN, 77
+ BOTTOMMARGIN, 167
END
IDD_FIRST_RUN, DIALOG
diff --git a/options.cpp b/options.cpp index 989b443..61b32fe 100644 --- a/options.cpp +++ b/options.cpp @@ -458,7 +458,26 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP { TranslateDialogDefault(hwndDlg); tmp = UniGetContactSettingUtf(hContact, szModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, (_tcslen(tmp) > 1)?tmp:_T("")); + wstring str = tmp; + mir_free(tmp); + wstring::size_type p = 0, stop = 0; + if(!str.empty()) + { + for(;;) + { + if((p = str.find(_T("\n"), p+2)) != wstring::npos) + { + if(p > stop) + { + stop = p; + str.insert(p, _T("\r")); + } + else + break; + } + } + } + SetDlgItemText(hwndDlg, IDC_PUBLIC_KEY_EDIT, !str.empty()?str.c_str():_T("")); hPubKeyEdit = GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT); return TRUE; } |