diff options
Diffstat (limited to 'src/modules/userinfo/contactinfo.cpp')
-rw-r--r-- | src/modules/userinfo/contactinfo.cpp | 318 |
1 files changed, 159 insertions, 159 deletions
diff --git a/src/modules/userinfo/contactinfo.cpp b/src/modules/userinfo/contactinfo.cpp index 8b8c7ae66d..42658c8fd1 100644 --- a/src/modules/userinfo/contactinfo.cpp +++ b/src/modules/userinfo/contactinfo.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -29,22 +29,22 @@ static INT_PTR CALLBACK EditUserEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar {
switch(msg) {
case WM_INITDIALOG:
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
- if (*(char*)lParam) SetWindowText(hwndDlg,TranslateT("Edit E-Mail Address"));
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
+ if (*(char*)lParam) SetWindowText(hwndDlg, TranslateT("Edit E-Mail Address"));
TranslateDialogDefault(hwndDlg);
- SetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)lParam);
- EnableWindow(GetDlgItem(hwndDlg,IDOK),*(char*)lParam);
+ SetDlgItemTextA(hwndDlg, IDC_EMAIL, (char*)lParam);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), *(char*)lParam);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
- GetDlgItemTextA(hwndDlg,IDC_EMAIL,(char*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA),256);
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, (char*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA), 256);
//fall through
case IDCANCEL:
- EndDialog(hwndDlg,wParam);
+ EndDialog(hwndDlg, wParam);
case IDC_EMAIL:
if (HIWORD(wParam) == EN_CHANGE)
- EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_EMAIL)));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_EMAIL)));
break;
}
break;
@@ -59,57 +59,57 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar switch(msg) {
case WM_INITDIALOG:
{ char *szText=(char*)lParam;
- int i,item,countryCount;
+ int i, item, countryCount;
struct CountryListEntry *countries;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
- if (szText[0]) SetWindowText(hwndDlg,TranslateT("Edit Phone Number"));
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
+ if (szText[0]) SetWindowText(hwndDlg, TranslateT("Edit Phone Number"));
TranslateDialogDefault(hwndDlg);
- if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4," SMS")) {
- CheckDlgButton(hwndDlg,IDC_SMS,BST_CHECKED);
+ if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4, " SMS")) {
+ CheckDlgButton(hwndDlg, IDC_SMS, BST_CHECKED);
szText[lstrlenA(szText)-4]='\0';
}
- EnableWindow(GetDlgItem(hwndDlg,IDOK),szText[0]);
- SendDlgItemMessage(hwndDlg,IDC_AREA,EM_LIMITTEXT,31,0);
- SendDlgItemMessage(hwndDlg,IDC_NUMBER,EM_LIMITTEXT,63,0);
- CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&countryCount,(LPARAM)&countries);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), szText[0]);
+ SendDlgItemMessage(hwndDlg, IDC_AREA, EM_LIMITTEXT, 31, 0);
+ SendDlgItemMessage(hwndDlg, IDC_NUMBER, EM_LIMITTEXT, 63, 0);
+ CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
for (i=0;i<countryCount;i++) {
if (countries[i].id == 0 || countries[i].id == 0xFFFF) continue;
- item=SendDlgItemMessageA(hwndDlg,IDC_COUNTRY,CB_ADDSTRING,0,(LPARAM)Translate(countries[i].szName));
- SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETITEMDATA,item,countries[i].id);
+ item=SendDlgItemMessageA(hwndDlg, IDC_COUNTRY, CB_ADDSTRING, 0, (LPARAM)Translate(countries[i].szName));
+ SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETITEMDATA, item, countries[i].id);
}
- SetDlgItemTextA(hwndDlg,IDC_PHONE,szText);
+ SetDlgItemTextA(hwndDlg, IDC_PHONE, szText);
return TRUE;
}
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
- { char *szText=(char*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ { char *szText=(char*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
int isValid=1;
- GetDlgItemTextA(hwndDlg,IDC_PHONE,szText,252);
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, 252);
if (lstrlenA(szText)<7 || szText[0] != '+') isValid=0;
- if (isValid) isValid=(lstrlenA(szText+1) == (int)strspn(szText+1,"0123456789 ()-"));
+ if (isValid) isValid=(lstrlenA(szText+1) == (int)strspn(szText+1, "0123456789 ()-"));
if (!isValid) {
- MessageBox(hwndDlg,TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."),TranslateT("Invalid Phone Number"),MB_OK);
+ MessageBox(hwndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid Phone Number"), MB_OK);
break;
}
- if (IsDlgButtonChecked(hwndDlg,IDC_SMS)) lstrcatA(szText," SMS");
+ if (IsDlgButtonChecked(hwndDlg, IDC_SMS)) lstrcatA(szText, " SMS");
}
//fall through
case IDCANCEL:
- EndDialog(hwndDlg,wParam);
+ EndDialog(hwndDlg, wParam);
case IDC_COUNTRY:
if (HIWORD(wParam) != CBN_SELCHANGE) break;
case IDC_AREA:
case IDC_NUMBER:
if (LOWORD(wParam) != IDC_COUNTRY && HIWORD(wParam) != EN_CHANGE) break;
if (noRecursion) break;
- EnableWindow(GetDlgItem(hwndDlg,IDOK),TRUE);
- { char szPhone[96],szArea[32],szNumber[64];
- GetDlgItemTextA(hwndDlg,IDC_AREA,szArea,SIZEOF(szArea));
- GetDlgItemTextA(hwndDlg,IDC_NUMBER,szNumber,SIZEOF(szNumber));
- mir_snprintf(szPhone,SIZEOF(szPhone),"+%u (%s) %s",SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_GETCURSEL,0,0),0),szArea,szNumber);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
+ { char szPhone[96], szArea[32], szNumber[64];
+ GetDlgItemTextA(hwndDlg, IDC_AREA, szArea, SIZEOF(szArea));
+ GetDlgItemTextA(hwndDlg, IDC_NUMBER, szNumber, SIZEOF(szNumber));
+ mir_snprintf(szPhone, SIZEOF(szPhone), "+%u (%s) %s", SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETCURSEL, 0, 0), 0), szArea, szNumber);
noRecursion=1;
- SetDlgItemTextA(hwndDlg,IDC_PHONE,szPhone);
+ SetDlgItemTextA(hwndDlg, IDC_PHONE, szPhone);
noRecursion=0;
}
break;
@@ -118,9 +118,9 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (noRecursion) break;
noRecursion=1;
{
- char szText[256],*pText=NULL,*pArea,*pNumber;
+ char szText[256], *pText=NULL, *pArea, *pNumber;
int isValid=1;
- GetDlgItemTextA(hwndDlg,IDC_PHONE,szText,SIZEOF(szText));
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, SIZEOF(szText));
if (szText[0] != '+')
isValid=0;
@@ -130,8 +130,8 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar isValid = 0;
else {
for ( i = SendDlgItemMessage( hwndDlg, IDC_COUNTRY, CB_GETCOUNT, 0, 0 )-1; i >= 0; i-- )
- if ( country == SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_GETITEMDATA,i,0)) {
- SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETCURSEL,i,0);
+ if ( country == SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_GETITEMDATA, i, 0)) {
+ SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, i, 0);
break;
}
if ( i < 0 )
@@ -139,23 +139,23 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar }
}
if ( isValid ) {
- pArea = pText+strcspn(pText,"0123456789");
- pText = pArea+strspn(pArea,"0123456789");
+ pArea = pText+strcspn(pText, "0123456789");
+ pText = pArea+strspn(pArea, "0123456789");
if (*pText) {
*pText='\0';
- pNumber = pText+1+strcspn(pText+1,"0123456789");
- SetDlgItemTextA(hwndDlg,IDC_NUMBER,pNumber);
+ pNumber = pText+1+strcspn(pText+1, "0123456789");
+ SetDlgItemTextA(hwndDlg, IDC_NUMBER, pNumber);
}
- SetDlgItemTextA(hwndDlg,IDC_AREA,pArea);
+ SetDlgItemTextA(hwndDlg, IDC_AREA, pArea);
}
if ( !isValid ) {
- SendDlgItemMessage(hwndDlg,IDC_COUNTRY,CB_SETCURSEL,-1,0);
- SetDlgItemTextA(hwndDlg,IDC_AREA,"");
- SetDlgItemTextA(hwndDlg,IDC_NUMBER,"");
+ SendDlgItemMessage(hwndDlg, IDC_COUNTRY, CB_SETCURSEL, -1, 0);
+ SetDlgItemTextA(hwndDlg, IDC_AREA, "");
+ SetDlgItemTextA(hwndDlg, IDC_NUMBER, "");
}
}
noRecursion=0;
- EnableWindow(GetDlgItem(hwndDlg,IDOK),GetWindowTextLength(GetDlgItem(hwndDlg,IDC_PHONE)));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_PHONE)));
break;
}
break;
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar return FALSE;
}
-static int IsOverEmail(HWND hwndDlg,TCHAR* szEmail,int cchEmail)
+static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail)
{
RECT rc;
HWND hwndEmails;
@@ -172,23 +172,23 @@ static int IsOverEmail(HWND hwndDlg,TCHAR* szEmail,int cchEmail) SIZE textSize;
LVHITTESTINFO hti;
- hwndEmails=GetDlgItem(hwndDlg,IDC_EMAILS);
+ hwndEmails=GetDlgItem(hwndDlg, IDC_EMAILS);
GetCursorPos(&hti.pt);
- ScreenToClient(hwndEmails,&hti.pt);
- GetClientRect(hwndEmails,&rc);
- if (!PtInRect(&rc,hti.pt)) return 0;
- if (ListView_SubItemHitTest(hwndEmails,&hti) == -1) return 0;
+ ScreenToClient(hwndEmails, &hti.pt);
+ GetClientRect(hwndEmails, &rc);
+ if (!PtInRect(&rc, hti.pt)) return 0;
+ if (ListView_SubItemHitTest(hwndEmails, &hti) == -1) return 0;
if (hti.iSubItem != 1) return 0;
if (!(hti.flags&LVHT_ONITEMLABEL)) return 0;
- ListView_GetSubItemRect(hwndEmails,hti.iItem,1,LVIR_LABEL,&rc);
+ ListView_GetSubItemRect(hwndEmails, hti.iItem, 1, LVIR_LABEL, &rc);
szText[0] = 0;
- ListView_GetItemText(hwndEmails,hti.iItem,1,szText,SIZEOF(szText));
+ ListView_GetItemText(hwndEmails, hti.iItem, 1, szText, SIZEOF(szText));
hdc=GetDC(hwndEmails);
- SelectObject(hdc,hEmailFont);
- GetTextExtentPoint32(hdc,szText,lstrlen(szText),&textSize);
- ReleaseDC(hwndEmails,hdc);
+ SelectObject(hdc, hEmailFont);
+ GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textSize);
+ ReleaseDC(hwndEmails, hdc);
if (hti.pt.x<rc.left+textSize.cx) {
- if (szEmail && cchEmail) lstrcpyn(szEmail,szText,cchEmail);
+ if (szEmail && cchEmail) lstrcpyn(szEmail, szText, cchEmail);
return 1;
}
return 0;
@@ -199,40 +199,40 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
switch(msg) {
case WM_INITDIALOG:
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)lParam);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
if (hEmailFont) DeleteObject(hEmailFont);
{ LOGFONT lf;
- hEmailFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_EMAILS,WM_GETFONT,0,0);
- GetObject(hEmailFont,sizeof(lf),&lf);
+ hEmailFont=(HFONT)SendDlgItemMessage(hwndDlg, IDC_EMAILS, WM_GETFONT, 0, 0);
+ GetObject(hEmailFont, sizeof(lf), &lf);
lf.lfUnderline=1;
hEmailFont=CreateFontIndirect(&lf);
}
if (hHandCursor == NULL) {
- if (IsWinVer2000Plus()) hHandCursor=LoadCursor(NULL,IDC_HAND);
- else hHandCursor=LoadCursor(hMirandaInst,MAKEINTRESOURCE(IDC_HYPERLINKHAND));
+ if (IsWinVer2000Plus()) hHandCursor=LoadCursor(NULL, IDC_HAND);
+ else hHandCursor=LoadCursor(hMirandaInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
}
TranslateDialogDefault(hwndDlg);
{ LVCOLUMN lvc;
RECT rc;
- GetClientRect(GetDlgItem(hwndDlg,IDC_EMAILS),&rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_EMAILS), &rc);
rc.right-=GetSystemMetrics(SM_CXVSCROLL);
lvc.mask=LVCF_WIDTH;
- ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg,IDC_EMAILS), LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
- ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg,IDC_PHONES), LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
+ ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg, IDC_EMAILS), LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
+ ListView_SetExtendedListViewStyleEx(GetDlgItem(hwndDlg, IDC_PHONES), LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP);
lvc.cx=rc.right/4;
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_EMAILS),0,&lvc);
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PHONES),0,&lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 0, &lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 0, &lvc);
lvc.cx=rc.right-rc.right/4-40;
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_EMAILS),1,&lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 1, &lvc);
lvc.cx=rc.right-rc.right/4-90;
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PHONES),1,&lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 1, &lvc);
lvc.cx=50;
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PHONES),2,&lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 2, &lvc);
lvc.cx=20;
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_EMAILS),2,&lvc);
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_EMAILS),3,&lvc);
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PHONES),3,&lvc);
- ListView_InsertColumn(GetDlgItem(hwndDlg,IDC_PHONES),4,&lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 2, &lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_EMAILS), 3, &lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 3, &lvc);
+ ListView_InsertColumn(GetDlgItem(hwndDlg, IDC_PHONES), 4, &lvc);
}
break;
case M_REMAKELISTS:
@@ -242,116 +242,116 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char idstr[33];
TCHAR idstr2[33];
DBVARIANT dbv;
- HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hContact != NULL) {
- szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0);
+ szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto == NULL) break;
//e-mails
- ListView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_EMAILS));
+ ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_EMAILS));
lvi.mask=LVIF_TEXT|LVIF_PARAM;
lvi.lParam=(LPARAM)(-1);
lvi.iSubItem=0;
lvi.iItem=0;
for (i=-1;;i++) {
if (i == -1) {
- if (DBGetContactSettingTString(hContact,szProto,"e-mail",&dbv))
+ if (DBGetContactSettingTString(hContact, szProto, "e-mail", &dbv))
continue;
lvi.pszText=TranslateT("Primary");
}
else {
mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i );
- if (DBGetContactSettingTString(hContact,szProto,idstr,&dbv))
+ if (DBGetContactSettingTString(hContact, szProto, idstr, &dbv))
break;
lvi.pszText=idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), _T("%d"),i+2);
+ mir_sntprintf(idstr2, SIZEOF(idstr2), _T("%d"), i+2);
}
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_EMAILS),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_EMAILS),lvi.iItem,1,dbv.ptszVal);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
lvi.iSubItem=0;
for (i=0;;i++) {
lvi.lParam=i;
- mir_snprintf(idstr, SIZEOF(idstr), "Mye-mail%d",i);
- if (DBGetContactSettingTString(hContact,"UserInfo",idstr,&dbv))
+ mir_snprintf(idstr, SIZEOF(idstr), "Mye-mail%d", i);
+ if (DBGetContactSettingTString(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText=idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"),i+1);
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_EMAILS),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_EMAILS),lvi.iItem,1,dbv.ptszVal);
+ mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_EMAILS), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
lvi.mask=LVIF_PARAM;
lvi.lParam=(LPARAM)(-2);
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_EMAILS),&lvi);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
//phones
- ListView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_PHONES));
+ ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PHONES));
lvi.mask=LVIF_TEXT|LVIF_PARAM;
lvi.lParam=(LPARAM)(-1);
lvi.iSubItem=0;
lvi.iItem=0;
- if (!DBGetContactSettingTString(hContact,szProto,"Phone",&dbv)) {
+ if (!DBGetContactSettingTString(hContact, szProto, "Phone", &dbv)) {
lvi.pszText=TranslateT("Primary");
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact,szProto,"Fax",&dbv)) {
+ if (!DBGetContactSettingTString(hContact, szProto, "Fax", &dbv)) {
lvi.pszText=TranslateT("Fax");
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact,szProto,"Cellular",&dbv)) {
+ if (!DBGetContactSettingTString(hContact, szProto, "Cellular", &dbv)) {
lvi.pszText=TranslateT("Mobile");
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4," SMS")) {
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,2,_T("y"));
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4, " SMS")) {
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y"));
dbv.ptszVal[lstrlen(dbv.ptszVal)-4]='\0';
}
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact,szProto,"CompanyPhone",&dbv)) {
+ if (!DBGetContactSettingTString(hContact, szProto, "CompanyPhone", &dbv)) {
lvi.pszText=TranslateT("Work Phone");
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
- if (!DBGetContactSettingTString(hContact,szProto,"CompanyFax",&dbv)) {
+ if (!DBGetContactSettingTString(hContact, szProto, "CompanyFax", &dbv)) {
lvi.pszText=TranslateT("Work Fax");
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
lvi.iSubItem=0;
for (i=0;;i++) {
lvi.lParam=i;
- mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d",i);
- if (DBGetContactSettingTString(hContact,"UserInfo",idstr,&dbv))
+ mir_snprintf(idstr, SIZEOF(idstr), "MyPhone%d", i);
+ if (DBGetContactSettingTString(hContact, "UserInfo", idstr, &dbv))
break;
lvi.pszText=idstr2;
- mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"),i+1);
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
- if (lstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+lstrlen(dbv.ptszVal)-4,_T(" SMS"))) {
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,2,_T("y"));
+ mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
+ if (lstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+lstrlen(dbv.ptszVal)-4, _T(" SMS"))) {
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y"));
dbv.ptszVal[lstrlen(dbv.ptszVal)-4]='\0';
}
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_PHONES),lvi.iItem,1,dbv.ptszVal);
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
DBFreeVariant(&dbv);
lvi.iItem++;
}
lvi.mask=LVIF_PARAM;
lvi.lParam=(LPARAM)(-2);
- ListView_InsertItem(GetDlgItem(hwndDlg,IDC_PHONES),&lvi);
+ ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
}
break;
}
@@ -360,7 +360,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_INFOCHANGED:
- SendMessage(hwndDlg,M_REMAKELISTS,0,0);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
break;
}
break;
@@ -372,21 +372,21 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch(nm->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
case CDDS_ITEMPREPAINT:
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_NOTIFYSUBITEMDRAW);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
return TRUE;
case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
{
RECT rc;
- ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,LVIR_LABEL,&rc);
+ ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
if (nm->iSubItem == 1 && nm->nmcd.hdr.idFrom == IDC_EMAILS) {
HFONT hoFont;
TCHAR szText[256] = {0};
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText));
- hoFont=(HFONT)SelectObject(nm->nmcd.hdc,hEmailFont);
- SetTextColor(nm->nmcd.hdc,RGB(0,0,255));
- DrawText(nm->nmcd.hdc,szText,-1,&rc,DT_END_ELLIPSIS|DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_TOP);
- SelectObject(nm->nmcd.hdc,hoFont);
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_SKIPDEFAULT);
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
+ hoFont=(HFONT)SelectObject(nm->nmcd.hdc, hEmailFont);
+ SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255));
+ DrawText(nm->nmcd.hdc, szText, -1, &rc, DT_END_ELLIPSIS|DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_TOP);
+ SelectObject(nm->nmcd.hdc, hoFont);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
@@ -394,18 +394,18 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (nm->nmcd.lItemlParam == (LPARAM)(-2) && nm->iSubItem-3 == (nm->nmcd.hdr.idFrom == IDC_PHONES))
hIcon = LoadSkinIcon( SKINICON_OTHER_ADDCONTACT );
else if (nm->iSubItem>1 && nm->nmcd.lItemlParam != (LPARAM)(-1) && nm->nmcd.lItemlParam != (LPARAM)(-2)) {
- static int iconResources[3]={SKINICON_OTHER_RENAME,SKINICON_OTHER_DELETE};
+ static int iconResources[3]={SKINICON_OTHER_RENAME, SKINICON_OTHER_DELETE};
if (nm->iSubItem == 2 && nm->nmcd.hdr.idFrom == IDC_PHONES) {
TCHAR szText[2];
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom,nm->nmcd.dwItemSpec,nm->iSubItem,szText,SIZEOF(szText));
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
if (szText[0]) hIcon = LoadSkinIcon( SKINICON_OTHER_SMS );
}
else hIcon = LoadSkinIcon( iconResources[nm->iSubItem-3+(nm->nmcd.hdr.idFrom == IDC_EMAILS)] );
}
else break;
- DrawIconEx(nm->nmcd.hdc,(rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2,(rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
+ DrawIconEx(nm->nmcd.hdc, (rc.left+rc.right-GetSystemMetrics(SM_CXSMICON))/2, (rc.top+rc.bottom-GetSystemMetrics(SM_CYSMICON))/2, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
IconLib_ReleaseIcon(hIcon, 0);
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,CDRF_SKIPDEFAULT);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
}
}
@@ -415,41 +415,41 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { NMLISTVIEW *nm=(NMLISTVIEW*)lParam;
LVITEM lvi;
TCHAR szEmail[256];
- HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ HANDLE hContact=(HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char *szIdTemplate=nm->hdr.idFrom == IDC_PHONES?"MyPhone%d":"Mye-mail%d";
LVHITTESTINFO hti;
- if (IsOverEmail(hwndDlg,szEmail,SIZEOF(szEmail))) {
+ if (IsOverEmail(hwndDlg, szEmail, SIZEOF(szEmail))) {
TCHAR szExec[264];
mir_sntprintf(szExec, SIZEOF(szExec), _T("mailto:%s"), szEmail);
- ShellExecute(hwndDlg,_T("open"),szExec,NULL,NULL,SW_SHOW);
+ ShellExecute(hwndDlg, _T("open"), szExec, NULL, NULL, SW_SHOW);
break;
}
if (nm->iSubItem<2) break;
hti.pt.x=(short)LOWORD(GetMessagePos());
hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(nm->hdr.hwndFrom,&hti.pt);
- if (ListView_SubItemHitTest(nm->hdr.hwndFrom,&hti) == -1) break;
+ ScreenToClient(nm->hdr.hwndFrom, &hti.pt);
+ if (ListView_SubItemHitTest(nm->hdr.hwndFrom, &hti) == -1) break;
lvi.mask=LVIF_PARAM;
lvi.iItem=hti.iItem;
lvi.iSubItem=0;
- ListView_GetItem(nm->hdr.hwndFrom,&lvi);
+ ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == (LPARAM)(-1)) break;
if (lvi.lParam == (LPARAM)(-2)) {
if (hti.iSubItem-3 == (nm->hdr.idFrom == IDC_PHONES)) {
//add
- char szNewData[256]="",idstr[33];
+ char szNewData[256]="", idstr[33];
int i;
DBVARIANT dbv;
- if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szNewData))
+ if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szNewData))
break;
for (i=0;;i++) {
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i);
- if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break;
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
+ if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
DBFreeVariant(&dbv);
}
- DBWriteContactSettingString(hContact,"UserInfo",idstr,szNewData);
- SendMessage(hwndDlg,M_REMAKELISTS,0,0);
+ DBWriteContactSettingString(hContact, "UserInfo", idstr, szNewData);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
else {
@@ -459,28 +459,28 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char idstr[33];
DBVARIANT dbv;
for (i=lvi.lParam;;i++) {
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i+1);
- if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break;
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i);
- DBWriteContactSettingString(hContact,"UserInfo",idstr,dbv.pszVal);
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i+1);
+ if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
+ DBWriteContactSettingString(hContact, "UserInfo", idstr, dbv.pszVal);
DBFreeVariant(&dbv);
}
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,i);
- DBDeleteContactSetting(hContact,"UserInfo",idstr);
- SendMessage(hwndDlg,M_REMAKELISTS,0,0);
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
+ DBDeleteContactSetting(hContact, "UserInfo", idstr);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
else if (hti.iSubItem-2 == (nm->hdr.idFrom == IDC_PHONES)) {
//edit
- char szText[256],idstr[33];
+ char szText[256], idstr[33];
DBVARIANT dbv;
- mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate,lvi.lParam);
- if (DBGetContactSettingString(hContact,"UserInfo",idstr,&dbv)) break;
- lstrcpynA(szText,dbv.pszVal,SIZEOF(szText));
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam);
+ if (DBGetContactSettingString(hContact, "UserInfo", idstr, &dbv)) break;
+ lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
DBFreeVariant(&dbv);
- if (IDOK != DialogBoxParam(hMirandaInst,MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL),hwndDlg,nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc,(LPARAM)szText))
+ if (IDOK != DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
break;
- DBWriteContactSettingString(hContact,"UserInfo",idstr,szText);
- SendMessage(hwndDlg,M_REMAKELISTS,0,0);
+ DBWriteContactSettingString(hContact, "UserInfo", idstr, szText);
+ SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
break;
@@ -494,19 +494,19 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (GetForegroundWindow() == GetParent(hwndDlg)) {
POINT pt;
GetCursorPos(&pt);
- ScreenToClient(hwndDlg,&pt);
-// SetFocus(ChildWindowFromPoint(hwndDlg,pt)); //ugly hack because listviews ignore their first click
+ ScreenToClient(hwndDlg, &pt);
+// SetFocus(ChildWindowFromPoint(hwndDlg, pt)); //ugly hack because listviews ignore their first click
}
- if (IsOverEmail(hwndDlg,NULL,0)) {
+ if (IsOverEmail(hwndDlg, NULL, 0)) {
SetCursor(hHandCursor);
- SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,TRUE);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
- SendMessage(GetParent(hwndDlg),msg,wParam,lParam);
+ SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
break;
}
break;
|