From 11ab7716e9d48c7505fbcf4fe1deba33b494cdc1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Sep 2016 12:48:54 +0000 Subject: - MS_CLIST_SETHIDEOFFLINE replaced with pcli->pfnSetHideOffline(); - MS_CLIST_TOGGLEHIDEOFFLINE added to cover the only case with service call; git-svn-id: http://svn.miranda-ng.org/main/trunk@17237 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_clist.h | 15 +++----- plugins/Clist_modern/src/modern_clui.cpp | 14 ++----- plugins/Clist_modern/src/modern_viewmodebar.cpp | 6 +-- plugins/Clist_nicer/src/clui.cpp | 4 +- plugins/Clist_nicer/src/viewmodes.cpp | 4 +- plugins/TopToolBar/src/InternalButtons.cpp | 10 +---- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 45 ++++++++++------------- src/mir_app/src/clistmod.cpp | 2 - src/mir_app/src/clui.cpp | 2 +- src/mir_app/src/menu_groups.cpp | 9 ++++- 10 files changed, 46 insertions(+), 65 deletions(-) diff --git a/include/m_clist.h b/include/m_clist.h index 8b54c0c4b0..182682b359 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -333,6 +333,12 @@ typedef struct { // returns new empty groups mode #define MS_CLIST_TOGGLEEMPTYGROUPS "CList/ToggleEmptyGroups" +///////////////////////////////////////////////////////////////////////////////////////// +// toggles the hidden users display mode +// wParam = lParam = 0 +// returns new hidden users mode +#define MS_CLIST_TOGGLEHIDEOFFLINE "CList/ToggleHideOffline" + ///////////////////////////////////////////////////////////////////////////////////////// // toggles the hidden users display mode // wParam = lParam = 0 @@ -440,15 +446,6 @@ EXTERN_C MIR_APP_DLL(HMENU) Clist_GroupBuildMenu(void); EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void); -///////////////////////////////////////////////////////////////////////////////////////// -// changes the 'hide offline contacts' flag and call CLUI -// wParam = newValue -// lParam = 0 -// returns 0 on success, nonzero on failure -// newValue is 0 to show all contacts, 1 to only show online contacts -// or -1 to toggle the value -#define MS_CLIST_SETHIDEOFFLINE "CList/SetHideOffline" - ///////////////////////////////////////////////////////////////////////////////////////// // do the message processing associated with double clicking a contact // wParam = (MCONTACT)hContact diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index a545ba2928..5859cbd7eb 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -72,8 +72,8 @@ RECT g_rcEdgeSizingRect = { 0 }; /* Module global variables */ static BYTE bAlphaEnd; -static BYTE bOldHideOffline; -static BYTE bOldUseGroups; +static int bOldHideOffline; +static int bOldUseGroups; static WORD wBehindEdgeShowDelay, wBehindEdgeHideDelay, @@ -423,14 +423,8 @@ HRESULT CLUI::CreateCLC() nLastRequiredHeight = 0; if (g_CluiData.current_viewmode[0] == '\0') { - if (bOldHideOffline != (BYTE)-1) - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)bOldHideOffline, 0); - else - CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); - if (bOldUseGroups != (BYTE)-1) - CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)bOldUseGroups, 0); - else - CallService(MS_CLIST_SETUSEGROUPS, 0, 0); + pcli->pfnSetHideOffline((bOldHideOffline == -1) ? false : bOldHideOffline); + CallService(MS_CLIST_SETUSEGROUPS, (bOldUseGroups == -1) ? false : bOldUseGroups, 0); } nLastRequiredHeight = 0; mutex_bDisableAutoUpdate = 0; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index adb51b8167..0858bcbe5f 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -1246,7 +1246,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE); SetDlgItemText(g_hwndViewModeFrame, IDC_SELECTMODE, TranslateT("All contacts")); if (g_CluiData.boldHideOffline != (BYTE)-1) - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)g_CluiData.boldHideOffline, 0); + pcli->pfnSetHideOffline(g_CluiData.boldHideOffline); if (g_CluiData.bOldUseGroups != (BYTE)-1) CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0); g_CluiData.boldHideOffline = (BYTE)-1; @@ -1334,10 +1334,10 @@ void ApplyViewMode(const char *Name, bool onlySelector) if (g_CluiData.boldHideOffline == (BYTE)-1) g_CluiData.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); - CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); + pcli->pfnSetHideOffline(false); } else if (g_CluiData.boldHideOffline != (BYTE)-1) { - CallService(MS_CLIST_SETHIDEOFFLINE, g_CluiData.boldHideOffline, 0); + pcli->pfnSetHideOffline(g_CluiData.boldHideOffline); g_CluiData.boldHideOffline = -1; } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index a73e090873..f99c10ca7f 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -176,7 +176,7 @@ static HWND PreCreateCLC(HWND parent) static int CreateCLC() { pcli->pfnReloadExtraIcons(); - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)oldhideoffline, 0); + pcli->pfnSetHideOffline(oldhideoffline); disableautoupd = 0; { CLISTFrame frame = { 0 }; @@ -1498,7 +1498,7 @@ buttons_done: case POPUP_HIDEOFFLINE: case IDC_TBHIDEOFFLINE: case IDC_STBHIDEOFFLINE: - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)(-1), 0); + pcli->pfnSetHideOffline(-1); break; case POPUP_HIDEOFFLINEROOT: CallService(MS_CLIST_TOGGLEHIDEOFFLINEROOT, 0, 0); diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index b1ca3a8640..313c8065d2 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -971,7 +971,7 @@ clvm_reset_command: cfg::dat.bFilterEffective = 0; Clist_Broadcast(CLM_AUTOREBUILD, 0, 0); SetDlgItemText(hwnd, IDC_SELECTMODE, TranslateT("No view mode")); - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)cfg::dat.boldHideOffline, 0); + pcli->pfnSetHideOffline(cfg::dat.boldHideOffline); cfg::dat.boldHideOffline = (BYTE)-1; SetButtonStates(); cfg::dat.current_viewmode[0] = 0; @@ -1112,7 +1112,7 @@ void ApplyViewMode(const char *name) if (cfg::dat.boldHideOffline == (BYTE)-1) cfg::dat.boldHideOffline = db_get_b(NULL, "CList", "HideOffline", 0); - CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); + pcli->pfnSetHideOffline(false); SetWindowTextA(hwndSelector, name); Clist_Broadcast(CLM_AUTOREBUILD, 0, 0); SetButtonStates(); diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index dbc1b811dd..81bbdac991 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -4,7 +4,6 @@ #define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF" #define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT" #define TTBI_STATUSMENUBUTT "TTBInternal/StatusMenuButt" -#define TTBI_SHOWHIDEOFFLINE "TTBInternal/ShowHideOffline" #define INDEX_OFFLINE 5 #define INDEX_META 6 @@ -26,7 +25,7 @@ static stdButtons[] = { { LPGEN("Show accounts manager"), "Protos/ShowAccountManager", SKINICON_OTHER_ACCMGR, 0, LPGEN("Show accounts manager"), NULL, 0, 0 }, { LPGEN("Find/add contacts"), MS_FINDADD_FINDADD, SKINICON_OTHER_FINDUSER, 0, LPGEN("Find/add contacts"), NULL, 0, 1 }, { LPGEN("Show status menu"), TTBI_STATUSMENUBUTT, SKINICON_OTHER_STATUS, 0, LPGEN("Show status menu"), NULL, 0, 0 }, - { LPGEN("Show/hide offline contacts"), TTBI_SHOWHIDEOFFLINE, IDI_HIDEOFFLINE, IDI_SHOWOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 1, 1 }, + { LPGEN("Show/hide offline contacts"), MS_CLIST_TOGGLEHIDEOFFLINE, IDI_HIDEOFFLINE, IDI_SHOWOFFLINE, LPGEN("Hide offline contacts"), LPGEN("Show offline contacts"), 1, 1 }, { LPGEN("Enable/disable metacontacts"), "MetaContacts/OnOff", IDI_METAOFF, IDI_METAON, LPGEN("Disable metacontacts"), LPGEN("Enable metacontacts"), 1, 1 }, { LPGEN("Enable/disable groups"), MS_CLIST_TOGGLEGROUPS, IDI_GROUPSOFF, IDI_GROUPSON, LPGEN("Enable groups"), LPGEN("Disable groups"), 1, 1 }, { LPGEN("Enable/disable sounds"), TTBI_SOUNDSONOFF, IDI_SOUNDSOFF, IDI_SOUNDSON, LPGEN("Disable sounds"), LPGEN("Enable sounds"), 1, 1 }, @@ -83,12 +82,6 @@ INT_PTR TTBInternalSoundsOnOff(WPARAM, LPARAM) return 0; } -INT_PTR TTBInternalShowHideOffline(WPARAM, LPARAM) -{ - CallService(MS_CLIST_SETHIDEOFFLINE, -1, 0); - return 0; -} - /////////////////////////////////////////////////////////////////////////////// void InitInternalButtons() @@ -98,7 +91,6 @@ void InitInternalButtons() CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff); CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt); CreateServiceFunction(TTBI_STATUSMENUBUTT, TTBInternalStatusMenuButt); - CreateServiceFunction(TTBI_SHOWHIDEOFFLINE, TTBInternalShowHideOffline); for (int i = 0; i < _countof(stdButtons); i++) { TTBButton ttb = { 0 }; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index 078f0ee27d..f18d2a2d1b 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -161,42 +161,35 @@ INT_PTR SvcExImport_Import(lpExImParam ExImContact, HWND hwndParent) // create the filename to suggest the user for the to export contact DisplayNameToFileName(ExImContact, szFileName, _countof(szFileName)); - int nIndex = DlgExIm_OpenFileName(hwndParent, + int nIndex = DlgExIm_OpenFileName(hwndParent, Translate("Import User Details from VCard"), FilterString(ExImContact), szFileName); -// Stop during develop -if (ExImContact->Typ == EXIM_ACCOUNT || - ExImContact->Typ == EXIM_GROUP) return 1; + // Stop during develop + if (ExImContact->Typ == EXIM_ACCOUNT || + ExImContact->Typ == EXIM_GROUP) return 1; switch (nIndex) { - case 1: - { - CFileXml xmlFile; - CallService(MS_CLIST_SETHIDEOFFLINE, -1, 0); //workarround to refresh the clist.... - xmlFile.Import(ExImContact->hContact, szFileName); - CallService(MS_CLIST_SETHIDEOFFLINE, -1, 0); //...after import. - //Clist_Broadcast(CLM_AUTOREBUILD, 0, 0); //does not work - return 0; - } + case 1: + CFileXml().Import(ExImContact->hContact, szFileName); + Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0); + return 0; + // .ini - case 2: - return SvcExImINI_Import(ExImContact->hContact, szFileName); + case 2: + return SvcExImINI_Import(ExImContact->hContact, szFileName); // .vcf - case 3: - { - CVCardFileVCF vcfFile; - - if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) { - SetCursor(LoadCursor(NULL, IDC_WAIT)); - vcfFile.Import(); - vcfFile.Close(); - SetCursor(LoadCursor(NULL, IDC_ARROW)); - } - return 0; + case 3: + CVCardFileVCF vcfFile; + if (vcfFile.Open(ExImContact->hContact, szFileName, "rt")) { + SetCursor(LoadCursor(NULL, IDC_WAIT)); + vcfFile.Import(); + vcfFile.Close(); + SetCursor(LoadCursor(NULL, IDC_ARROW)); } + return 0; } return 1; } diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 844027ecf1..9b39a4f170 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -412,7 +412,6 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) /***************************************************************************************/ static INT_PTR ShowHideStub(WPARAM wParam, LPARAM lParam) { return cli.pfnShowHide(wParam, lParam); } -static INT_PTR SetHideOfflineStub(WPARAM wParam, LPARAM) { return cli.pfnSetHideOffline((int)wParam); } static INT_PTR Docking_ProcessWindowMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnDocking_ProcessWindowMessage(wParam, lParam); } static INT_PTR HotkeysProcessMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnHotkeysProcessMessage(wParam, lParam); } @@ -433,7 +432,6 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts); CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup); CreateServiceFunction(MS_CLIST_SHOWHIDE, ShowHideStub); - CreateServiceFunction(MS_CLIST_SETHIDEOFFLINE, SetHideOfflineStub); CreateServiceFunction(MS_CLIST_DOCKINGPROCESSMESSAGE, Docking_ProcessWindowMessageStub); CreateServiceFunction(MS_CLIST_DOCKINGISDOCKED, Docking_IsDocked); CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE, HotkeysProcessMessageStub); diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 2090775fd5..8f6d32b2e7 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -704,7 +704,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case POPUP_HIDEOFFLINE: - CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)(-1), 0); + cli.pfnSetHideOffline(-1); break; case POPUP_HIDEOFFLINEROOT: diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index e4a0a1d0af..a80c9dc527 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -119,6 +119,12 @@ static INT_PTR UseGroupsHelper(WPARAM, LPARAM) return newVal; } +static INT_PTR HideOfflineHelper(WPARAM, LPARAM) +{ + cli.pfnSetHideOffline(-1); + return 0; +} + static INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) { int newVal = !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0); @@ -293,10 +299,11 @@ void InitGroupMenus(void) SET_UID(mi, 0xe6269658, 0x69, 0x4094, 0x9b, 0x35, 0x4e, 0x80, 0x29, 0x26, 0xf, 0x8e); mi.position = 500001; mi.hIcolibItem = NULL; - mi.pszService = MS_CLIST_SETHIDEOFFLINE; + mi.pszService = MS_CLIST_TOGGLEHIDEOFFLINE; mi.name.a = LPGEN("&Hide offline users"); gmp.wParam = -1; hHideOfflineUsersMenuItem = Menu_AddGroupMenuItem(&mi, &gmp); + CreateServiceFunction(mi.pszService, HideOfflineHelper); SET_UID(mi, 0xeded7371, 0xf6e6, 0x48c3, 0x8c, 0x9e, 0x62, 0xc1, 0xd5, 0xcb, 0x51, 0xbc); mi.position = 500002; -- cgit v1.2.3