Resolved the bug about crash with an empty history chat

This commit is contained in:
Blue 2021-01-12 20:10:24 +03:00
parent 15342f3c53
commit ff4124d1f0
3 changed files with 24 additions and 14 deletions

View File

@ -134,6 +134,8 @@ void Core::RosterItem::nextRequest()
last = true;
}
}
} else if (archiveState == empty && responseCache.size() == 0) {
last = true;
}
emit historyResponse(responseCache, last);
}

View File

@ -137,8 +137,12 @@ QVariant Models::MessageFeed::data(const QModelIndex& index, int role) const
answer = path;
}
}
case Attach:
break;
case Attach: {
::Models::Attach att;
answer.setValue(att);
}
break;
case Bulk: {
FeedItem item;
@ -169,6 +173,7 @@ QVariant Models::MessageFeed::data(const QModelIndex& index, int role) const
}
answer.setValue(item);
}
break;
default:
break;
}

View File

@ -77,24 +77,12 @@ public:
Bulk
};
enum Attachment {
none,
remote,
downloading,
uploading,
ready
};
private:
enum SyncState {
incomplete,
syncing,
complete
};
struct Attach {
Attachment state;
qreal progress;
QString localPath;
};
//tags
struct id {};
@ -135,6 +123,20 @@ private:
static const QHash<int, QByteArray> roles;
};
enum Attachment {
none,
remote,
downloading,
uploading,
ready
};
struct Attach {
Attachment state;
qreal progress;
QString localPath;
};
struct FeedItem {
QString text;
QString sender;
@ -143,10 +145,11 @@ struct FeedItem {
bool correction;
QDateTime date;
Shared::Message::State state;
MessageFeed::Attachment attach;
Attach attach;
};
};
Q_DECLARE_METATYPE(Models::Attach);
Q_DECLARE_METATYPE(Models::FeedItem);
#endif // MESSAGEFEED_H