forked from openkylin/ukui-search
Adapt to the new version of XML file,add some restrictions.
This commit is contained in:
parent
311983d9b2
commit
905051dc98
|
@ -273,9 +273,6 @@ void SettingsSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
switch (actionkey) {
|
switch (actionkey) {
|
||||||
case 0:
|
case 0:
|
||||||
//打开控制面板对应页面
|
//打开控制面板对应页面
|
||||||
if (key.left(key.indexOf("/")).toLower() == "wallpaper")
|
|
||||||
process.startDetached(QString("ukui-control-center -m background"));
|
|
||||||
else
|
|
||||||
process.startDetached(QString("ukui-control-center -m %1").arg(key.left(key.indexOf("/")).toLower()));
|
process.startDetached(QString("ukui-control-center -m %1").arg(key.left(key.indexOf("/")).toLower()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -332,6 +329,9 @@ void SettingsSearchPlugin::xmlElement() {
|
||||||
while (!node.isNull()) {
|
while (!node.isNull()) {
|
||||||
QDomElement element = node.toElement();
|
QDomElement element = node.toElement();
|
||||||
QDomNodeList list = element.childNodes();
|
QDomNodeList list = element.childNodes();
|
||||||
|
//通过xml文件的子节点判断父节点是否有问题
|
||||||
|
if (list.count() >= 8 && (list.at(6).nodeName() == QString::fromLocal8Bit("EnglishFunc1"))) {
|
||||||
|
//直接获取二级菜单英文名
|
||||||
QString key = list.at(6).toElement().text();
|
QString key = list.at(6).toElement().text();
|
||||||
chineseSearchResult = m_chineseSearchList.value(key);
|
chineseSearchResult = m_chineseSearchList.value(key);
|
||||||
englishSearchResult = m_englishSearchList.value(key);
|
englishSearchResult = m_englishSearchList.value(key);
|
||||||
|
@ -360,29 +360,25 @@ void SettingsSearchPlugin::xmlElement() {
|
||||||
if (chineseIndex.isEmpty()) {
|
if (chineseIndex.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (chineseSearchResult.contains(chineseIndex)) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
chineseSearchResult.append(chineseIndex);
|
chineseSearchResult.append(chineseIndex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (n.nodeName() == QString::fromLocal8Bit("EnglishFunc2")) {
|
if (n.nodeName() == QString::fromLocal8Bit("EnglishFunc2")) {
|
||||||
englishIndex = /*QString::fromLocal8Bit("/") + */n.toElement().text();
|
englishIndex = /*QString::fromLocal8Bit("/") + */n.toElement().text();
|
||||||
if (englishIndex.isEmpty()) {
|
if (englishIndex.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (englishSearchResult.contains(englishIndex)) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
englishSearchResult.append(englishIndex);
|
englishSearchResult.append(englishIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_chineseSearchList.insert(key, chineseSearchResult);
|
m_chineseSearchList.insert(key, chineseSearchResult);
|
||||||
m_englishSearchList.insert(key, englishSearchResult);
|
m_englishSearchList.insert(key, englishSearchResult);
|
||||||
node = node.nextSibling();
|
node = node.nextSibling();
|
||||||
|
} else {
|
||||||
|
qWarning() << "There's something wrong with the xml file's item:" << element.attribute("name");
|
||||||
|
node = node.nextSibling();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue