From dfe1e876c6d8ad77a66ae242482e8cc2b6be48c3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 7 Aug 2010 21:17:36 +0300 Subject: working.... --- options.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'options.cpp') diff --git a/options.cpp b/options.cpp index 494a4fd..d39cdcb 100644 --- a/options.cpp +++ b/options.cpp @@ -53,26 +53,33 @@ int GpgOptInit(WPARAM wParam,LPARAM lParam) static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { + HWND hwndList=GetDlgItem(hwndDlg, IDC_USERLIST); + LVCOLUMN col; + LVITEM item; + NMLISTVIEW * hdr = (NMLISTVIEW *) lParam; switch (msg) { case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); - HWND hwndList=GetDlgItem(hwndDlg, IDC_USERLIST); - LVCOLUMN col; - LVITEM item; - NMLISTVIEW *hdr; col.pszText = _T("Contact"); col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 100; ListView_InsertColumn(hwndList, 0, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Protocol"); + col.mask = LVCF_TEXT | LVCF_WIDTH; + col.fmt = LVCFMT_LEFT; + col.cx = 30; + ListView_InsertColumn(hwndList, 1, &col); + ZeroMemory(&col,sizeof(col)); col.pszText = _T("PubKey"); col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 250; - ListView_InsertColumn(hwndList, 1, &col); - ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_FULLROWSELECT); + ListView_InsertColumn(hwndList, 2, &col); + ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); int i = 1, iRow = 0; for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact != NULL; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { @@ -83,11 +90,18 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.pszText = name; iRow = ListView_InsertItem(hwndList, &item); ListView_SetItemText(hwndList, iRow, 0, name); - ListView_SetItemText(hwndList, iRow, 1, UniGetContactSettingUtf(hContact, szModuleName, "GPGPubKey", _T("not set"))); + TCHAR *tmp = mir_a2t((char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); + ListView_SetItemText(hwndList, iRow, 1, tmp); + mir_free(tmp); + ListView_SetItemText(hwndList, iRow, 2, UniGetContactSettingUtf(hContact, szModuleName, "GPGPubKey", _T("not set"))); + if(DBGetContactSettingByte(hContact, szModuleName, "GPGEncryption", 0)) + ListView_SetItemState(hwndList, iRow, 0x2000, 0xF000); + ZeroMemory(&item,sizeof(item)); i++; } ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); return TRUE; } @@ -96,6 +110,8 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { switch (LOWORD(wParam)) { + case IDC_USERLIST: + break; default: break; } @@ -106,6 +122,10 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY: { + if(hdr && hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom) && hdr->iItem != (-1)) + { + int iIndex = hdr->iItem; + } switch (((LPNMHDR)lParam)->code) { -- cgit v1.2.3