diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-11-20 17:18:22 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-11-20 17:18:22 (GMT) |
commit | ce4b7dc190c609520850a94d0a38d87002ff9f12 (patch) | |
tree | 31e25560572f53bc68011bcfb07f4972f15d62e8 /Swift/QtUI/ChatSnippet.cpp | |
parent | 71e3018e19db2ffa9d80d92c4c33e084737d40f4 (diff) | |
download | swift-ce4b7dc190c609520850a94d0a38d87002ff9f12.zip swift-ce4b7dc190c609520850a94d0a38d87002ff9f12.tar.bz2 |
Include date for MUC context older than today.
Resolves: #641
Release-Notes: MUC context for days other than today is now annotated.
Diffstat (limited to 'Swift/QtUI/ChatSnippet.cpp')
-rw-r--r-- | Swift/QtUI/ChatSnippet.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp index 2218c07..4d23526 100644 --- a/Swift/QtUI/ChatSnippet.cpp +++ b/Swift/QtUI/ChatSnippet.cpp @@ -26,4 +26,23 @@ QString ChatSnippet::escape(const QString& original) { return result; } +QString ChatSnippet::timeToEscapedString(const QDateTime& time) { + QDate now(QDate::currentDate()); + QString date = ""; + if (time.date().daysTo(now) > 0) { + date = "ddd "; + } + if (time.date().month() != now.month()) { + date = date + "MMMM "; + } + if (time.date().daysTo(now) > 6) { + date = date + "d "; + } + if (time.date().year() != now.year()) { + date = date + "yy "; + } + date += "h:mm"; + return escape(time.toString(date)); +} + }; |