diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-02-02 11:51:44 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-02-02 11:51:44 +0800 |
commit | 8107effd171ffb5285e4e6d79ff9a2b7e4669c79 (patch) | |
tree | 72248cb1266c355a6ed3f0b05615a7a93e6c41d7 /tickethistory.cxx | |
parent | c6708f0223f284aaa15768861a8b018d9e0acdae (diff) |
Conform to updated librtclient
commit 12cde42c929b63a1ef1b2ad7f3482336419980b2
Diffstat (limited to 'tickethistory.cxx')
-rw-r--r-- | tickethistory.cxx | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/tickethistory.cxx b/tickethistory.cxx index d163882..ae0e2d7 100644 --- a/tickethistory.cxx +++ b/tickethistory.cxx @@ -3,6 +3,18 @@ namespace RTClient { +TicketHistoryList::TicketHistoryList(struct rtclient_ticket_history** list, + QObject* parent) + : QAbstractListModel{parent} +{ + size_t i = 0; + while (list[i]) { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + histories << TicketHistory{list[i++]}; + endInsertRows(); + } +} + int TicketHistoryList::rowCount(QModelIndex const& parent) const { Q_UNUSED(parent) @@ -66,22 +78,4 @@ QHash<int, QByteArray> TicketHistoryList::roleNames() const }; } - void TicketHistoryList::addTicketHistory(TicketHistory const& history) - { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - histories << history; - endInsertRows(); - } - - void TicketHistoryList::update(rtclient_ticket_history_list* list) - { - if (list) { - for (size_t i = 0; i < list->length; i++) - addTicketHistory - (TicketHistory{list->histories[i]}); - rtclient_ticket_history_list_free(list); - emit updated(); - } - } - } |