Merge branch '0607-dev' into 'dev-unity'
Fix a bug for app match; See merge request kylin-desktop/ukui-search!46
This commit is contained in:
commit
316a4ae815
|
@ -228,10 +228,11 @@ void AppMatch::getDesktopFilePath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMatch::getAppName(QMap<NameString, QStringList> &installed) {
|
void AppMatch::getAppName(QMap<NameString, QStringList> &installed) {
|
||||||
QMap<NameString, QStringList>::const_iterator i;
|
// QMap<NameString, QStringList>::const_iterator i;
|
||||||
for(i = m_installAppMap.constBegin(); i != m_installAppMap.constEnd(); ++i) {
|
// for(i = m_installAppMap.constBegin(); i != m_installAppMap.constEnd(); ++i) {
|
||||||
appNameMatch(i.key().app_name, installed);
|
// appNameMatch(i.key().app_name, installed);
|
||||||
}
|
// }
|
||||||
|
appNameMatch(installed);
|
||||||
qDebug() << "installed app match is successful!";
|
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) {
|
void AppMatch::softWareCenterSearch(QMap<NameString, QStringList> &softwarereturn) {
|
||||||
// if(m_interFace->timeout() != -1) {
|
// if(m_interFace->timeout() != -1) {
|
||||||
|
|
|
@ -65,6 +65,7 @@ private:
|
||||||
void getAppName(QMap<NameString, QStringList> &installed);
|
void getAppName(QMap<NameString, QStringList> &installed);
|
||||||
// void appNameMatch(QString appname,QString desktoppath,QString appicon);
|
// void appNameMatch(QString appname,QString desktoppath,QString appicon);
|
||||||
void appNameMatch(QString appname, QMap<NameString, QStringList> &installed);
|
void appNameMatch(QString appname, QMap<NameString, QStringList> &installed);
|
||||||
|
void appNameMatch(QMap<NameString, QStringList> &installed);
|
||||||
|
|
||||||
void softWareCenterSearch(QMap<NameString, QStringList> &softwarereturn);
|
void softWareCenterSearch(QMap<NameString, QStringList> &softwarereturn);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue