aboutsummaryrefslogtreecommitdiff
path: root/lib/eventitem.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-12-26 19:36:00 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-01-05 21:01:32 +0900
commitf6740316dfcdb287b019b4258df2213c31965d42 (patch)
treedb9bec725d6f578f4efd591992c6ed7e5942c6a9 /lib/eventitem.h
parent77830a97e524a4bd27d8cbcd3830cbe450a5755a (diff)
downloadlibquotient-f6740316dfcdb287b019b4258df2213c31965d42.tar.gz
libquotient-f6740316dfcdb287b019b4258df2213c31965d42.zip
PendingEventItem: add FileUploaded status and setFileUploaded helper function
Diffstat (limited to 'lib/eventitem.h')
-rw-r--r--lib/eventitem.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/eventitem.h b/lib/eventitem.h
index 5f1d10c9..36ed2132 100644
--- a/lib/eventitem.h
+++ b/lib/eventitem.h
@@ -33,16 +33,17 @@ namespace QMatrixClient
/** Special marks an event can assume
*
* This is used to hint at a special status of some events in UI.
- * Most status values are mutually exclusive.
+ * All values except Redacted and Hidden are mutually exclusive.
*/
enum Code {
Normal = 0x0, //< No special designation
Submitted = 0x01, //< The event has just been submitted for sending
- Departed = 0x02, //< The event has left the client
- ReachedServer = 0x03, //< The server has received the event
- SendingFailed = 0x04, //< The server could not receive the event
+ FileUploaded = 0x02, //< The file attached to the event has been uploaded to the server
+ Departed = 0x03, //< The event has left the client
+ ReachedServer = 0x04, //< The server has received the event
+ SendingFailed = 0x05, //< The server could not receive the event
Redacted = 0x08, //< The event has been redacted
- Hidden = 0x10, //< The event should be hidden
+ Hidden = 0x10, //< The event should not be shown in the timeline
};
Q_DECLARE_FLAGS(Status, Code)
Q_FLAG(Status)
@@ -70,6 +71,9 @@ namespace QMatrixClient
return std::exchange(evt, move(other));
}
+ protected:
+ template <typename EventT>
+ EventT* getAs() { return eventCast<EventT>(evt); }
private:
RoomEventPtr evt;
};
@@ -116,6 +120,7 @@ namespace QMatrixClient
QString annotation() const { return _annotation; }
void setDeparted() { setStatus(EventStatus::Departed); }
+ void setFileUploaded(const QUrl& remoteUrl);
void setReachedServer(const QString& eventId)
{
setStatus(EventStatus::ReachedServer);