diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/ChatSnippet.h | 8 | ||||
-rw-r--r-- | Swift/QtUI/MessageSnippet.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTheme.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTheme.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindowFactory.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtWebKitChatView.cpp | 171 | ||||
-rw-r--r-- | Swift/QtUI/QtWebKitChatView.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 14 | ||||
-rw-r--r-- | Swift/QtUI/Swift.qrc | 2 | ||||
-rw-r--r-- | Swift/QtUI/SystemMessageSnippet.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/SystemMessageSnippet.h | 2 |
12 files changed, 83 insertions, 154 deletions
diff --git a/Swift/QtUI/ChatSnippet.h b/Swift/QtUI/ChatSnippet.h index 5d94917..7c99928 100644 --- a/Swift/QtUI/ChatSnippet.h +++ b/Swift/QtUI/ChatSnippet.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,13 +8,14 @@ #include <boost/shared_ptr.hpp> -#include <QString> #include <QDateTime> +#include <QString> #include <Swiften/Base/foreach.h> + #include <Swift/Controllers/UIInterfaces/ChatWindow.h> -#include <Swift/QtUI/QtChatTheme.h> +#include <Swift/QtUI/QtChatTheme.h> namespace Swift { class ChatSnippet { @@ -44,6 +45,7 @@ namespace Swift { result.replace("%time%", "%%time%"); result.replace("%shortTime%", "%%shortTime%"); result.replace("%userIconPath%", "%userIconPath%"); + result.replace("%id%", "%id%"); result.replace("\t", " "); result.replace(" ", " "); return result; diff --git a/Swift/QtUI/MessageSnippet.cpp b/Swift/QtUI/MessageSnippet.cpp index f76212e..c2969cf 100644 --- a/Swift/QtUI/MessageSnippet.cpp +++ b/Swift/QtUI/MessageSnippet.cpp @@ -1,12 +1,11 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include "MessageSnippet.h" +#include <Swift/QtUI/MessageSnippet.h> -#include <QtDebug> #include <QDateTime> namespace Swift { @@ -33,13 +32,12 @@ MessageSnippet::MessageSnippet(const QString& message, const QString& sender, co } content_.replace("%direction%", directionToCSS(direction)); - content_.replace("%message%", wrapResizable("<span class='swift_message'>" + escape(message) + "</span><span class='swift_ack'></span><span class='swift_receipt'></span>")); + content_.replace("%message%", wrapResizable("<span class='swift_message'>" + escape(message) + "</span>")); content_.replace("%wrapped_sender%", wrapResizable(escape(sender))); content_.replace("%sender%", escape(sender)); content_.replace("%time%", wrapResizable("<span class='swift_time'>" + timeToEscapedString(time) + "</span>")); content_.replace("%userIconPath%", escape(iconURI)); - content_ = QString("<div id='%1'>%2</div>").arg(id).arg(content_); - content_ = "<span class='date" + time.date().toString(Qt::ISODate) + "'>" + content_ + "</span>"; + content_.replace("%id%", id); } MessageSnippet::~MessageSnippet() { diff --git a/Swift/QtUI/QtChatTheme.cpp b/Swift/QtUI/QtChatTheme.cpp index 5a9bc44..a7628d9 100644 --- a/Swift/QtUI/QtChatTheme.cpp +++ b/Swift/QtUI/QtChatTheme.cpp @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Isode Limited.. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include "QtChatTheme.h" +#include <Swift/QtUI/QtChatTheme.h> #include <QFile> -#include <qdebug.h> namespace Swift { /** * Load Adium themes, as http://trac.adium.im/wiki/CreatingMessageStyles */ -QtChatTheme::QtChatTheme(const QString& themePath) : qrc_(themePath.isEmpty()), themePath_(qrc_ ? ":/themes/Default/" : themePath + "/Contents/Resources/") { +QtChatTheme::QtChatTheme(const QString& themePath) : qrc_(themePath[0] == ':'), themePath_(qrc_ ? themePath : themePath + "/Contents/Resources/") { QString fileNames[EndMarker]; fileNames[Header] = "Header.html"; fileNames[Footer] = "Footer.html"; @@ -32,6 +31,7 @@ QtChatTheme::QtChatTheme(const QString& themePath) : qrc_(themePath.isEmpty()), fileNames[OutgoingNextContext] = "Outgoing/NextContext.html"; fileNames[Template] = "Template.html"; fileNames[MainCSS] = "main.css"; + fileNames[Unread] = "Unread.html"; fileNames[TemplateDefault] = ":/themes/Template.html"; for (int i = 0; i < EndMarker; i++) { QString source; @@ -64,4 +64,8 @@ QString QtChatTheme::getBase() const { return qrc_ ? "qrc" + themePath_ : "file://" + themePath_; } +QString QtChatTheme::getUnread() const { + return fileContents_[Unread].isEmpty() ? "<hr/>" : fileContents_[Unread]; +} + } diff --git a/Swift/QtUI/QtChatTheme.h b/Swift/QtUI/QtChatTheme.h index bc5b0be..69e052c 100644 --- a/Swift/QtUI/QtChatTheme.h +++ b/Swift/QtUI/QtChatTheme.h @@ -30,9 +30,10 @@ namespace Swift { QString getTemplate() const {return fileContents_[Template];} QString getMainCSS() const {return fileContents_[MainCSS];} QString getBase() const; + QString getUnread() const; private: - enum files {Header = 0, Footer, Content, Status, Topic, FileTransferRequest, IncomingContent, IncomingNextContent, IncomingContext, IncomingNextContext, OutgoingContent, OutgoingNextContent, OutgoingContext, OutgoingNextContext, Template, MainCSS, TemplateDefault, EndMarker}; + enum files {Header = 0, Footer, Content, Status, Topic, FileTransferRequest, IncomingContent, IncomingNextContent, IncomingContext, IncomingNextContext, OutgoingContent, OutgoingNextContent, OutgoingContext, OutgoingNextContext, Template, MainCSS, TemplateDefault, Unread, /*Must be last!*/EndMarker}; bool qrc_; QList<QString> fileContents_; QString themePath_; diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index b9ba89d..d0c1801 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -49,7 +49,7 @@ ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact,UIEventStre theme_ = new QtChatTheme(themePath_); if (theme_->getIncomingContent().isEmpty()) { delete theme_; - theme_ = new QtChatTheme(""); /* Use the inbuilt theme */ + theme_ = new QtChatTheme(":/themes/Default/"); /* Use the inbuilt theme */ } } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 756f530..6444e0c 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -80,7 +80,7 @@ namespace Swift{ #if defined(SWIFTEN_PLATFORM_MACOSX) //#define SWIFT_APPCAST_URL "http://swift.im/appcast/swift-mac-dev.xml" -#else +#else //#define SWIFT_APPCAST_URL "" #endif @@ -184,7 +184,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); storagesFactory_ = new FileStoragesFactory(applicationPathProvider_->getDataDir(), networkFactories_.getCryptoProvider()); certificateStorageFactory_ = new CertificateFileStorageFactory(applicationPathProvider_->getDataDir(), tlsFactories_.getCertificateFactory(), networkFactories_.getCryptoProvider()); - chatWindowFactory_ = new QtChatWindowFactory(splitter_, settingsHierachy_, qtSettings_, tabs_, "", emoticons); + chatWindowFactory_ = new QtChatWindowFactory(splitter_, settingsHierachy_, qtSettings_, tabs_, ":/themes/Default/", emoticons); soundPlayer_ = new QtSoundPlayer(applicationPathProvider_); // Ugly, because the dock depends on the tray, but the temporary diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index b543e34..2a8fed6 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -127,107 +127,47 @@ void QtWebKitChatView::addMessageBottom(boost::shared_ptr<ChatSnippet> snippet) } } -void QtWebKitChatView::addMessageTop(boost::shared_ptr<ChatSnippet> snippet) { - // save scrollbar maximum value - if (!topMessageAdded_) { - scrollBarMaximum_ = webPage_->mainFrame()->scrollBarMaximum(Qt::Vertical); - } - topMessageAdded_ = true; - - QWebElement continuationElement = firstElement_.findFirst("#insert"); - - bool insert = snippet->getAppendToPrevious(); - bool fallback = continuationElement.isNull(); - - boost::shared_ptr<ChatSnippet> newSnippet = (insert && fallback) ? snippet->getContinuationFallbackSnippet() : snippet; - QWebElement newElement = snippetToDOM(newSnippet); - - if (insert && !fallback) { - Q_ASSERT(!continuationElement.isNull()); - continuationElement.replace(newElement); - } else { - continuationElement.removeFromDocument(); - topInsertPoint_.prependOutside(newElement); - } - - firstElement_ = newElement; - - if (lastElement_.isNull()) { - lastElement_ = firstElement_; - } - - if (fontSizeSteps_ != 0) { - double size = 1.0 + 0.2 * fontSizeSteps_; - QString sizeString(QString().setNum(size, 'g', 3) + "em"); - const QWebElementCollection spans = firstElement_.findAll("span.swift_resizable"); - Q_FOREACH (QWebElement span, spans) { - span.setStyleProperty("font-size", sizeString); - } - } -} - -QWebElement QtWebKitChatView::snippetToDOM(boost::shared_ptr<ChatSnippet> snippet) { - QWebElement newElement = newInsertPoint_.clone(); - newElement.setInnerXml(snippet->getContent()); - Q_ASSERT(!newElement.isNull()); - return newElement; +void QtWebKitChatView::addMessageTop(boost::shared_ptr<ChatSnippet> /* snippet */) { + // TODO: Implement this in a sensible manner later. + assert(false); } void QtWebKitChatView::addToDOM(boost::shared_ptr<ChatSnippet> snippet) { //qDebug() << snippet->getContent(); rememberScrolledToBottom(); - bool insert = snippet->getAppendToPrevious(); - QWebElement continuationElement = lastElement_.findFirst("#insert"); - bool fallback = insert && continuationElement.isNull(); - boost::shared_ptr<ChatSnippet> newSnippet = (insert && fallback) ? snippet->getContinuationFallbackSnippet() : snippet; - QWebElement newElement = snippetToDOM(newSnippet); - if (insert && !fallback) { - Q_ASSERT(!continuationElement.isNull()); - continuationElement.replace(newElement); - } else { - continuationElement.removeFromDocument(); - newInsertPoint_.prependOutside(newElement); - } - lastElement_ = newElement; - if (fontSizeSteps_ != 0) { - double size = 1.0 + 0.2 * fontSizeSteps_; - QString sizeString(QString().setNum(size, 'g', 3) + "em"); - const QWebElementCollection spans = lastElement_.findAll("span.swift_resizable"); - Q_FOREACH (QWebElement span, spans) { - span.setStyleProperty("font-size", sizeString); - } - } + + QWebElement insertElement = webPage_->mainFrame()->findFirstElement("#insert"); + assert(!insertElement.isNull()); + insertElement.prependOutside(snippet->getContent()); + //qDebug() << "-----------------"; //qDebug() << webPage_->mainFrame()->toHtml(); } void QtWebKitChatView::addLastSeenLine() { - /* if the line is added we should break the snippet */ - insertingLastLine_ = true; - if (lineSeparator_.isNull()) { - lineSeparator_ = newInsertPoint_.clone(); - lineSeparator_.setInnerXml(QString("<hr/>")); - newInsertPoint_.prependOutside(lineSeparator_); - } - else { - QWebElement lineSeparatorC = lineSeparator_.clone(); - lineSeparatorC.removeFromDocument(); + // Remove a potentially existing unread bar. + QWebElement existingUnreadBar = webPage_->mainFrame()->findFirstElement("div.unread"); + if (!existingUnreadBar.isNull()) { + existingUnreadBar.removeFromDocument(); } - newInsertPoint_.prependOutside(lineSeparator_); + + QWebElement insertElement = webPage_->mainFrame()->findFirstElement("#insert"); + insertElement.prependOutside(theme_->getUnread()); } void QtWebKitChatView::replaceLastMessage(const QString& newMessage, const ChatWindow::TimestampBehaviour timestampBehaviour) { - assert(viewReady_); rememberScrolledToBottom(); - assert(!lastElement_.isNull()); - QWebElement replace = lastElement_.findFirst("span.swift_message"); - assert(!replace.isNull()); - QString old = lastElement_.toOuterXml(); - replace.setInnerXml(ChatSnippet::escape(newMessage)); + QWebElement insertElement = webPage_->mainFrame()->findFirstElement("#insert"); + assert(!insertElement.isNull()); + + QWebElement lastMessageElement = insertElement.previousSibling(); + QWebElement messageChild = lastMessageElement.findFirst("span.swift_message"); + assert(!messageChild.isNull()); + messageChild.setInnerXml(ChatSnippet::escape(newMessage)); if (timestampBehaviour == ChatWindow::UpdateTimestamp) { - replace = lastElement_.findFirst("span.swift_time"); - assert(!replace.isNull()); - replace.setInnerXml(ChatSnippet::timeToEscapedString(QDateTime::currentDateTime())); + QWebElement timeChild = lastMessageElement.findFirst("span.swift_time"); + assert(!timeChild.isNull()); + timeChild.setInnerXml(ChatSnippet::timeToEscapedString(QDateTime::currentDateTime())); } } @@ -362,11 +302,11 @@ void QtWebKitChatView::resizeFont(int fontSizeSteps) { fontSizeSteps_ = fontSizeSteps; double size = 1.0 + 0.2 * fontSizeSteps_; QString sizeString(QString().setNum(size, 'g', 3) + "em"); - //qDebug() << "Setting to " << sizeString; - const QWebElementCollection spans = document_.findAll("span.swift_resizable"); - Q_FOREACH (QWebElement span, spans) { - span.setStyleProperty("font-size", sizeString); - } + + // Set the font size in the <style id="text-resize-style"> element in the theme <head> element. + QWebElement resizableTextStyle = document_.findFirst("style#text-resize-style"); + assert(!resizableTextStyle.isNull()); + resizableTextStyle.setInnerXml(QString("span.swift_resizable { font-size: %1;}").arg(sizeString)); webView_->setFontSizeIsMinimal(size == 1.0); } @@ -396,13 +336,6 @@ void QtWebKitChatView::resetView() { } document_ = webPage_->mainFrame()->documentElement(); - resetTopInsertPoint(); - QWebElement chatElement = document_.findFirst("#Chat"); - newInsertPoint_ = chatElement.clone(); - newInsertPoint_.setOuterXml("<div id='swift_insert'/>"); - chatElement.appendInside(newInsertPoint_); - Q_ASSERT(!newInsertPoint_.isNull()); - scrollToBottom(); connect(webPage_->mainFrame(), SIGNAL(contentsSizeChanged(const QSize&)), this, SLOT(handleFrameSizeChanged()), Qt::UniqueConnection); @@ -534,25 +467,17 @@ int QtWebKitChatView::getSnippetPositionByDate(const QDate& date) { } void QtWebKitChatView::resetTopInsertPoint() { - QWebElement continuationElement = firstElement_.findFirst("#insert"); - continuationElement.removeFromDocument(); - firstElement_ = QWebElement(); - - topInsertPoint_.removeFromDocument(); - QWebElement chatElement = document_.findFirst("#Chat"); - topInsertPoint_ = chatElement.clone(); - topInsertPoint_.setOuterXml("<div id='swift_insert'/>"); - chatElement.prependInside(topInsertPoint_); + // TODO: Implement or refactor later. + assert(false); } - std::string QtWebKitChatView::addMessage( - const ChatWindow::ChatMessage& message, - const std::string& senderName, - bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, - const std::string& avatarPath, - const boost::posix_time::ptime& time, + const ChatWindow::ChatMessage& message, + const std::string& senderName, + bool senderIsSelf, + boost::shared_ptr<SecurityLabel> label, + const std::string& avatarPath, + const boost::posix_time::ptime& time, const HighlightAction& highlight) { return addMessage(chatMessageToHTML(message), senderName, senderIsSelf, label, avatarPath, "", time, highlight, ChatSnippet::getDirection(message)); } @@ -609,13 +534,13 @@ QString QtWebKitChatView::chatMessageToHTML(const ChatWindow::ChatMessage& messa } std::string QtWebKitChatView::addMessage( - const QString& message, - const std::string& senderName, - bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, - const std::string& avatarPath, - const QString& style, - const boost::posix_time::ptime& time, + const QString& message, + const std::string& senderName, + bool senderIsSelf, + boost::shared_ptr<SecurityLabel> label, + const std::string& avatarPath, + const QString& style, + const boost::posix_time::ptime& time, const HighlightAction& highlight, ChatSnippet::Direction direction) { @@ -669,7 +594,7 @@ QString QtWebKitChatView::buildChatWindowButton(const QString& name, const QStri std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) { SWIFT_LOG(debug) << "addFileTransfer" << std::endl; QString ft_id = QString("ft%1").arg(P2QSTRING(boost::lexical_cast<std::string>(idCounter_++))); - + QString actionText; QString htmlString; QString formattedFileSize = P2QSTRING(formatSize(sizeInBytes)); @@ -1015,13 +940,13 @@ void QtWebKitChatView::setMessageReceiptState(const std::string& id, ChatWindow: QString xml; switch (state) { case ChatWindow::ReceiptReceived: - xml = "<img src='qrc:/icons/check.png' title='" + tr("The receipt for this message has been received.") + "'/>"; + xml = "<img src='qrc:/icons/delivery-successful.png' title='" + tr("The receipt for this message has been received.") + "'/>"; break; case ChatWindow::ReceiptRequested: xml = "<img src='qrc:/icons/warn.png' title='" + tr("The receipt for this message has not yet been received. The recipient(s) might not have received this message.") + "'/>"; break; case ChatWindow::ReceiptFailed: - xml = "<img src='qrc:/icons/error.png' title='" + tr("Failed to transmit message to the receipient(s).") + "'/>"; + xml = "<img src='qrc:/icons/delivery-failure.png' title='" + tr("Failed to transmit message to the receipient(s).") + "'/>"; } setReceiptXML(P2QSTRING(id), xml); } diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h index 173a05b..b4141d4 100644 --- a/Swift/QtUI/QtWebKitChatView.h +++ b/Swift/QtUI/QtWebKitChatView.h @@ -163,7 +163,6 @@ namespace Swift { void headerEncode(); void messageEncode(); void addToDOM(boost::shared_ptr<ChatSnippet> snippet); - QWebElement snippetToDOM(boost::shared_ptr<ChatSnippet> snippet); QtChatWindow* window_; UIEventStream* eventStream_; @@ -175,8 +174,6 @@ namespace Swift { QWebPage* webPage_; int fontSizeSteps_; QtChatTheme* theme_; - QWebElement newInsertPoint_; - QWebElement topInsertPoint_; QWebElement lineSeparator_; QWebElement lastElement_; QWebElement firstElement_; diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 3ff11a8..c3a1760 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -1,15 +1,15 @@ import os, datetime, re, time import Version -def generateDefaultTheme(dir) : +def generateQRCTheme(dir, prefix) : sourceDir = dir.abspath result = "<!-- WARNING: This file is automatically generated. Any changes will be overwritten. -->\n" result += "<RCC version =\"1.0\">" - result += "<qresource prefix=\"/themes/Default\">" + result += "<qresource prefix=\"/themes/" + prefix + "\">" for (path, dirs, files) in os.walk(sourceDir) : for file in files : filePath = os.path.join(path,file) - result += "<file alias=\"%(alias)s\">%(path)s</file>" % { + result += "<file alias=\"%(alias)s\">%(path)s</file>" % { "alias": filePath[len(sourceDir)+1:], "path": filePath } @@ -84,7 +84,7 @@ if env["PLATFORM"] == "win32" : if env["debug"] and not env["optimize"]: myenv.Append(LINKFLAGS = ["/NODEFAULTLIB:msvcrt"]) -myenv.WriteVal("DefaultTheme.qrc", myenv.Value(generateDefaultTheme(myenv.Dir("#/Swift/resources/themes/Default")))) +myenv.WriteVal("DefaultTheme.qrc", myenv.Value(generateQRCTheme(myenv.Dir("#/Swift/resources/themes/Default"), "Default"))) sources = [ "main.cpp", @@ -357,7 +357,7 @@ if env["PLATFORM"] == "win32" : nsis_translation_uninstall_script += "delete $INSTDIR\\translations\\swift_" + lang + ".qm\n" myenv.WriteVal("../Packaging/nsis/translations-install.nsh", myenv.Value(nsis_translation_install_script)) myenv.WriteVal("../Packaging/nsis/translations-uninstall.nsh", myenv.Value(nsis_translation_uninstall_script)) - + ################################################################################ @@ -412,11 +412,11 @@ if env["PLATFORM"] == "win32" : resources = commonResources, qtplugins = qtplugins, qtlibs = qtlibs, - qtversion = qt_version) + qtversion = qt_version) if env["DIST"] : #myenv.Append(NSIS_OPTIONS = [ - # "/DmsvccRedistributableDir=\"" + env["vcredist"] + "\"", + # "/DmsvccRedistributableDir=\"" + env["vcredist"] + "\"", # "/DbuildVersion=" + myenv["SWIFT_VERSION"] # ]) #myenv.Nsis("../Packaging/nsis/swift.nsi") diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc index 0478d76..829f6c8 100644 --- a/Swift/QtUI/Swift.qrc +++ b/Swift/QtUI/Swift.qrc @@ -43,5 +43,7 @@ <file alias="icons/star-unchecked.png">../resources/icons/star-unchecked2.png</file> <file alias="icons/zzz.png">../resources/icons/zzz.png</file> <file alias="icons/stop.png">../resources/icons/stop.png</file> + <file alias="icons/delivery-successful.png">../resources/icons/delivery-successful.png</file> + <file alias="icons/delivery-failure.png">../resources/icons/delivery-failure.png</file> </qresource> </RCC> diff --git a/Swift/QtUI/SystemMessageSnippet.cpp b/Swift/QtUI/SystemMessageSnippet.cpp index e752e32..87c17b1 100644 --- a/Swift/QtUI/SystemMessageSnippet.cpp +++ b/Swift/QtUI/SystemMessageSnippet.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include "SystemMessageSnippet.h" +#include <Swift/QtUI/SystemMessageSnippet.h> #include <QDateTime> @@ -20,7 +20,7 @@ SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTi content_.replace("%message%", wrapResizable("<span class='swift_message'>" + escape(message) + "</span>")); content_.replace("%shortTime%", wrapResizable(escape(time.toString("h:mm")))); content_.replace("%time%", wrapResizable("<span class='swift_time'>" + timeToEscapedString(time) + "</span>")); - content_ = QString("<div id='%1'>%2</div>").arg(id).arg(content_); + content_.replace("%id%", id); } SystemMessageSnippet::~SystemMessageSnippet() { diff --git a/Swift/QtUI/SystemMessageSnippet.h b/Swift/QtUI/SystemMessageSnippet.h index 8cd68c2..a1f2682 100644 --- a/Swift/QtUI/SystemMessageSnippet.h +++ b/Swift/QtUI/SystemMessageSnippet.h @@ -8,7 +8,7 @@ #include <QString> -#include "ChatSnippet.h" +#include <Swift/QtUI/ChatSnippet.h> class QDateTime; |