add date to chat msg if it is mroe than 1 day old

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6510 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-07-16 21:14:48 +00:00
parent ed9b6e0784
commit 36ea99da03
2 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
firstShow = true;
inChatCharFormatChanged = false;
completer = NULL;
lastMsgDate = QDate::currentDate();
lastStatusSendTime = 0 ;
@ -512,6 +513,13 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime
unsigned int formatTextFlag = RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_OPTIMIZE;
unsigned int formatFlag = 0;
bool addDate = false;
if (QDate::currentDate()>lastMsgDate)
{
lastMsgDate=QDate::currentDate();
addDate=true;
}
// embed smileys ?
if (Settings->valueFromGroup(QString("Chat"), QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool()) {
formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS;
@ -541,7 +549,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime
type = ChatStyle::FORMATMSG_OOUTGOING;
} else if (chatType == TYPE_SYSTEM) {
type = ChatStyle::FORMATMSG_SYSTEM;
} else if (chatType == TYPE_HISTORY) {
} else if (chatType == TYPE_HISTORY || addDate) {
type = incoming ? ChatStyle::FORMATMSG_HINCOMING : ChatStyle::FORMATMSG_HOUTGOING;
} else {
type = incoming ? ChatStyle::FORMATMSG_INCOMING : ChatStyle::FORMATMSG_OUTGOING;

View File

@ -164,6 +164,7 @@ private:
bool inChatCharFormatChanged;
TransferRequestFlags mDefaultExtraFileFlags ; // flags for extra files shared in this chat. Will be 0 by default, but might be ANONYMOUS for chat lobbies.
QDate lastMsgDate ;
QCompleter *completer;