Skip to content

Commit

Permalink
Get rid of qxml and just use plain string comparision.
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Dec 28, 2021
1 parent fae5062 commit fd06094
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 83 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ if(ENABLE_QT4)
endif()

if(ENABLE_QT5)
find_package(Qt5 ${REQUIRED_QT5_VERSION} CONFIG REQUIRED Core DBus Widgets Xml)
find_package(Qt5 ${REQUIRED_QT5_VERSION} CONFIG REQUIRED Core DBus Widgets)
find_package(Qt5Gui ${REQUIRED_QT5_VERSION} REQUIRED Private)
add_subdirectory(qt5)
endif()

if(ENABLE_QT6)
find_package(Qt6 ${REQUIRED_QT6_VERSION} CONFIG REQUIRED Core DBus Xml)
find_package(Qt6 ${REQUIRED_QT6_VERSION} CONFIG REQUIRED Core DBus)
find_package(Qt6Gui ${REQUIRED_QT6_VERSION} REQUIRED Private)
add_subdirectory(qt6)
endif()
Expand Down
2 changes: 0 additions & 2 deletions qt4/dbusaddons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ target_link_libraries(
PUBLIC
Qt4::QtCore
Qt4::QtDBus
PRIVATE
Qt4::QtXml
)

if(BUILD_ONLY_PLUGIN)
Expand Down
28 changes: 3 additions & 25 deletions qt4/dbusaddons/fcitxqtinputcontextproxy_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "fcitxqtinputmethodproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#include <QDomDocument>

namespace fcitx {

Expand Down Expand Up @@ -176,30 +175,9 @@ class FcitxQtInputContextProxyPrivate {
if (introspectWatcher_->isFinished() &&
!introspectWatcher_->isError()) {
QDBusPendingReply<QString> reply = *introspectWatcher_;
QDomDocument dom;

dom.setContent(reply.value());
QDomNodeList ifaceNodeList = dom.elementsByTagName("interface");
for (int i = 0; i < ifaceNodeList.count(); i++) {
QDomElement ifaceElem = ifaceNodeList.item(i).toElement();
if (!ifaceElem.isNull() &&
ifaceElem.attribute("name") ==
FcitxQtInputContextProxyImpl::staticInterfaceName()) {
QDomNodeList methodNodeList =
ifaceElem.elementsByTagName("method");
for (int j = 0; j < methodNodeList.count(); j++) {

QDomElement methodElem =
methodNodeList.item(j).toElement();

if (!methodElem.isNull() &&
methodElem.attribute("name") == "InvokeAction") {
supportInvokeAction_ = true;
break;
}
}
return;
}

if (reply.value().contains("InvokeAction")) {
supportInvokeAction_ = true;
}
}
delete introspectWatcher_;
Expand Down
2 changes: 0 additions & 2 deletions qt5/dbusaddons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ target_link_libraries(
PUBLIC
Qt5::Core
Qt5::DBus
PRIVATE
Qt5::Xml
)

if(BUILD_ONLY_PLUGIN)
Expand Down
28 changes: 3 additions & 25 deletions qt5/dbusaddons/fcitxqtinputcontextproxy_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "fcitxqtinputmethodproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#include <QDomDocument>

namespace fcitx {

Expand Down Expand Up @@ -173,30 +172,9 @@ class FcitxQtInputContextProxyPrivate {
if (introspectWatcher_->isFinished() &&
!introspectWatcher_->isError()) {
QDBusPendingReply<QString> reply = *introspectWatcher_;
QDomDocument dom;

dom.setContent(reply.value());
QDomNodeList ifaceNodeList = dom.elementsByTagName("interface");
for (int i = 0; i < ifaceNodeList.count(); i++) {
QDomElement ifaceElem = ifaceNodeList.item(i).toElement();
if (!ifaceElem.isNull() &&
ifaceElem.attribute("name") ==
FcitxQtInputContextProxyImpl::staticInterfaceName()) {
QDomNodeList methodNodeList =
ifaceElem.elementsByTagName("method");
for (int j = 0; j < methodNodeList.count(); j++) {

QDomElement methodElem =
methodNodeList.item(j).toElement();

if (!methodElem.isNull() &&
methodElem.attribute("name") == "InvokeAction") {
supportInvokeAction_ = true;
break;
}
}
return;
}

if (reply.value().contains("InvokeAction")) {
supportInvokeAction_ = true;
}
}
delete introspectWatcher_;
Expand Down
2 changes: 0 additions & 2 deletions qt6/dbusaddons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ target_link_libraries(
PUBLIC
Qt6::Core
Qt6::DBus
PRIVATE
Qt6::Xml
)

if(BUILD_ONLY_PLUGIN)
Expand Down
28 changes: 3 additions & 25 deletions qt6/dbusaddons/fcitxqtinputcontextproxy_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "fcitxqtinputmethodproxy.h"
#include "fcitxqtwatcher.h"
#include <QDBusServiceWatcher>
#include <QDomDocument>

namespace fcitx {

Expand Down Expand Up @@ -173,30 +172,9 @@ class FcitxQtInputContextProxyPrivate {
if (introspectWatcher_->isFinished() &&
!introspectWatcher_->isError()) {
QDBusPendingReply<QString> reply = *introspectWatcher_;
QDomDocument dom;

dom.setContent(reply.value());
QDomNodeList ifaceNodeList = dom.elementsByTagName("interface");
for (int i = 0; i < ifaceNodeList.count(); i++) {
QDomElement ifaceElem = ifaceNodeList.item(i).toElement();
if (!ifaceElem.isNull() &&
ifaceElem.attribute("name") ==
FcitxQtInputContextProxyImpl::staticInterfaceName()) {
QDomNodeList methodNodeList =
ifaceElem.elementsByTagName("method");
for (int j = 0; j < methodNodeList.count(); j++) {

QDomElement methodElem =
methodNodeList.item(j).toElement();

if (!methodElem.isNull() &&
methodElem.attribute("name") == "InvokeAction") {
supportInvokeAction_ = true;
break;
}
}
return;
}

if (reply.value().contains("InvokeAction")) {
supportInvokeAction_ = true;
}
}
delete introspectWatcher_;
Expand Down

0 comments on commit fd06094

Please sign in to comment.