diff options
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/clc.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/clistgroups.cpp | 26 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 0af50af530..4074bb4a91 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -72,8 +72,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if (hContact == NULL) {
- if (!strcmp(cws->szModule, "CListGroups") && !g_bGroupsLocked)
- Clist_Broadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ if (!strcmp(cws->szModule, "CListGroups")) {
+ if (g_bGroupsLocked)
+ Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
+ else
+ Clist_Broadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ }
return 0;
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index b8b3bbdb0e..524f91b9f0 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -268,30 +268,32 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) if (hGroup == 0 || hGroup == hGroupBefore)
return 0;
- CGroupInternal *pGroup = arByIds.find(hGroup - 1);
+ hGroup--;
+ CGroupInternal *pGroup = arByIds.find(hGroup);
if (pGroup == NULL)
return 0;
// shuffle list of groups up to fill gap
int shuffleFrom, shuffleTo, shuffleStep;
if (hGroupBefore == 0) {
- shuffleFrom = hGroup - 1;
- shuffleTo = -1;
+ shuffleFrom = 0;
+ shuffleTo = hGroup;
shuffleStep = 1;
}
else {
- CGroupInternal *pDest = arByIds.find(hGroupBefore - 1);
+ hGroupBefore--;
+ CGroupInternal *pDest = arByIds.find(hGroupBefore);
if (pDest == NULL)
return 0;
if (hGroup < hGroupBefore) {
- shuffleFrom = hGroup - 1;
- shuffleTo = hGroupBefore - 2;
+ shuffleFrom = hGroup;
+ shuffleTo = hGroupBefore;
shuffleStep = 1;
}
else {
- shuffleFrom = hGroup - 1;
- shuffleTo = hGroupBefore - 1;
+ shuffleFrom = hGroupBefore;
+ shuffleTo = hGroup;
shuffleStep = -1;
}
}
@@ -299,17 +301,18 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) g_bGroupsLocked = true;
arByIds.remove(pGroup);
- for (int i = shuffleFrom; i != shuffleTo; i += shuffleStep) {
- CGroupInternal *p = arByIds[i + shuffleStep];
+ for (int i = shuffleFrom; i < shuffleTo; i++) {
+ CGroupInternal *p = arByIds[i];
p->groupId -= shuffleStep;
p->save();
}
- pGroup->groupId = shuffleTo; // reinsert group back
+ pGroup->groupId = hGroupBefore; // reinsert group back
pGroup->save();
arByIds.insert(pGroup);
g_bGroupsLocked = false;
+ Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0);
return shuffleTo + 1;
}
@@ -374,7 +377,6 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) }
}
}
- Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0);
}
const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), oldName, (wchar_t*)szName };
|