diff options
author | George Hazan <george.hazan@gmail.com> | 2016-05-27 10:08:00 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-05-27 10:08:00 +0000 |
commit | db10ee4ebb7f047c72f70828c89c95d62ee482cd (patch) | |
tree | f3c9ad089f9ba098508d2327b22cd2f834b127fd | |
parent | 370d627df54c0b0823a1739176e0157c0205b692 (diff) |
- fixes #1242 (for subgroups)
git-svn-id: http://svn.miranda-ng.org/main/trunk@16874 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/clc.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/clistgroups.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_groups.cpp | 4 |
4 files changed, 11 insertions, 21 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 61a07f0e63..b4fdd72147 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -326,21 +326,11 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM {
ClcContact *contact;
int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
- if (hit != -1) {
+ if (hit != -1 && contact->type == CLCIT_GROUP) {
switch (LOWORD(wParam)) {
- case POPUP_NEWSUBGROUP:
- if (contact->type == CLCIT_GROUP) {
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
- Clist_GroupCreate(contact->groupId, 0);
- }
- return 0;
-
case POPUP_GROUPSHOWOFFLINE:
- if (contact->type == CLCIT_GROUP) {
- Clist_GroupSetFlags(contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- }
+ Clist_GroupSetFlags(contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
return 0;
}
}
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 1a02e1f04c..b19d169efa 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -1244,6 +1244,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
if (hit == -1)
break;
+
if (contact->type == CLCIT_CONTACT)
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), contact->hContact))
break;
@@ -1251,21 +1252,18 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (contact->type == CLCIT_GROUP) {
switch (LOWORD(wParam)) {
case POPUP_NEWSUBGROUP:
- if (contact->type != CLCIT_GROUP)
- break;
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
Clist_GroupCreate(contact->groupId, 0);
break;
case POPUP_RENAMEGROUP:
cli.pfnBeginRenameSelection(hwnd, dat);
break;
case POPUP_DELETEGROUP:
- if (contact->type == CLCIT_GROUP)
- Clist_GroupDelete(contact->groupId);
+ Clist_GroupDelete(contact->groupId);
break;
case POPUP_GROUPHIDEOFFLINE:
- if (contact->type == CLCIT_GROUP)
- Clist_GroupSetFlags(contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
+ Clist_GroupSetFlags(contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
break;
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 08c377b681..dd4d23571a 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -128,9 +128,9 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const TCHAR *ptszName) int newId = arByIds.getCount();
newName[0] = 1 | GROUPF_EXPANDED; // 1 is required so we never get '\0'
CGroupInternal *pNew = new CGroupInternal(newId, newName);
- pNew->save();
arByIds.insert(pNew);
arByName.insert(pNew);
+ pNew->save();
Clist_GroupAdded(newId + 1);
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index 58efbff0b7..1eda0aa080 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -214,6 +214,7 @@ static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) // called with:
// wparam - ownerdata
// lparam - lparam from winproc
+
static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam)
{
if (wParam != 0) {
@@ -255,6 +256,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// wparam menu handle to pass to clc.c
// lparam WM_COMMAND HWND
+
static INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
{
SendMessage(lParam ? (HWND)lParam : (HWND)cli.hwndContactTree, WM_COMMAND, wParam, 0);
@@ -330,7 +332,6 @@ void InitGroupMenus(void) CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu", FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService", SubGroupMenuCheckService);
- CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy);
hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);
@@ -349,6 +350,7 @@ void InitGroupMenus(void) mi.name.a = LPGEN("&New subgroup");
gmp.wParam = POPUP_NEWSUBGROUP;
Menu_AddSubGroupMenuItem(&mi, &gmp);
+ CreateServiceFunction(mi.pszService, GroupMenuExecProxy);
SET_UID(mi, 0xd85f5ff0, 0x12ca, 0x464d, 0x86, 0x51, 0x53, 0x36, 0x9f, 0x1d, 0x80, 0x45);
mi.position = 1001;
|