CString CTDLFindTaskAttributeComboBox::GetAttributeName(const SEARCHPARAM& sp) const
{
	TDC_ATTRIBUTE attrib = sp.GetAttribute();
	BOOL bRelativeDate = sp.GetFlags();

	int nAttrib = ATTRIB_COUNT;
	CEnString sName;

	while (nAttrib--)
	{
		if (ATTRIBUTES[nAttrib].attrib == attrib)
		{
			if (ATTRIBUTES[nAttrib].nAttribResID)
			{
				// handle relative dates
				sName.LoadString(ATTRIBUTES[nAttrib].nAttribResID);

				if (AttributeIsDate(attrib) && bRelativeDate)
				{
					sName += ' ';
					sName += CEnString(IDS_TDLBC_RELATIVEDATESUFFIX);
				}
			}

			return sName;
		}
	}

	// try custom attributes
	nAttrib = m_aAttribDefs.GetSize();

	while (nAttrib--)
	{
		if (m_aAttribDefs[nAttrib].GetAttributeID() == attrib)
		{
			if (AttributeIsDate(attrib) && bRelativeDate)
			{
				sName.Format(IDS_CUSTOMRELDATECOLUMN, m_aAttribDefs[nAttrib].sLabel);
			}
			else
			{
				sName.Format(IDS_CUSTOMCOLUMN, m_aAttribDefs[nAttrib].sLabel);
			}

			return sName;
		}
	}

	ASSERT (0); // not found
	return _T("");
}
Пример #2
0
void CToolsHelper::TestTool(const USERTOOL& tool, const USERTOOLARGS& args, CWnd* pWnd)
{
	CString sCmdline, sToolPath;

	if (PrepareCmdline(tool, args, sToolPath, sCmdline))
	{
		CEnString sMessage;
		sMessage.Format(IDS_TH_TESTTOOL, sToolPath, sCmdline);
		
		HWND hWnd = pWnd ? pWnd->GetSafeHwnd() : NULL;
		
		if (::MessageBox(hWnd, sMessage, CEnString(IDS_TH_TESTTOOL_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES)
		{
			DWORD dwRes = FileMisc::Run(hWnd, sToolPath, sCmdline, (tool.bRunMinimized ? SW_MINIMIZE : SW_SHOWNORMAL));
			
			if (dwRes <= 32)
			{
				// TODO
			}
		}
	}
}