diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/UserInfoEx/src/classPsTree.cpp | 30 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_base.h | 32 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_combo.cpp | 85 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_contact.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_edit.cpp | 34 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 11 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_profile.cpp | 26 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_contactinfo.cpp | 58 |
9 files changed, 126 insertions, 154 deletions
diff --git a/plugins/UserInfoEx/src/classPsTree.cpp b/plugins/UserInfoEx/src/classPsTree.cpp index 3f49b202e5..6cbd32fe43 100644 --- a/plugins/UserInfoEx/src/classPsTree.cpp +++ b/plugins/UserInfoEx/src/classPsTree.cpp @@ -718,7 +718,6 @@ void CPsTree::PopupMenu() { HMENU hPopup; TVHITTESTINFO hti; - TVITEM tvi; POINT pt; int iItem, i; @@ -728,17 +727,18 @@ void CPsTree::PopupMenu() MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STRING|MIIM_ID; + mii.fMask = MIIM_STRING | MIIM_ID; // get cursor postion GetCursorPos(&pt); hti.pt = pt; ScreenToClient(_hWndTree, &hti.pt); - tvi.mask = TVIF_PARAM|TVIF_CHILDREN; + TVITEM tvi = { 0 }; + tvi.mask = TVIF_PARAM | TVIF_CHILDREN; // find treeitem under cursor TreeView_HitTest(_hWndTree, &hti); - if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT)) { + if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) { tvi.hItem = hti.hItem; TreeView_GetItem(_hWndTree, &tvi); @@ -747,7 +747,7 @@ void CPsTree::PopupMenu() mii.wID = 32001; InsertMenuItem(hPopup, 0, FALSE, &mii); } - + // do not allow hiding groups if (tvi.cChildren) { mii.fMask |= MIIM_STATE; @@ -779,7 +779,7 @@ void CPsTree::PopupMenu() InsertMenuItem(hPopup, 1, TRUE, &mii); InsertMenuItem(hPopup, ++i, TRUE, &mii); } - mii.fMask &= ~(MIIM_FTYPE|MIIM_STATE); + mii.fMask &= ~(MIIM_FTYPE | MIIM_STATE); mii.dwTypeData = TranslateT("Reset to defaults"); mii.wID = 32004; InsertMenuItem(hPopup, ++i, TRUE, &mii); @@ -787,22 +787,18 @@ void CPsTree::PopupMenu() // show the popup menu iItem = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, _hWndTree, NULL); DestroyMenu(hPopup); - + switch (iItem) { - // hide the item - case 32000: + case 32000: // hide the item HideItem(tvi.lParam); break; - // rename the item - case 32001: + case 32001: // rename the item BeginLabelEdit(tvi.hItem); break; - // reset current tree - case 32004: + case 32004: // reset current tree DBResetState(); break; - // show a hidden item - default: + default: // show a hidden item if ((iItem -= 100) >= 0 && ShowItem(iItem, NULL)) AddFlags(PSTVF_STATE_CHANGED | PSTVF_POS_CHANGED); break; @@ -863,9 +859,9 @@ BYTE CPsTree::OnInfoChanged() * return: nothing **/ BYTE CPsTree::OnSelChanging() -{ +{ CPsTreeItem *pti = CurrentItem(); - + if (pti != NULL) { TreeView_SetItemState(_hWndTree, pti->Hti(), 0, TVIS_SELECTED); if (pti->Wnd() != NULL) { diff --git a/plugins/UserInfoEx/src/ctrl_base.h b/plugins/UserInfoEx/src/ctrl_base.h index bb90bd691f..9bfd74b425 100644 --- a/plugins/UserInfoEx/src/ctrl_base.h +++ b/plugins/UserInfoEx/src/ctrl_base.h @@ -60,22 +60,22 @@ union CCtrlFlags WORD W;
struct CBits
{
- BYTE hasChanged : 1;
- BYTE hasProto : 1;
- BYTE hasCustom : 1;
- BYTE hasMeta : 1;
- BYTE bit_04 : 1;
- BYTE bit_05 : 1;
- BYTE bit_06 : 1;
- BYTE bit_07 : 1;
- BYTE bit_08 : 1;
- BYTE bit_09 : 1;
- BYTE bit_10 : 1;
- BYTE bit_11 : 1;
- BYTE bit_12 : 1;
- BYTE bit_13 : 1;
- BYTE bit_14 : 1;
- BYTE bit_15 : 1;
+ bool hasChanged : 1;
+ bool hasProto : 1;
+ bool hasCustom : 1;
+ bool hasMeta : 1;
+ bool bit_04 : 1;
+ bool bit_05 : 1;
+ bool bit_06 : 1;
+ bool bit_07 : 1;
+ bool bit_08 : 1;
+ bool bit_09 : 1;
+ bool bit_10 : 1;
+ bool bit_11 : 1;
+ bool bit_12 : 1;
+ bool bit_13 : 1;
+ bool bit_14 : 1;
+ bool bit_15 : 1;
} B;
};
diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp index e8eb9a4387..4677b94a8c 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.cpp +++ b/plugins/UserInfoEx/src/ctrl_combo.cpp @@ -52,7 +52,7 @@ CBaseCtrl* CCombo::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE bDB * @return nothing
**/
CCombo::CCombo(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE bDBDataType, LPIDSTRLIST pList, int nListCount)
-: CBaseCtrl(hDlg, idCtrl, pszSetting)
+ : CBaseCtrl(hDlg, idCtrl, pszSetting)
{
_curSel = CB_ERR;
_pList = pList;
@@ -60,10 +60,8 @@ CCombo::CCombo(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE bDBDataType, LPID _bDataType = bDBDataType;
// fill in data
- if (_pList && (_nList > 0))
- {
- for (int i = 0; i < _nList; i++)
- {
+ if (_pList && (_nList > 0)) {
+ for (int i = 0; i < _nList; i++) {
AddItem(_pList[i].ptszTranslated, (LPARAM)&_pList[i]);
}
}
@@ -82,11 +80,9 @@ int CCombo::Find(int nID) const int i;
LPIDSTRLIST pd;
- for (i = ComboBox_GetCount(_hwnd) - 1; i >= 0; i--)
- {
+ for (i = ComboBox_GetCount(_hwnd) - 1; i >= 0; i--) {
pd = (LPIDSTRLIST)ComboBox_GetItemData(_hwnd, i);
- if (PtrIsValid(pd) && (pd->nID == nID))
- {
+ if (PtrIsValid(pd) && (pd->nID == nID)) {
break;
}
}
@@ -117,10 +113,8 @@ int CCombo::Find(LPTSTR ptszItemLabel) const INT_PTR CCombo::AddItem(LPCTSTR pszText, LPARAM lParam)
{
INT_PTR added = ComboBox_AddString(_hwnd, pszText);
- if (SUCCEEDED(added))
- {
- if (PtrIsValid(lParam) && FAILED(ComboBox_SetItemData(_hwnd, added, lParam)))
- {
+ if (SUCCEEDED(added)) {
+ if (PtrIsValid(lParam) && FAILED(ComboBox_SetItemData(_hwnd, added, lParam))) {
ComboBox_DeleteString(_hwnd, added);
added = CB_ERR;
}
@@ -150,22 +144,19 @@ void CCombo::Release() **/
BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
{
- if (!_Flags.B.hasChanged && _pList != NULL)
- {
+ if (!_Flags.B.hasChanged && _pList != NULL) {
DBVARIANT dbv;
int iVal = CB_ERR;
- _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = 0;
+ _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = false;
_Flags.W |= DB::Setting::GetTStringCtrl(hContact, USERINFO, USERINFO, pszProto, _pszSetting, &dbv);
- EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0));
+ EnableWindow(_hwnd, !hContact || _Flags.B.hasCustom || !db_get_b(NULL, MODNAME, SET_PROPSHEET_PCBIREADONLY, 0));
- if (_Flags.B.hasCustom || _Flags.B.hasProto || _Flags.B.hasMeta)
- {
- switch (dbv.type)
- {
- case DBVT_BYTE: iVal = Find((int)dbv.bVal); break;
- case DBVT_WORD: iVal = Find((int)dbv.wVal); break;
- case DBVT_DWORD: iVal = Find((int)dbv.dVal); break;
+ if (_Flags.B.hasCustom || _Flags.B.hasProto || _Flags.B.hasMeta) {
+ switch (dbv.type) {
+ case DBVT_BYTE: iVal = Find((int)dbv.bVal); break;
+ case DBVT_WORD: iVal = Find((int)dbv.wVal); break;
+ case DBVT_DWORD: iVal = Find((int)dbv.dVal); break;
case DBVT_TCHAR:
iVal = Find(TranslateTS(dbv.ptszVal));
if (iVal == CB_ERR) {
@@ -174,15 +165,14 @@ BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) }
}
}
- if (iVal == CB_ERR)
- {
+ if (iVal == CB_ERR) {
// unspecified
iVal = Find(_pList[0].nID);
}
db_free(&dbv);
ComboBox_SetCurSel(_hwnd, iVal);
_curSel = ComboBox_GetCurSel(_hwnd);
- SendMessage(GetParent(_hwnd), WM_COMMAND, MAKEWPARAM( (WORD)this->_idCtrl, (WORD)CBN_SELCHANGE), (LPARAM)_hwnd);
+ SendMessage(GetParent(_hwnd), WM_COMMAND, MAKEWPARAM((WORD)this->_idCtrl, (WORD)CBN_SELCHANGE), (LPARAM)_hwnd);
}
return _Flags.B.hasChanged;
}
@@ -197,19 +187,15 @@ BOOL CCombo::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) **/
void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto)
{
- if (_Flags.B.hasChanged)
- {
+ if (_Flags.B.hasChanged) {
LPCSTR pszModule = hContact ? USERINFO : pszProto;
- if ((_Flags.B.hasCustom || !hContact) && (_curSel != CB_ERR))
- {
+ if ((_Flags.B.hasCustom || !hContact) && (_curSel != CB_ERR)) {
LPIDSTRLIST pd;
pd = (LPIDSTRLIST)SendMessage(_hwnd, CB_GETITEMDATA, _curSel, 0);
- if (pd != NULL)
- {
- switch (_bDataType)
- {
+ if (pd != NULL) {
+ switch (_bDataType) {
case DBVT_BYTE:
db_set_b(hContact, pszModule, _pszSetting, pd->nID);
break;
@@ -223,18 +209,16 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) case DBVT_WCHAR:
db_set_s(hContact, pszModule, _pszSetting, (LPSTR)pd->pszText);
}
- if (!hContact)
- {
- _Flags.B.hasCustom = 0;
- _Flags.B.hasProto = 1;
+ if (!hContact) {
+ _Flags.B.hasCustom = false;
+ _Flags.B.hasProto = true;
}
- _Flags.B.hasChanged = 0;
+ _Flags.B.hasChanged = false;
}
}
- if (_Flags.B.hasChanged)
- {
+ if (_Flags.B.hasChanged) {
db_unset(hContact, pszModule, _pszSetting);
- _Flags.B.hasChanged = 0;
+ _Flags.B.hasChanged = false;
OnInfoChanged(hContact, pszProto);
}
InvalidateRect(_hwnd, NULL, TRUE);
@@ -244,24 +228,19 @@ void CCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) /**
* The user changed combobox selection, so mark it changed.
*
- * @return nothing
**/
void CCombo::OnChangedByUser(WORD wChangedMsg)
{
- if (wChangedMsg == CBN_SELCHANGE)
- {
+ if (wChangedMsg == CBN_SELCHANGE) {
int c = ComboBox_GetCurSel(_hwnd);
- if (_curSel != c)
- {
- if (!_Flags.B.hasChanged)
- {
- _Flags.B.hasChanged = 1;
- _Flags.B.hasCustom = 1;
+ if (_curSel != c) {
+ if (!_Flags.B.hasChanged) {
+ _Flags.B.hasChanged = _Flags.B.hasCustom = true;
SendMessage(GetParent(GetParent(_hwnd)), PSM_CHANGED, 0, 0);
}
_curSel = c;
}
}
}
-
+
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 20d64d6b23..cd4b185f01 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -303,7 +303,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat);
// save SMS flag
- if (IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS))
+ if ((int)IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS))
cbi->wFlags ^= CBEXIF_SMS;
}
//fall through
diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index e627eb5882..c67e39e0bd 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -42,7 +42,7 @@ CBaseCtrl* CEditCtrl::CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE } /** - * This function creates a CEditCtrl object. + * This function creates a CEditCtrl object. * * @param hDlg - HWND of the owning propertysheet page * @param idCtrl - the ID of the dialog control to associate with this class's instance @@ -86,7 +86,7 @@ void CEditCtrl::Release() } /* - * + * * */ void CEditCtrl::OnReset() @@ -110,7 +110,7 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) DBVARIANT dbv; TCHAR szText[64]; - _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = 0; + _Flags.B.hasCustom = _Flags.B.hasProto = _Flags.B.hasMeta = false; _Flags.W |= DB::Setting::GetTStringCtrl(hContact, _pszModule, _pszModule, pszProto, _pszSetting, &dbv); EnableWindow(_hwnd, @@ -148,7 +148,7 @@ BOOL CEditCtrl::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto) db_free(&dbv); break; } - _Flags.B.hasChanged = 0; + _Flags.B.hasChanged = false; } return _Flags.B.hasChanged; } @@ -201,10 +201,10 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) if (dbv.type != DBVT_DELETED) { if (!db_set(hContact, pszModule, _pszSetting, &dbv)) { if (!hContact) { - _Flags.B.hasCustom = 0; - _Flags.B.hasProto = 1; + _Flags.B.hasCustom = false; + _Flags.B.hasProto = true; } - _Flags.B.hasChanged = 0; + _Flags.B.hasChanged = false; // save new value MIR_FREE(_pszValue); @@ -219,7 +219,7 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) if (_Flags.B.hasChanged) { db_unset(hContact, pszModule, _pszSetting); - _Flags.B.hasChanged = 0; + _Flags.B.hasChanged = false; OnInfoChanged(hContact, pszProto); } @@ -235,30 +235,31 @@ void CEditCtrl::OnApply(MCONTACT hContact, LPCSTR pszProto) void CEditCtrl::OnChangedByUser(WORD wChangedMsg) { if ((wChangedMsg == EN_UPDATE) || (wChangedMsg == EN_CHANGE)) { - const int cch = GetWindowTextLength(_hwnd); + DWORD cch = GetWindowTextLength(_hwnd); _Flags.B.hasChanged = mir_tstrlen(_pszValue) != cch; _Flags.B.hasCustom = (cch > 0); if (!_Flags.B.hasChanged && _Flags.B.hasCustom) { - BYTE need_free = 0; - LPTSTR szText; + BYTE need_free = 0; + LPTSTR szText; __try { szText = (LPTSTR)alloca((cch + 1) * sizeof(TCHAR)); } - __except (EXCEPTION_EXECUTE_HANDLER) { + __except (EXCEPTION_EXECUTE_HANDLER) + { szText = (LPTSTR)mir_alloc((cch + 1) * sizeof(TCHAR)); need_free = 1; } if (szText != NULL) { GetWindowText(_hwnd, szText, cch + 1); - _Flags.B.hasChanged = mir_tstrcmp(_pszValue, szText); + _Flags.B.hasChanged = mir_tstrcmp(_pszValue, szText) != 0; if (need_free) MIR_FREE(szText); } - else _Flags.B.hasChanged = 0; + else _Flags.B.hasChanged = false; } InvalidateRect(_hwnd, NULL, TRUE); @@ -279,7 +280,8 @@ void CEditCtrl::OpenUrl() __try { szUrl = (LPTSTR)alloca((8 + lenUrl) * sizeof(TCHAR)); } - __except (EXCEPTION_EXECUTE_HANDLER) { + __except (EXCEPTION_EXECUTE_HANDLER) + { szUrl = (LPTSTR)mir_alloc((8 + lenUrl) * sizeof(TCHAR)); need_free = 1; } @@ -295,7 +297,7 @@ LRESULT CEditCtrl::LinkNotificationHandler(ENLINK* lnk) { if (lnk == NULL) return FALSE; - + switch (lnk->msg) { case WM_SETCURSOR: SetCursor(LoadCursor(NULL, IDC_HAND)); diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index 768f863a28..81922204ce 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -173,10 +173,10 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) //use new core tz interface
TimeZone_StoreListResult(hContact, NULL, _hwnd, TZF_PLF_CB);
if (!hContact) {
- _Flags.B.hasCustom = 0;
- _Flags.B.hasProto = 1;
+ _Flags.B.hasCustom = false;
+ _Flags.B.hasProto = true;
}
- _Flags.B.hasChanged = 0;
+ _Flags.B.hasChanged = false;
}
if (_Flags.B.hasChanged)
@@ -185,7 +185,7 @@ void CTzCombo::OnApply(MCONTACT hContact, LPCSTR pszProto) db_unset(hContact, USERINFO, SET_CONTACT_TIMEZONEINDEX);
db_unset(hContact, pszModule, SET_CONTACT_TIMEZONE);
- _Flags.B.hasChanged = 0;
+ _Flags.B.hasChanged = false;
OnInfoChanged(hContact, pszProto);
}
InvalidateRect(_hwnd, NULL, TRUE);
@@ -204,8 +204,7 @@ void CTzCombo::OnChangedByUser(WORD wChangedMsg) if (_curSel != c) {
if (!_Flags.B.hasChanged) {
- _Flags.B.hasChanged = 1;
- _Flags.B.hasCustom = 1;
+ _Flags.B.hasChanged = _Flags.B.hasCustom = true;
SendMessage(GetParent(GetParent(_hwnd)), PSM_CHANGED, 0, 0);
}
_curSel = c;
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index a53afbe1b6..f4fe8e7b3b 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -398,7 +398,7 @@ BYTE CExImContactXML::ExportEvents() if (dwNumEvents == 0)
return FALSE;
- DWORD dwNumEventsAdded = 0;
+ int dwNumEventsAdded = 0;
// read out all events for the current contact
for (MEVENT hDbEvent = db_event_first(_hContact); hDbEvent != NULL; hDbEvent = db_event_next(_hContact, hDbEvent)) {
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index b20b4cbb4b..c81ad03f01 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -748,6 +748,7 @@ static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LPLISTCTRL pList;
+ LVHITTESTINFO hi;
switch (msg) {
case WM_KEYDOWN:
@@ -802,13 +803,8 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa }
case WM_MOUSEMOVE:
if (PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd))) {
- HDC hDC;
RECT rchWnd, rcItem;
SIZE textSize;
- LVHITTESTINFO hi;
- TOOLINFO ti;
- BYTE bReposition;
- LPLCITEM pItem;
hi.pt.x = GET_X_LPARAM(lParam);
hi.pt.y = GET_Y_LPARAM(lParam);
@@ -816,22 +812,27 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // show tip only if pointer is over an item
if (pList->iHotItem != hi.iItem || pList->iHotSubItem != hi.iSubItem) {
- bReposition = pList->iHotItem != -1 || pList->iHotSubItem != -1;
+ bool bReposition = pList->iHotItem != -1 || pList->iHotSubItem != -1;
pList->iHotItem = hi.iItem;
pList->iHotSubItem = hi.iSubItem;
+ TOOLINFO ti = { 0 };
+ LPLCITEM pItem;
if ((hi.flags & LVHT_ONITEMLABEL) && PtrIsValid(pItem = ProfileList_GetItemData(hwnd, hi.iItem))) {
GetWindowRect(hwnd, &rchWnd);
ListView_GetSubItemRect(hwnd, hi.iItem, hi.iSubItem, LVIR_BOUNDS, &rcItem);
+
// calculate size of text on the screen
- if ((hDC = GetDC(GetParent(hwnd)))) {
+ HDC hDC = GetDC(GetParent(hwnd));
+ if (hDC != NULL) {
SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], (int)mir_tstrlen(pItem->pszText[hi.iSubItem]), &textSize);
ReleaseDC(GetParent(hwnd), hDC);
}
+ else textSize.cx = textSize.cy = 0;
+
// show tip only for text that is larger than te listview can display
if (textSize.cx > rchWnd.right - rchWnd.left || textSize.cx > rcItem.right - rcItem.left) {
- memset(&ti, 0, sizeof(TOOLINFO));
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS | TTF_TRANSPARENT;
ti.hinst = ghInst;
@@ -877,13 +878,10 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // begin label edit
case WM_LBUTTONDBLCLK:
{
- LVHITTESTINFO hi;
-
hi.pt.x = GET_X_LPARAM(lParam);
hi.pt.y = GET_Y_LPARAM(lParam);
- if (ListView_SubItemHitTest(hwnd, &hi)) {
+ if (ListView_SubItemHitTest(hwnd, &hi))
ProfileList_BeginLabelEdit(hwnd, hi.iItem, hi.iSubItem);
- }
return TRUE;
}
@@ -1025,6 +1023,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR {
HWND hList = GetDlgItem(hDlg, LIST_PROFILE);
LPLISTCTRL pList;
+ LVHITTESTINFO hi;
switch (uMsg) {
case WM_INITDIALOG:
@@ -1259,7 +1258,6 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR {
HMENU hMenu = CreatePopupMenu();
MCONTACT hContact;
- LVHITTESTINFO hi;
LPLCITEM pItem;
POINT pt;
@@ -1353,7 +1351,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR return TRUE;
}
// draw selected item
- if ((cd->nmcd.uItemState & CDIS_SELECTED) || (pList->labelEdit.iItem == cd->nmcd.dwItemSpec)) {
+ if ((cd->nmcd.uItemState & CDIS_SELECTED) || (pList->labelEdit.iItem == (int)cd->nmcd.dwItemSpec)) {
SetTextColor(cd->nmcd.hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
FillRect(cd->nmcd.hdc, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
}
diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index aaaf2d0a1b..4d8a11bd47 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -89,7 +89,6 @@ static FORCEINLINE INT_PTR VarToVarCI(const DBVARIANT *dbv, CONTACTINFO *ci) static FORCEINLINE INT_PTR GCIVar(CONTACTINFO *ci, LPCSTR pszSetting)
{
DBVARIANT dbv;
-
if (DB::Setting::Get(ci->hContact, ci->szProto, pszSetting, &dbv, CI_TCHAR(ci)) == 0) {
if (VarToVarCI(&dbv, ci)) {
// On a error, we need to make sure, read data is cleared out!
@@ -102,7 +101,7 @@ static FORCEINLINE INT_PTR GCIVar(CONTACTINFO *ci, LPCSTR pszSetting) }
/**
-* This function tries to read a setting from a certain module (e.g. USERINFO) and if failed it
+* This function tries to read a setting from a certain module (e.g. USERINFO) and if failed it
* tries once again with the baseprotocol of the contact (e.g. ICQ). If nothing was found anyway
* and this is an metacontact it can have a look into subcontacts to retrieve the information.
* This depends on the settings the user did.
@@ -119,7 +118,6 @@ static FORCEINLINE INT_PTR GCIVar(CONTACTINFO *ci, LPCSTR pszSetting) static FORCEINLINE INT_PTR GCIVarEx(CONTACTINFO *ci, LPCSTR pszSetting)
{
DBVARIANT dbv;
-
if (DB::Setting::GetEx(ci->hContact, USERINFO, ci->szProto, pszSetting, &dbv, CI_TCHAR(ci)) == 0) {
if (VarToVarCI(&dbv, ci)) {
// On a error, we need to make sure, read data is cleared out!
@@ -132,7 +130,7 @@ static FORCEINLINE INT_PTR GCIVarEx(CONTACTINFO *ci, LPCSTR pszSetting) }
/**
-* This function tries to read a Language from a certain module (e.g. USERINFO) and if failed it
+* This function tries to read a Language from a certain module (e.g. USERINFO) and if failed it
* tries once again with the baseprotocol of the contact (e.g. ICQ). If nothing was found anyway
* and this is an metacontact it can have a look into subcontacts to retrieve the information.
* This depends on the settings the user did.
@@ -149,7 +147,7 @@ static FORCEINLINE INT_PTR GCIVarEx(CONTACTINFO *ci, LPCSTR pszSetting) static FORCEINLINE INT_PTR GCILangEx(CONTACTINFO *ci, LPCSTR pszSetting)
{
if (0 == GCIVarEx(ci, pszSetting)) {
- if (ci->type!= CNFT_ASCIIZ) {
+ if (ci->type != CNFT_ASCIIZ) {
//lang was safed in database as code
LPIDSTRLIST pList;
UINT nList, i, res = 0;
@@ -160,16 +158,16 @@ static FORCEINLINE INT_PTR GCILangEx(CONTACTINFO *ci, LPCSTR pszSetting) default: return 1;
}
GetLanguageList(&nList, &pList);
- for(i = 0; i<nList; i++) {
- if (pList[i].nID == res) {
+ for (i = 0; i < nList; i++) {
+ if (pList[i].nID == (int)res) {
//use untranslate string (pszText member)
- ci->pszVal = (ci->dwFlag & CNF_UNICODE) ? (LPTSTR) mir_a2u(pList[i].pszText) : (LPTSTR) mir_strdup(pList[i].pszText);
+ ci->pszVal = (ci->dwFlag & CNF_UNICODE) ? (LPTSTR)mir_a2u(pList[i].pszText) : (LPTSTR)mir_strdup(pList[i].pszText);
ci->type = (ci->pszVal != NULL) ? CNFT_ASCIIZ : 0;
return 0;
}
} /*end for*/
- ci->type = 0;
- ci->pszVal = NULL;
+ ci->type = 0;
+ ci->pszVal = NULL;
}
}
else ci->type = 0;
@@ -178,7 +176,7 @@ static FORCEINLINE INT_PTR GCILangEx(CONTACTINFO *ci, LPCSTR pszSetting) }
/**
-* This function read a setting from the baseprotocol of the contact (e.g. ICQ).
+* This function read a setting from the baseprotocol of the contact (e.g. ICQ).
*
* @warning ci MUST NOT be NULL!
*
@@ -192,8 +190,8 @@ static FORCEINLINE INT_PTR GCILangEx(CONTACTINFO *ci, LPCSTR pszSetting) static FORCEINLINE INT_PTR GCIStr(CONTACTINFO *ci, LPCSTR pszSetting)
{
const BYTE type = CI_TCHAR(ci);
+
DBVARIANT dbv;
-
if (DB::Setting::Get(ci->hContact, ci->szProto, pszSetting, &dbv, type) == 0) {
if (DB::Variant::dbv2String(&dbv, type) == 0)
ci->pszVal = dbv.ptszVal;
@@ -236,21 +234,21 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci) cbf = mir_wstrlen(dbvf.pwszVal);
cbl = mir_wstrlen(dbvl.pwszVal);
- ci->pszVal = (LPTSTR) mir_alloc((cbf + cbl + 2) * sizeof(WCHAR));
+ ci->pszVal = (LPTSTR)mir_alloc((cbf + cbl + 2) * sizeof(WCHAR));
if (ci->pszVal)
- mir_snwprintf((LPWSTR) ci->pszVal, cbf + cbl + 2, L"%s %s", dbvf.pwszVal, dbvl.pwszVal);
+ mir_snwprintf((LPWSTR)ci->pszVal, cbf + cbl + 2, L"%s %s", dbvf.pwszVal, dbvl.pwszVal);
db_free(&dbvf);
db_free(&dbvl);
}
// set firstname as result
else if (dbvf.type == DBVT_WCHAR) {
- ci->pszVal = (LPTSTR) dbvf.pwszVal;
+ ci->pszVal = (LPTSTR)dbvf.pwszVal;
db_free(&dbvl);
}
// set lastname as result
else if (dbvl.type == DBVT_WCHAR) {
- ci->pszVal = (LPTSTR) dbvl.pwszVal;
+ ci->pszVal = (LPTSTR)dbvl.pwszVal;
db_free(&dbvf);
}
else {
@@ -265,21 +263,21 @@ static FORCEINLINE INT_PTR GCIFirstLast(CONTACTINFO *ci) cbf = mir_strlen(dbvf.pszVal);
cbl = mir_strlen(dbvl.pszVal);
- ci->pszVal = (LPTSTR) mir_alloc((cbf + cbl + 2) * sizeof(CHAR));
+ ci->pszVal = (LPTSTR)mir_alloc((cbf + cbl + 2) * sizeof(CHAR));
if (ci->pszVal)
- mir_snprintf((LPSTR) ci->pszVal, cbf + cbl + 2, "%s %s", dbvf.pszVal, dbvl.pszVal);
+ mir_snprintf((LPSTR)ci->pszVal, cbf + cbl + 2, "%s %s", dbvf.pszVal, dbvl.pszVal);
db_free(&dbvf);
db_free(&dbvl);
}
// set firstname as result
else if (dbvf.type == DBVT_ASCIIZ) {
- ci->pszVal = (LPTSTR) dbvf.pszVal;
+ ci->pszVal = (LPTSTR)dbvf.pszVal;
db_free(&dbvl);
}
// set lastname as result
else if (dbvl.type == DBVT_ASCIIZ) {
- ci->pszVal = (LPTSTR) dbvl.pszVal;
+ ci->pszVal = (LPTSTR)dbvl.pszVal;
db_free(&dbvf);
}
else {
@@ -309,14 +307,14 @@ static FORCEINLINE INT_PTR GCICountry(CONTACTINFO *ci, LPCSTR pszSetting) // country id was safed in database as code
UINT res = 0;
switch (ci->type) {
- case CNFT_WORD: res = ci->wVal; break;
- case CNFT_DWORD: res = ci->dVal; break;
- default: return 1;
+ case CNFT_WORD: res = ci->wVal; break;
+ case CNFT_DWORD: res = ci->dVal; break;
+ default: return 1;
}
LPSTR szCountry = res ? (LPSTR)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, res, 0) : NULL;
if (szCountry)
- ci->pszVal = (ci->dwFlag & CNF_UNICODE) ? (LPTSTR) mir_a2u(szCountry) : (LPTSTR) mir_strdup(szCountry);
+ ci->pszVal = (ci->dwFlag & CNF_UNICODE) ? (LPTSTR)mir_a2u(szCountry) : (LPTSTR)mir_strdup(szCountry);
else
ci->pszVal = NULL;
@@ -335,12 +333,12 @@ static FORCEINLINE INT_PTR GCICountry(CONTACTINFO *ci, LPCSTR pszSetting) * @param wParam - not used
* @param lParam - pointer to a CONTACTINFO structure which tells what information is desired
*
- * @retval 0 - if contact information was found and read correctly
+ * @retval 0 - if contact information was found and read correctly
* @retval 1 - if any error occured or setting was not found
**/
-INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam)
+INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam)
{
- CONTACTINFO *ci = (CONTACTINFO*) lParam;
+ CONTACTINFO *ci = (CONTACTINFO*)lParam;
INT_PTR result;
if (ci && ci->cbSize == sizeof(CONTACTINFO) && (ci->szProto != NULL || (ci->szProto = Proto_GetBaseAccountName(ci->hContact)) != NULL)) {
@@ -591,7 +589,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) result = GCIVar(ci, (LPCSTR)result);
break;
- case CNF_DISPLAYUID:
+ case CNF_DISPLAYUID:
if (!GCIVar(ci, "display_uid"))
result = 0;
else {
@@ -602,7 +600,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) break;
case CNF_DISPLAYNC:
- case CNF_DISPLAY:
+ case CNF_DISPLAY:
for (int i = 0; i < NAMEORDERCOUNT; i++) {
switch (gNameOrder[i]) {
case 0: // custom name
@@ -701,7 +699,7 @@ static INT_PTR GetContactSettingStrExService(WPARAM wParam, LPARAM lParam) static int OnSettingChanged(WPARAM hContact, LPARAM lParam)
{
if (hContact == NULL) {
- DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*) lParam;
+ DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam;
if (!mir_strcmp(pdbcws->szModule, "Contact") && !mir_strcmp(pdbcws->szSetting, "NameOrder"))
memcpy(gNameOrder, pdbcws->value.pbVal, pdbcws->value.cpbVal);
}
|