summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-09-07 20:57:25 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-09-09 09:54:15 (GMT)
commit2a91c3df1b86e881d0c0ac09d350404b3667b3c9 (patch)
tree12291d8b972fea9d0effdccc86799eae1ed1b152
parent5f302f703ae3d6bcafb07ce26c7e9f2ee9afc878 (diff)
downloadswift-2a91c3df1b86e881d0c0ac09d350404b3667b3c9.zip
swift-2a91c3df1b86e881d0c0ac09d350404b3667b3c9.tar.bz2
Find <input> elements correctly after accepting MUC invites.
Resolves: #1129 License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
-rw-r--r--Swift/QtUI/QtChatView.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 433ade4..efd00e4 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -365,18 +365,18 @@ void QtChatView::resetView() {
connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection);
}
-QWebElement findDivElementWithID(QWebElement document, QString id) {
- QWebElementCollection divs = document.findAll("div");
- foreach(QWebElement div, divs) {
- if (div.attribute("id") == id) {
- return div;
+QWebElement findElementWithID(QWebElement document, QString elementName, QString id) {
+ QWebElementCollection elements = document.findAll(elementName);
+ foreach(QWebElement element, elements) {
+ if (element.attribute("id") == id) {
+ return element;
}
}
return QWebElement();
}
void QtChatView::setFileTransferProgress(QString id, const int percentageDone) {
- QWebElement ftElement = findDivElementWithID(document_, id);
+ QWebElement ftElement = findElementWithID(document_, "div", id);
if (ftElement.isNull()) {
SWIFT_LOG(debug) << "Tried to access FT UI via invalid id!" << std::endl;
return;
@@ -389,7 +389,7 @@ void QtChatView::setFileTransferProgress(QString id, const int percentageDone) {
}
void QtChatView::setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& /* msg */) {
- QWebElement ftElement = findDivElementWithID(document_, id);
+ QWebElement ftElement = findElementWithID(document_, "div", id);
if (ftElement.isNull()) {
SWIFT_LOG(debug) << "Tried to access FT UI via invalid id! id = " << Q2PSTRING(id) << std::endl;
return;
@@ -445,8 +445,8 @@ void QtChatView::setWhiteboardSessionStatus(QString id, const ChatWindow::Whiteb
}
void QtChatView::setMUCInvitationJoined(QString id) {
- QWebElement divElement = findDivElementWithID(document_, id);
- QWebElement buttonElement = divElement.findFirst("input#mucinvite");
+ QWebElement divElement = findElementWithID(document_, "div", id);
+ QWebElement buttonElement = findElementWithID(divElement, "input", "mucinvite");
if (!buttonElement.isNull()) {
buttonElement.setAttribute("value", tr("Return to room"));
}