int start = indexForId(msglist.first().msgId());
int end = start + msglist.count() - 1;
MessageModelItem *dayChangeItem = 0;
-
+ bool relocatedMsg = false;
if(start > 0) {
// check if the preceeding msg is a daychange message and if so if
// we have to drop or relocate it at the end of this chunk
endRemoveRows();
start--;
end--;
+ relocatedMsg = true;
}
}
end++;
Q_ASSERT(start == 0 || _messageList[start - 1]->msgId() < msglist.first().msgId());
+
+ if(start < _messageList.count()) { // && _messageList[start]->msgId() <= msglist.last().msgId()) {
+ qDebug() << *(_messageList[start]) << "<=" << msglist.last();
+ qDebug() << start << end << msglist.count() << dayChangeItem << relocatedMsg;
+ }
Q_ASSERT(start == _messageList.count() || _messageList[start]->msgId() > msglist.last().msgId());
+
+
beginInsertRows(QModelIndex(), start, end);
int pos = start;
foreach(Message msg, msglist) {
bool MessageModelItem::operator>(const MessageModelItem &other) const {
return _msgId > other._msgId;
}
+
+QDebug operator<<(QDebug dbg, const MessageModelItem &msgItem) {
+ dbg.nospace() << qPrintable(QString("MessageModelItem(MsgId:")) << msgItem.msgId()
+ << qPrintable(QString(",")) << msgItem.timeStamp()
+ << qPrintable(QString(", Type:")) << msgItem.msgType()
+ << qPrintable(QString(", Flags:")) << msgItem.msgFlags() << qPrintable(QString(")"))
+ << msgItem.data(1, Qt::DisplayRole).toString() << ":" << msgItem.data(2, Qt::DisplayRole).toString();
+ return dbg;
+}