Fix a bug for app match;
This commit is contained in:
parent
bbf27b9d5f
commit
4b02fdbb34
|
@ -228,10 +228,11 @@ void AppMatch::getDesktopFilePath() {
|
|||
}
|
||||
|
||||
void AppMatch::getAppName(QMap<NameString, QStringList> &installed) {
|
||||
QMap<NameString, QStringList>::const_iterator i;
|
||||
for(i = m_installAppMap.constBegin(); i != m_installAppMap.constEnd(); ++i) {
|
||||
appNameMatch(i.key().app_name, installed);
|
||||
}
|
||||
// QMap<NameString, QStringList>::const_iterator i;
|
||||
// for(i = m_installAppMap.constBegin(); i != m_installAppMap.constEnd(); ++i) {
|
||||
// appNameMatch(i.key().app_name, installed);
|
||||
// }
|
||||
appNameMatch(installed);
|
||||
qDebug() << "installed app match is successful!";
|
||||
}
|
||||
|
||||
|
@ -276,6 +277,38 @@ void AppMatch::appNameMatch(QString appname, QMap<NameString, QStringList> &inst
|
|||
}
|
||||
}
|
||||
}
|
||||
void AppMatch::appNameMatch(QMap<NameString, QStringList> &installed) {
|
||||
QStringList list;
|
||||
NameString name;
|
||||
QMapIterator<NameString, QStringList> iter(m_installAppMap);
|
||||
while(iter.hasNext()) {
|
||||
iter.next();
|
||||
list = iter.value();
|
||||
name.app_name = iter.key().app_name;
|
||||
if(iter.key().app_name.contains(m_sourceText, Qt::CaseInsensitive)) {
|
||||
installed.insert(name, list);
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList pinyinlist;
|
||||
pinyinlist = FileUtils::findMultiToneWords(iter.key().app_name);
|
||||
|
||||
for(int i = 0; i < pinyinlist.size() / 2; i++) {
|
||||
QString shouzimu = pinyinlist.at(2 * i + 1); // 中文转首字母
|
||||
if(shouzimu.contains(m_sourceText, Qt::CaseInsensitive)) {
|
||||
installed.insert(name, list);
|
||||
continue;
|
||||
}
|
||||
if(m_sourceText.size() < 2)
|
||||
continue;
|
||||
QString pinyin = pinyinlist.at(2 * i); // 中文转拼音
|
||||
if(pinyin.contains(m_sourceText, Qt::CaseInsensitive)) {
|
||||
installed.insert(name, list);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppMatch::softWareCenterSearch(QMap<NameString, QStringList> &softwarereturn) {
|
||||
// if(m_interFace->timeout() != -1) {
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
void getAppName(QMap<NameString, QStringList> &installed);
|
||||
// void appNameMatch(QString appname,QString desktoppath,QString appicon);
|
||||
void appNameMatch(QString appname, QMap<NameString, QStringList> &installed);
|
||||
void appNameMatch(QMap<NameString, QStringList> &installed);
|
||||
|
||||
void softWareCenterSearch(QMap<NameString, QStringList> &softwarereturn);
|
||||
|
||||
|
|
Loading…
Reference in New Issue