summaryrefslogtreecommitdiff
path: root/src/modules/findadd/searchresults.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
commite58823d961a630eb62e60d2ccb443761ba5f1704 (patch)
tree62d071be480d57af2a53f154a1468abe0b9449ff /src/modules/findadd/searchresults.cpp
parent721aea0764451e985d575236205808bbef298244 (diff)
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/findadd/searchresults.cpp')
-rw-r--r--src/modules/findadd/searchresults.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp
index cc3622609f..827fe920b0 100644
--- a/src/modules/findadd/searchresults.cpp
+++ b/src/modules/findadd/searchresults.cpp
@@ -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.
@@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "findadd.h"
enum {
- COLUMNID_PROTO,
- COLUMNID_HANDLE,
- COLUMNID_NICK,
- COLUMNID_FIRST,
- COLUMNID_LAST,
- COLUMNID_EMAIL,
+ COLUMNID_PROTO,
+ COLUMNID_HANDLE,
+ COLUMNID_NICK,
+ COLUMNID_FIRST,
+ COLUMNID_LAST,
+ COLUMNID_EMAIL,
NUM_COLUMNID
};
@@ -41,24 +41,24 @@ void SaveColumnSizes(HWND hwndResults)
int i;
struct FindAddDlgData *dat;
- dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults),GWLP_USERDATA);
+ dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults), GWLP_USERDATA);
columnCount=Header_GetItemCount(ListView_GetHeader(hwndResults));
if (columnCount != NUM_COLUMNID) return;
- ListView_GetColumnOrderArray(hwndResults,columnCount,columnOrder);
+ ListView_GetColumnOrderArray(hwndResults, columnCount, columnOrder);
for (i=0; i < NUM_COLUMNID; i++) {
mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i);
- DBWriteContactSettingByte(NULL,"FindAdd",szSetting,(BYTE)columnOrder[i]);
+ DBWriteContactSettingByte(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]);
if (i>=columnCount) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i);
- DBWriteContactSettingWord(NULL,"FindAdd",szSetting,(WORD)ListView_GetColumnWidth(hwndResults,i));
+ DBWriteContactSettingWord(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
}
- DBWriteContactSettingByte(NULL,"FindAdd","SortColumn",(BYTE)dat->iLastColumnSortIndex);
- DBWriteContactSettingByte(NULL,"FindAdd","SortAscending",(BYTE)dat->bSortAscending);
+ DBWriteContactSettingByte(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex);
+ DBWriteContactSettingByte(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
}
static const TCHAR *szColumnNames[] = { NULL, NULL, _T("Nick"), _T("First Name"), _T("Last Name"), _T("E-mail") };
-static int defaultColumnSizes[]={0,90,100,100,100,2000};
-void LoadColumnSizes(HWND hwndResults,const char *szProto)
+static int defaultColumnSizes[]={0, 90, 100, 100, 100, 2000};
+void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
HDITEM hdi;
int columnOrder[NUM_COLUMNID];
@@ -88,9 +88,9 @@ void LoadColumnSizes(HWND hwndResults,const char *szProto)
{
#if defined( _UNICODE )
bNeedsFree = TRUE;
- lvc.pszText = mir_a2t((char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0));
+ lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
#else
- lvc.pszText = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0);
+ lvc.pszText = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
#endif
}
else
@@ -128,7 +128,7 @@ static LPARAM ListView_GetItemLParam(HWND hwndList, int idx)
LVITEM lv;
lv.iItem = idx;
lv.mask = LVIF_PARAM;
- ListView_GetItem(hwndList,&lv);
+ ListView_GetItem(hwndList, &lv);
return lv.lParam;
}
@@ -168,8 +168,8 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa
{
TCHAR szText1[100];
TCHAR szText2[100];
- ListView_GetItemText(hList,(int)lParam1,sortCol,szText1,SIZEOF(szText1));
- ListView_GetItemText(hList,(int)lParam2,sortCol,szText2,SIZEOF(szText2));
+ ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, SIZEOF(szText1));
+ ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, SIZEOF(szText2));
return _tcsicmp(szText1, szText2)*sortMultiplier;
}
return 0;
@@ -181,7 +181,7 @@ void FreeSearchResults(HWND hwndResults)
struct ListSearchResult *lsr;
for (lvi.iItem=ListView_GetItemCount(hwndResults)-1;lvi.iItem>=0;lvi.iItem--) {
lvi.mask=LVIF_PARAM;
- ListView_GetItem(hwndResults,&lvi);
+ ListView_GetItem(hwndResults, &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
mir_free(lsr->psr.id);
@@ -192,7 +192,7 @@ void FreeSearchResults(HWND hwndResults)
mir_free(lsr);
}
ListView_DeleteAllItems(hwndResults);
- EnableResultButtons(GetParent(hwndResults),0);
+ EnableResultButtons(GetParent(hwndResults), 0);
}
// on its own thread
@@ -201,16 +201,16 @@ static void BeginSearchFailed(void * arg)
TCHAR buf[128];
if ( arg != NULL ) {
const TCHAR* protoName = (TCHAR*)arg;
- mir_sntprintf(buf,SIZEOF(buf),
- TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
- protoName,protoName);
+ mir_sntprintf(buf, SIZEOF(buf),
+ TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
+ protoName, protoName);
mir_free((char*)arg);
}
- else lstrcpyn(buf,TranslateT("Could not search on any of the protocols, are you online?"),SIZEOF(buf));
- MessageBox(0,buf,TranslateT("Problem with search"),MB_OK | MB_ICONERROR);
+ else lstrcpyn(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf));
+ MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
-int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *szSearchService,DWORD requiredCapability,void *pvSearchParams)
+int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams)
{
int i;
if ( szProto == NULL ) {
@@ -220,9 +220,9 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
for ( i=0; i < accounts.getCount();i++) {
PROTOACCOUNT* pa = accounts[i];
if (!Proto_IsAccountEnabled(pa)) continue;
- DWORD caps=(DWORD)CallProtoService(pa->szModuleName,PS_GETCAPS,PFLAGNUM_1,0);
+ DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(caps&requiredCapability)) continue;
- dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName,szSearchService,0,(LPARAM)pvSearchParams);
+ dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[dat->searchCount].szProto = pa->szModuleName;
if ( dat->search[dat->searchCount].hProcess == NULL ) failures++;
else dat->searchCount++;
@@ -230,7 +230,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
if (failures) {
//infuriatingly vague error message. fixme.
if (dat->searchCount == 0) {
- forkthread(BeginSearchFailed,0,NULL);
+ forkthread(BeginSearchFailed, 0, NULL);
mir_free(dat->search);
dat->search=NULL;
return 1;
@@ -239,7 +239,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
else {
dat->search=(struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo));
dat->searchCount=1;
- dat->search[0].hProcess=(HANDLE)CallProtoService(szProto,szSearchService,0,(LPARAM)pvSearchParams);
+ dat->search[0].hProcess=(HANDLE)CallProtoService(szProto, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[0].szProto=szProto;
if (dat->search[0].hProcess == NULL) {
//infuriatingly vague error message. fixme.
@@ -255,7 +255,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
}
// !!!!!!!! this code is dangerous like a hell
-void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat)
+void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat)
{
TCHAR str[256];
@@ -268,7 +268,7 @@ void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat)
if ( !pa )
continue;
- lstrcat(str, i ? _T(",") : _T( " " ));
+ lstrcat(str, i ? _T(", ") : _T( " " ));
lstrcat(str, pa->tszAccountName );
} }
else lstrcpy(str, TranslateT("Idle"));
@@ -282,19 +282,19 @@ struct ProtoResultsSummary {
};
void SetStatusBarResultInfo(HWND hwndDlg)
{
- HWND hwndStatus=GetDlgItem(hwndDlg,IDC_STATUSBAR);
- HWND hwndResults=GetDlgItem(hwndDlg,IDC_RESULTS);
+ HWND hwndStatus=GetDlgItem(hwndDlg, IDC_STATUSBAR);
+ HWND hwndResults=GetDlgItem(hwndDlg, IDC_RESULTS);
LV_ITEM lvi;
struct ListSearchResult *lsr;
struct ProtoResultsSummary *subtotal=NULL;
int subtotalCount=0;
- int i,total;
+ int i, total;
TCHAR str[256];
total=ListView_GetItemCount(hwndResults);
for (lvi.iItem=total-1;lvi.iItem>=0;lvi.iItem--) {
lvi.mask=LVIF_PARAM;
- ListView_GetItem(hwndResults,&lvi);
+ ListView_GetItem(hwndResults, &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
for (i=0;i<subtotalCount;i++) {
@@ -304,7 +304,7 @@ void SetStatusBarResultInfo(HWND hwndDlg)
}
}
if (i == subtotalCount) {
- subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal,sizeof(struct ProtoResultsSummary)*(subtotalCount+1));
+ subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal, sizeof(struct ProtoResultsSummary)*(subtotalCount+1));
subtotal[subtotalCount].szProto=lsr->szProto;
subtotal[subtotalCount++].count=1;
}
@@ -320,7 +320,7 @@ void SetStatusBarResultInfo(HWND hwndDlg)
else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName );
}
else {
- mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("),total);
+ mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("), total);
for ( i=0; i < subtotalCount; i++ ) {
if ( i ) {
if (( pa = Proto_GetAccount( subtotal[i].szProto )) == NULL )
@@ -338,35 +338,35 @@ void SetStatusBarResultInfo(HWND hwndDlg)
SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str );
}
-void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto)
+void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto)
{
SaveColumnSizes(hwndResults);
- while (ListView_DeleteColumn(hwndResults,0));
- ListView_SetImageList(hwndResults,dat->himlComboIcons,LVSIL_SMALL);
- LoadColumnSizes(hwndResults,szProto);
+ while (ListView_DeleteColumn(hwndResults, 0));
+ ListView_SetImageList(hwndResults, dat->himlComboIcons, LVSIL_SMALL);
+ LoadColumnSizes(hwndResults, szProto);
}
-void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y)
+void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y)
{
struct FindAddDlgData *dat;
- HMENU hPopupMenu,hMenu;
+ HMENU hPopupMenu, hMenu;
int commandId;
struct ListSearchResult *lsr;
- dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
{ LVITEM lvi;
- if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS)) != 1) return;
+ if (ListView_GetSelectedCount(GetDlgItem(hwndDlg, IDC_RESULTS)) != 1) return;
lvi.mask=LVIF_PARAM;
- lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_RESULTS),-1,LVNI_ALL|LVNI_SELECTED);
- ListView_GetItem(GetDlgItem(hwndDlg,IDC_RESULTS),&lvi);
+ lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_RESULTS), -1, LVNI_ALL|LVNI_SELECTED);
+ ListView_GetItem(GetDlgItem(hwndDlg, IDC_RESULTS), &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
}
- hMenu=LoadMenu(hMirandaInst,MAKEINTRESOURCE(IDR_CONTEXT));
- hPopupMenu=GetSubMenu(hMenu,4);
- CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hPopupMenu,0);
- commandId=TrackPopupMenu(hPopupMenu,TPM_RIGHTBUTTON|TPM_RETURNCMD,x,y,0,hwndDlg,NULL);
+ hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hPopupMenu=GetSubMenu(hMenu, 4);
+ CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hPopupMenu, 0);
+ commandId=TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hwndDlg, NULL);
switch(commandId) {
case IDC_ADD:
{ ADDCONTACTSTRUCT acs;
@@ -375,19 +375,19 @@ void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y)
acs.handleType=HANDLE_SEARCHRESULT;
acs.szProto=lsr->szProto;
acs.psr=&lsr->psr;
- CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs);
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
break;
}
case IDC_DETAILS:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr);
- CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)hContact,0);
+ hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
break;
}
case IDC_SENDMESSAGE:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr);
- CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,(LPARAM)(const char*)NULL);
+ hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)(const char*)NULL);
break;
}
}