在cosmos contact list 中,为实现输入笔画显示到输入框,并搜索出对应的联系人,可以参考下面修改两处实现:
1,添加一句 m_editor->setIME(IMM_INPUT_TYPE_QUICK_SEARCH);///
void VappPhbListCp::setSearchString(const VfxWString& search)
{
VcpListMenuSearchBar *m_searchbar = enableSearchBar();
VcpTextEditor *m_editor;
m_editor = m_searchbar->getSearchEditor();
VfxWString text = search;
m_editor->setText(text, MMI_PHB_QSEARCH_LENGTH - 1);
m_editor->setHint(VFX_WSTR_RES(STR_GLOBAL_SEARCH));
m_editor->setIME(IMM_INPUT_TYPE_QUICK_SEARCH);///
m_editor->m_signalTextChanged.connect(this, &VappPhbListCp::OnTextChanged);
// query result
m_list->setQuery(search);
}
2,将 if (code != pinyin->ori_char) 注释掉,
将 IMM_INPUT_MODE_QUICK_SEARCH_PINYIN, 改为 mmi_imm_get_curr_input_mode()
static MMI_BOOL srv_phb_filter_convert_name(
WCHAR* name,
srv_phb_cov_name_cntx_struct* cntx,
srv_phb_query_cache_struct* cache,
U16 pattern_len,
srv_phb_query_match_info_struct* match_info)
{
。。。。。。
if (!pinyin)
{
pinyin = &(cache->pinyin_cache[min(cntx->name_offset, (MMI_PHB_PINYIN_CACHE_COUNT -1))]);
}
// if (code != pinyin->ori_char)
{
pinyin->ori_char = code;
pinyin->len = srv_phb_convert_to_spelling(
mmi_imm_get_curr_input_mode(),//
IMM_INPUT_MODE_QUICK_SEARCH_PINYIN,
code,
(WCHAR*)(pinyin->pinyin),
MMI_PHB_QSEARCH_LENGTH);
}
if (cntx->conv_char_pos[cntx->conv_start])
{
match_info->sequence_len++;
}
else
{
match_info->sequence_len = 1;
match_info->sequence_start = cntx->name_offset;
}
1,添加一句 m_editor->setIME(IMM_INPUT_TYPE_QUICK_SEARCH);///
void VappPhbListCp::setSearchString(const VfxWString& search)
{
VcpListMenuSearchBar *m_searchbar = enableSearchBar();
VcpTextEditor *m_editor;
m_editor = m_searchbar->getSearchEditor();
VfxWString text = search;
m_editor->setText(text, MMI_PHB_QSEARCH_LENGTH - 1);
m_editor->setHint(VFX_WSTR_RES(STR_GLOBAL_SEARCH));
m_editor->setIME(IMM_INPUT_TYPE_QUICK_SEARCH);///
m_editor->m_signalTextChanged.connect(this, &VappPhbListCp::OnTextChanged);
// query result
m_list->setQuery(search);
}
2,将 if (code != pinyin->ori_char) 注释掉,
将 IMM_INPUT_MODE_QUICK_SEARCH_PINYIN, 改为 mmi_imm_get_curr_input_mode()
static MMI_BOOL srv_phb_filter_convert_name(
WCHAR* name,
srv_phb_cov_name_cntx_struct* cntx,
srv_phb_query_cache_struct* cache,
U16 pattern_len,
srv_phb_query_match_info_struct* match_info)
{
。。。。。。
if (!pinyin)
{
pinyin = &(cache->pinyin_cache[min(cntx->name_offset, (MMI_PHB_PINYIN_CACHE_COUNT -1))]);
}
// if (code != pinyin->ori_char)
{
pinyin->ori_char = code;
pinyin->len = srv_phb_convert_to_spelling(
mmi_imm_get_curr_input_mode(),//
IMM_INPUT_MODE_QUICK_SEARCH_PINYIN,
code,
(WCHAR*)(pinyin->pinyin),
MMI_PHB_QSEARCH_LENGTH);
}
if (cntx->conv_char_pos[cntx->conv_start])
{
match_info->sequence_len++;
}
else
{
match_info->sequence_len = 1;
match_info->sequence_start = cntx->name_offset;
}