summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatView.cpp21
-rw-r--r--Swift/QtUI/QtChatView.h4
-rw-r--r--Swift/QtUI/QtChatWindow.cpp4
-rw-r--r--Swift/QtUI/QtChatWindow.h1
4 files changed, 19 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index ef558b7..d48365b 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -106,16 +106,21 @@ void QtChatView::addToDOM(boost::shared_ptr<ChatSnippet> snippet) {
}
}
-void QtChatView::correctLastMessage(const QString& newMessage) {
+void QtChatView::replaceLastMessage(const QString& newMessage) {
/* FIXME: must be queued */
- lastElement_.findFirst("swift_message");
- lastElement_.setPlainText(ChatSnippet::escape(newMessage));
+ QWebElement replace = lastElement_.findFirst("span.swift_message");
+ assert(!replace.isNull());
+ QString old = lastElement_.toOuterXml();
+ replace.setInnerXml(ChatSnippet::escape(newMessage));
+ qDebug() << "Replacing old: " << old;
+ qDebug() << "With new: " << lastElement_.toOuterXml();
}
-void QtChatView::correctLastMessage(const QString& newMessage, const QString& note) {
- correctLastMessage(newMessage);
- lastElement_.findFirst("swift_time");
- lastElement_.setPlainText(ChatSnippet::escape(note));
+void QtChatView::replaceLastMessage(const QString& newMessage, const QString& note) {
+ replaceLastMessage(newMessage);
+ QWebElement replace = lastElement_.findFirst("span.swift_time");
+ assert(!replace.isNull());
+ replace.setInnerXml(ChatSnippet::escape(note));
}
void QtChatView::copySelectionToClipboard() {
@@ -147,8 +152,6 @@ void QtChatView::handleViewLoadFinished(bool ok) {
Q_ASSERT(ok);
viewReady_ = true;
addQueuedSnippets();
-// webPage_->mainFrame()->evaluateJavaScript(queuedMessages_);
-// queuedMessages_.clear();
}
}
diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h
index 01c1ad7..ce1f8bc 100644
--- a/Swift/QtUI/QtChatView.h
+++ b/Swift/QtUI/QtChatView.h
@@ -28,8 +28,8 @@ namespace Swift {
QtChatView(QtChatTheme* theme, QWidget* parent);
void addMessage(boost::shared_ptr<ChatSnippet> snippet);
- void correctLastMessage(const QString& newMessage);
- void correctLastMessage(const QString& newMessage, const QString& note);
+ void replaceLastMessage(const QString& newMessage);
+ void replaceLastMessage(const QString& newMessage, const QString& note);
bool isScrolledToBottom() const;
signals:
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index 53b0dde..70bde4b 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -370,4 +370,8 @@ void QtChatWindow::moveEvent(QMoveEvent*) {
emit geometryChanged();
}
+void QtChatWindow::replaceLastMessage(const String& message) {
+ messageLog_->replaceLastMessage(P2QSTRING(message));
+}
+
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 2b006d9..a51b866 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -49,6 +49,7 @@ namespace Swift {
void setRosterModel(Roster* roster);
void setTabComplete(TabComplete* completer);
int getCount();
+ void replaceLastMessage(const String& message);
signals:
void geometryChanged();