summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-12-13 12:04:36 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-12-13 12:04:36 +0000
commit2ed424c0339a14c34b0f63a5fc4c8122501acedb (patch)
treebbd431132c837cf5739bdc69f27152c80b2caa28 /src/mir_app
parent46d84d5009a0b3eb19246a9ff01fc60d002e811e (diff)
- Move to group menu item doesn't popup in menu editor anymore;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@15853 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/menu_clist.cpp2
-rw-r--r--src/mir_app/src/movetogroup.cpp57
2 files changed, 25 insertions, 34 deletions
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index 092b735f3d..86bc5436ac 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -41,7 +41,6 @@ void InitTrayMenus(void);
// new menu sys
int hMainMenuObject = 0, hContactMenuObject = 0, hStatusMenuObject = 0;
-int UnloadMoveToGroup(void);
int statustopos(int status);
void Proto_SetStatus(const char *szProto, unsigned status);
@@ -1187,7 +1186,6 @@ void UninitCustomMenus(void)
Menu_RemoveObject(hMainMenuObject);
Menu_RemoveObject(hStatusMenuObject);
- UnloadMoveToGroup();
FreeMenuProtos();
DestroyMenu(hMainMenu);
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp
index 5d3a7785f0..6adf0038b8 100644
--- a/src/mir_app/src/movetogroup.cpp
+++ b/src/mir_app/src/movetogroup.cpp
@@ -24,13 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HGENMENU hMoveToGroupItem = 0, hPriorityItem = 0, hFloatingItem = 0;
-
-LIST<HANDLE> lphGroupsItems(5);
-
-//service
-//wparam - hcontact
-//lparam .popupposition from TMO_MenuItem
+static HGENMENU hMoveToGroupItem = 0, hPriorityItem = 0, hFloatingItem = 0;
+static LIST<HANDLE> lphGroupsItems(5);
#define MTG_MOVE "MoveToGroup/Move"
@@ -40,12 +35,16 @@ struct GroupItemSort
int position;
GroupItemSort(TCHAR* pname, int pos)
- : name(mir_tstrdup(pname)), position(pos) {}
+ : name(mir_tstrdup(pname)), position(pos)
+ {
+ }
~GroupItemSort() { mir_free(name); }
static int compare(const GroupItemSort* d1, const GroupItemSort* d2)
- { return _tcscoll(d1->name, d2->name); }
+ {
+ return _tcscoll(d1->name, d2->name);
+ }
};
static TCHAR* PrepareGroupName(TCHAR* str)
@@ -54,14 +53,14 @@ static TCHAR* PrepareGroupName(TCHAR* str)
if (p == NULL)
return mir_tstrdup(str);
- d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2*mir_tstrlen(str)+1));
+ d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2 * mir_tstrlen(str) + 1));
while (*str) {
if (*str == '&')
- *d++='&';
- *d++=*str++;
+ *d++ = '&';
+ *d++ = *str++;
}
- *d++=0;
+ *d++ = 0;
return p;
}
@@ -82,22 +81,14 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo
mir_free(mi.name.t);
}
+// service
+// wparam - hcontact
+// lparam .popupposition from TMO_MenuItem
+
static int OnContactMenuBuild(WPARAM wParam, LPARAM)
{
- int i;
OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);
-
- if (!hMoveToGroupItem) {
- CMenuItem mi;
- SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5);
- mi.position = 100000;
- mi.name.a = LPGEN("&Move to group");
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP);
-
- hMoveToGroupItem = Menu_AddContactMenuItem(&mi);
- }
-
- for (i=0; i < lphGroupsItems.getCount(); i++)
+ for (int i = 0; i < lphGroupsItems.getCount(); i++)
Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
lphGroupsItems.destroy();
@@ -109,7 +100,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
pos += 100000; // Separator
- for (i=0; ; i++) {
+ for (int i = 0;; i++) {
char intname[20];
_itoa(i, intname, 10);
@@ -123,7 +114,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
mir_free(dbv.ptszVal);
}
- for (i=0; i < groups.getCount(); i++) {
+ for (int i = 0; i < groups.getCount(); i++) {
bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name);
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
}
@@ -141,9 +132,11 @@ void MTG_OnmodulesLoad()
{
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenuBuild);
CreateServiceFunction(MTG_MOVE, MTG_DOMOVE);
-}
-int UnloadMoveToGroup(void)
-{
- return 0;
+ CMenuItem mi;
+ SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5);
+ mi.position = 100000;
+ mi.name.a = LPGEN("&Move to group");
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP);
+ hMoveToGroupItem = Menu_AddContactMenuItem(&mi);
}