diff options
| author | Kevin Smith <git@kismith.co.uk> | 2012-06-14 21:28:58 (GMT) |
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2012-06-15 07:44:48 (GMT) |
| commit | 5a1bdf2f6a4842176be5938f8db5cb9d151aceb5 (patch) | |
| tree | 338090bf71a0a5836ac1210e8433694479567d50 /Swift/QtUI/QtChatView.cpp | |
| parent | b4a24233debf8ee7e5005aa787ff48c52abe7df6 (diff) | |
| download | swift-contrib-5a1bdf2f6a4842176be5938f8db5cb9d151aceb5.zip swift-contrib-5a1bdf2f6a4842176be5938f8db5cb9d151aceb5.tar.bz2 | |
Preliminary emoticon work.
Parsing and toggling support for emoticons. No emoticons are included so this won't do anything yet.
Diffstat (limited to 'Swift/QtUI/QtChatView.cpp')
| -rw-r--r-- | Swift/QtUI/QtChatView.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 54bce09..a55161f 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -177,18 +177,33 @@ void QtChatView::replaceMessage(const QString& newMessage, const QString& id, co assert(!replaceTime.isNull()); old = replaceTime.toOuterXml(); replaceTime.setInnerXml(ChatSnippet::escape(tr("%1 edited").arg(ChatSnippet::timeToEscapedString(editTime)))); } else { qWarning() << "Trying to replace element with id " << id << " but it's not there."; } } +void QtChatView::showEmoticons(bool show) { + { + const QWebElementCollection spans = document_.findAll("span.swift_emoticon_image"); + foreach (QWebElement span, spans) { + span.setStyleProperty("display", show ? "inline" : "none"); + } + } + { + const QWebElementCollection spans = document_.findAll("span.swift_emoticon_text"); + foreach (QWebElement span, spans) { + span.setStyleProperty("display", show ? "none" : "inline"); + } + } +} + void QtChatView::copySelectionToClipboard() { if (!webPage_->selectedText().isEmpty()) { webPage_->triggerAction(QWebPage::Copy); } } void QtChatView::setAckXML(const QString& id, const QString& xml) { QWebElement message = document_.findFirst("#" + id); /* Deliberately not asserting here, so that when we start expiring old messages it won't hit us */ |
Swift