diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-20 09:37:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-20 09:37:48 +0000 |
commit | 64751211cc037081bc32d4c41c17e064162d6ca4 (patch) | |
tree | 0d273bc5bfefbf45b39bcad9b65df16583f1e8ee /src | |
parent | 2c41d37ed5f2f0cb78300f8287933a4922ae1d28 (diff) |
- fix for moving groups;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@17326 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-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 };
|