1
0
forked from blue/squawk

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; last = true;
} }
} }
} else if (archiveState == empty && responseCache.size() == 0) {
last = true;
} }
emit historyResponse(responseCache, last); emit historyResponse(responseCache, last);
} }

View File

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

View File

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