void CSearchBussinessPartnerPage::ClearSearchResult()
{
	CButtonUI* pBtnAvatar = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_avatar));
	if (NULL != pBtnAvatar)
	{	
		pBtnAvatar->SetBkImage(_T(""));
	}

	CLabelUI* pLabelNickname = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_nick));
	if (NULL != pLabelNickname)
	{
		pLabelNickname->SetText(_T(""));
	}

	CLabelUI* pLabelCompany = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_company));
	if (NULL != pLabelCompany)
	{
		pLabelCompany->SetText(_T(""));
	}

	CButtonUI* pAddFriend = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_add_friend));
	if (NULL != pAddFriend)
	{
		pAddFriend->SetVisible(false);
	}

	if (NULL != m_pCurUserInfo)
	{
		delete m_pCurUserInfo;
		m_pCurUserInfo = NULL;
	}
}
示例#2
0
void SessionLayout::FreshAllGroupMemberAvatar()
{
	if (!m_pGroupMemberList)
	{
		return;
	}
	for (int n = 0; n < m_pGroupMemberList->GetCount(); n++)
	{
		CListContainerElementUI* pItem = (CListContainerElementUI*)m_pGroupMemberList->GetItemAt(n);
		if (pItem)
		{
			CDuiString userData = pItem->GetUserData();
			if (!userData.IsEmpty())
			{
				std::string sid = util::cStringToString(CString(userData));
				module::UserInfoEntity userInfo;
				if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
				{
					LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sid),util::stringToCString(m_sId));
					continue;;
				}
				CButtonUI* btnAvatarInfo = (CButtonUI*)pItem->FindSubControl(_T("AvatarInfo"));
				if (btnAvatarInfo)
				{
					btnAvatarInfo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));
				}
			}
		}
	}
	m_pGroupMemberList->SortItems(GroupMemberListItemCompareFunc, 0);
}
示例#3
0
void SessionLayout::_AddGroupMemberToList(IN const std::string& sID, IN const BOOL bCreator)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo))
	{
		LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sID),util::stringToCString(m_sId));
		return;
	}
	CDialogBuilder dlgBuilder;
	CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager);
	if (!pListElement)
	{
		LOG__(ERR, _T("群item创建失败"));
		return;
	}
	CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
	PTR_VOID(pLogo);
	pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

	if (bCreator)
	{
		CButtonUI* pCreator = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("Creator")));
		PTR_VOID(pCreator);
		pCreator->SetVisible(true);
		pCreator->SetUserData(_T("Creator"));
	}

	CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
	PTR_VOID(pNameLable);
	pNameLable->SetText(userInfo.getRealName());
	pListElement->SetUserData(util::stringToCString(userInfo.sId));

	m_pGroupMemberList->Add(pListElement);
}
示例#4
0
void SessionLayout::FreshGroupMemberAvatar(IN const std::string& sID)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo))
	{
		APP_LOG(LOG_ERROR, _T("SessionLayout::_updateGroupMembersList(),can't find the userInfo"));
		return;
	}

	if (!m_pGroupMemberList)
	{
		return;
	}
	for (int n = 0; n < m_pGroupMemberList->GetCount(); n++)
	{
		CListContainerElementUI* pItem = (CListContainerElementUI*)m_pGroupMemberList->GetItemAt(n);
		if (pItem)
		{
			CDuiString userData = pItem->GetUserData();
			if (!userData.IsEmpty())
			{
				std::string sid = util::cStringToString(CString(userData));
				if (sid == sID)
				{
					CButtonUI* btnAvatarInfo = (CButtonUI*)pItem->FindSubControl(_T("AvatarInfo"));
					if (btnAvatarInfo)
					{
						btnAvatarInfo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));
					}
				}
			}
		}
	}
	m_pGroupMemberList->SortItems(GroupMemberListItemCompareFunc, 0);
}
示例#5
0
void SessionLayout::_AddGroupMemberToList(IN const std::string& sID)
{
	module::UserInfoEntity userInfo;
	if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo))
	{
		APP_LOG(LOG_ERROR, _T("SessionLayout::_updateGroupMembersList(),can't find the userInfo"));
		return;
	}
	CDialogBuilder dlgBuilder;
	CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager);
	if (!pListElement)
	{
		APP_LOG(LOG_ERROR, _T("群item创建失败"));
		return;
	}
	CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
	if (!pLogo)
	{
		return;
	}
	pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

	CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
	if (!pNameLable)
	{
		return;
	}
	pNameLable->SetText(userInfo.getRealName());
	pListElement->SetUserData(util::stringToCString(userInfo.sId));

	m_pGroupMemberList->Add(pListElement);

}
示例#6
0
bool CBookClient::AddNode(BOOK_INFO *item)
{
	if (item == NULL)	return false;

	BOOK_INFO *node	= new BOOK_INFO;
	node->strName	= item->strName;
	node->nImage	= item->nImage;
	node->strPath	= item->strPath;
	node->nBookmark	= item->nBookmark;

	CContainerUI* pDesk = NULL;
	if( !m_dlgBuilder.GetMarkup()->IsValid() )
	{
		pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create(_T("iBook.xml"), (UINT)0, NULL, &m_pm));
	}
	else
	{
		pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create((UINT)0, &m_pm));
	}

	if( pDesk != NULL )	
	{
		this->Add(pDesk);

		CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnBookEx")));
		CLabelUI *text = static_cast<CLabelUI*>(m_pm.FindSubControlByName(pDesk, _T("labelBookEx")));
		CButtonUI *btnEdit = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnbookdel")));
		if (btn == NULL || text == NULL || btnEdit == NULL)	return false;

		CDuiString strImage;
		strImage.Format(_T("book\\%02d.png"), node->nImage);
		btn->SetBkImage(strImage);
		text->SetText(node->strName);
		btnEdit->SetVisible(m_bEdit);

		pDesk->SetTag((UINT_PTR)node);
	}
	else
	{
		delete node;
		node = NULL;

		return false;
	}

	return true;
}
示例#7
0
void SessionLayout::_UpdateSearchRsultList(IN const std::vector<std::string>& nameList)
{
	if (nameList.empty())
	{
		return;
	}
	for (std::string sid : nameList)
	{
		module::UserInfoEntity userInfo;
		if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
		{
			LOG__(ERR, _T("can't find the userInfo:%s,GroupId: %s"),util::stringToCString(sid),util::stringToCString(m_sId));
			continue;
		}
		CDialogBuilder dlgBuilder;
		CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager);
		if (!pListElement)
		{
			LOG__(ERR, _T("creat group item failed"));
			return;
		}
		CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo")));
		if (!pLogo)
		{
			return;
		}
		pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));

		CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname")));
		if (!pNameLable)
		{
			return;
		}
		pNameLable->SetText(userInfo.getRealName());
		pListElement->SetUserData(util::stringToCString(userInfo.sId));

		m_pSearchResultList->Add(pListElement);
	}
}
void CSearchBussinessPartnerPage::SetSearchResult(sUserVCard& oneCard)
{	
	m_strFindPhoneNo.clear();
	m_pBtnQuery->SetEnabled(true);
	CButtonUI* pBtnAvatar = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_avatar));
	if (NULL != pBtnAvatar)
	{	
		bool bExist = PathFileExists(oneCard.strPhotoPath.c_str());
		if (!bExist || oneCard.strPhotoPath.empty())
		{
			pBtnAvatar->SetBkImage(DEF_AVATAR_NOR);
		}
		else
		{
			pBtnAvatar->SetBkImage(oneCard.strPhotoPath.c_str());
		}
	}

	int index = oneCard.strAccount.find('@');
	tstring strPhone = oneCard.strAccount.substr(0,index);

	CLabelUI* pLabelNickname = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_nick));
	if (NULL != pLabelNickname)
	{	
		if (oneCard.strUserNickname.empty())
		{
			pLabelNickname->SetText(strPhone.c_str());
		}
		else
		{
			pLabelNickname->SetText(oneCard.strUserNickname.c_str());
		}
		
	}

	orgInfo org;
	CLabelUI* pLabelCompany = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_company));
	if (CWebClient::GetOrgByPhone(strPhone, org))
	{
		//CLabelUI* pLabelCompany = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_company));
		if (NULL != pLabelCompany)
		{
			pLabelCompany->SetText(org.strName.c_str());
		}
	}
	else
	{
		if (NULL != pLabelCompany)
		{
			pLabelCompany->SetText(org.strName.c_str());
		}
	}


	

	CButtonUI* pAddFriend = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_add_friend));
	if (NULL != pAddFriend)
	{
		pAddFriend->SetVisible(true);
	}

	//更新cache
	if (NULL != m_pCurUserInfo)
	{
		delete m_pCurUserInfo;
		m_pCurUserInfo = NULL;
	}

	//refresh org info.

	m_pCurUserInfo = new sUserVCard;
	if (NULL != m_pCurUserInfo)
	{
		m_pCurUserInfo->strAccount = oneCard.strAccount;
		m_pCurUserInfo->strUserNickname = oneCard.strUserNickname;
		m_pCurUserInfo->strRemark = oneCard.strRemark;
		m_pCurUserInfo->strGender = oneCard.strGender;	
		m_pCurUserInfo->strSignature = oneCard.strSignature;
		m_pCurUserInfo->strPhone = oneCard.strPhone;
		m_pCurUserInfo->strEmail = oneCard.strEmail;
		m_pCurUserInfo->strAddr = oneCard.strAddr;
		m_pCurUserInfo->strPhotoType = oneCard.strPhotoType;
		m_pCurUserInfo->strPhotoBinary = oneCard.strPhotoBinary;
		m_pCurUserInfo->strUrl = oneCard.strUrl;
		m_pCurUserInfo->strPhotoPath = oneCard.strPhotoPath;
		m_pCurUserInfo->strGrayAvatar = oneCard.strGrayAvatar;
		m_pCurUserInfo->strAge = oneCard.strAge;
		m_pCurUserInfo->strOrganization = org.strName;
	}
}