diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 96f27bb6c..91226657e 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2307,6 +2307,62 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerMoveContact, "move_contact"); +uint lastPeopleIndexChangeGroup; +//================================================================================================================= +class CHandlerChangeContactGroupBegin : public IActionHandler +{ +public: + void execute (CCtrlBase * /* pCaller */, const std::string &sParams) + { + // retrieve the index of the people + CPeopleList *srcList; + if (PeopleInterraction.getPeopleFromCurrentMenu(srcList, lastPeopleIndexChangeGroup)) + { + string groupName= getParam(sParams, "group"); + CInterfaceGroup *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(groupName)); + if (gc) + { + CGroupEditBox *geb = dynamic_cast(gc->getGroup("change_contact_group_eb:eb")); + geb->setInputString(ucstring("")); + } + CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); + } + } +}; +REGISTER_ACTION_HANDLER( CHandlerMoveContact, "change_contact_group_begin"); + +//================================================================================================================= +// Add a contact to the list +class CHandlerChangeContactGroup : public IActionHandler +{ +public: + void execute (CCtrlBase *pCaller, const std::string &/* sParams */) + { + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + + if (pCaller) + { + // Get the modal edit box + CGroupEditBox *geb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:change_contact_group_eb:eb")); + if (geb && !geb->getInputString().empty()) + { + // don't add if it is the player name + if (!ClientCfg.Local && (UserEntity->getEntityName() == geb->getInputString())) + { + displayVisibleSystemMsg(CI18N::get("uiCantAddYourSelfInContactList")); + } + else + { + PeopleInterraction.askAddContact(geb->getInputString(), peopleList); + geb->setInputString(ucstring("")); + } + geb->setInputString(ucstring("")); + } + } + CAHManager::getInstance()->runActionHandler("leave_modal", pCaller, ""); + } +}; +REGISTER_ACTION_HANDLER( CHandlerAddContact, "change_contact_group"); //================================================================================================================= class CHandlerSortContacts : public IActionHandler diff --git a/code/ryzom/client/src/interface_v3/people_list.h b/code/ryzom/client/src/interface_v3/people_list.h index 32317b6b8..6845ce73a 100644 --- a/code/ryzom/client/src/interface_v3/people_list.h +++ b/code/ryzom/client/src/interface_v3/people_list.h @@ -151,13 +151,14 @@ public: private: struct CPeople { - CPeople() : Container(NULL), Chat(NULL), Online(ccs_offline), Blocked(false), ContactId(0) {} + CPeople() : Container(NULL), Chat(NULL), Online(ccs_offline), Blocked(false), ContactId(0), Group("") {} NLMISC::CRefPtr Container; // todo : replace this with a CChatWindow one day, for consistency NLMISC::CRefPtr Chat; uint GlobalID; TCharConnectionState Online; bool Blocked; uint32 ContactId; + ucstring Group; bool operator < (const CPeople &other) const { return getName() < other.getName(); } ucstring getName() const { return Container->getUCTitle(); } };