Merge branch '1110frontend' into 'new-frontend'
Adapt to the new version of XML file,add some restrictions. See merge request kylin-desktop/ukui-search!198
This commit is contained in:
commit
83aeea4ad0
|
@ -273,10 +273,7 @@ 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 %1").arg(key.left(key.indexOf("/")).toLower()));
|
||||||
process.startDetached(QString("ukui-control-center -m background"));
|
|
||||||
else
|
|
||||||
process.startDetached(QString("ukui-control-center -m %1").arg(key.left(key.indexOf("/")).toLower()));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -332,57 +329,56 @@ 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();
|
||||||
QString key = list.at(6).toElement().text();
|
//通过xml文件的子节点判断父节点是否有问题
|
||||||
chineseSearchResult = m_chineseSearchList.value(key);
|
if (list.count() >= 8 && (list.at(6).nodeName() == QString::fromLocal8Bit("EnglishFunc1"))) {
|
||||||
englishSearchResult = m_englishSearchList.value(key);
|
//直接获取二级菜单英文名
|
||||||
for (int i = 0; i < list.count(); ++i) {
|
QString key = list.at(6).toElement().text();
|
||||||
QDomNode n = list.at(i);
|
chineseSearchResult = m_chineseSearchList.value(key);
|
||||||
|
englishSearchResult = m_englishSearchList.value(key);
|
||||||
|
for (int i = 0; i < list.count(); ++i) {
|
||||||
|
QDomNode n = list.at(i);
|
||||||
|
|
||||||
if (n.nodeName() == QString::fromLocal8Bit("Environment")) {
|
if (n.nodeName() == QString::fromLocal8Bit("Environment")) {
|
||||||
version=n.toElement().text();
|
version=n.toElement().text();
|
||||||
if ((version == "v101" && environment == "wayland")
|
if ((version == "v101" && environment == "wayland")
|
||||||
|| (version == "hw990" && environment == "x11")) {
|
|| (version == "hw990" && environment == "x11")) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (n.nodeName() == QString::fromLocal8Bit("ChineseFunc1")) {
|
|
||||||
chineseIndex = n.toElement().text();
|
|
||||||
if (chineseIndex.isEmpty()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (0 == m_mixSearchList[key].count(chineseIndex)) {
|
if (n.nodeName() == QString::fromLocal8Bit("ChineseFunc1")) {
|
||||||
m_mixSearchList[key].insert(chineseIndex, key);
|
chineseIndex = n.toElement().text();
|
||||||
|
if (chineseIndex.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (0 == m_mixSearchList[key].count(chineseIndex)) {
|
||||||
|
m_mixSearchList[key].insert(chineseIndex, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (n.nodeName() == QString::fromLocal8Bit("ChineseFunc2")) {
|
||||||
if (n.nodeName() == QString::fromLocal8Bit("ChineseFunc2")) {
|
chineseIndex = n.toElement().text();
|
||||||
chineseIndex = n.toElement().text();
|
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