From 1a6909e02a93f5a72b234741403ad25f3da50489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 1 Oct 2019 15:50:26 +0800 Subject: Parsed content --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 494a461..8a5a9bc 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 494a46196ade016b606716b36045f6b08a3234bc +Subproject commit 8a5a9bc8101c13545f6ffe607cf8e6201c706ffc -- cgit v1.2.3 From fbc2420e802b6fc522c8c440b18e74599cd69ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 1 Oct 2019 17:29:29 +0800 Subject: librtclient update --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 8a5a9bc..8184365 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 8a5a9bc8101c13545f6ffe607cf8e6201c706ffc +Subproject commit 81843655facabb59bcd299a827b2c862dba673e0 -- cgit v1.2.3 From 132781266018bcf28e8fdb31a58f1156a6058e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 1 Oct 2019 20:52:30 +0800 Subject: Ticket history free functions --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 8184365..4c08aa1 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 81843655facabb59bcd299a827b2c862dba673e0 +Subproject commit 4c08aa1b1e04ac1b73217e13315da126b631c079 -- cgit v1.2.3 From 0fe9af92f5fdea473e258da3cb079a525e9fbcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 1 Oct 2019 23:18:34 +0800 Subject: Fix ticket history handling --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 4c08aa1..70e3bfd 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 4c08aa1b1e04ac1b73217e13315da126b631c079 +Subproject commit 70e3bfd86acc04ed1a87f63d58bd814bad07ad2d -- cgit v1.2.3 From 156f8f37517c8469442c1aa9b6fef4757516f788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 12:51:44 +0800 Subject: Ticket history function takes format argument --- client.cxx | 3 ++- librtclient | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client.cxx b/client.cxx index b91c10b..d2097aa 100644 --- a/client.cxx +++ b/client.cxx @@ -124,7 +124,8 @@ namespace RTClient { void Client::ticketHistory(int id) { rtclient_ticket_history_list* historyList = nullptr; - rtclient_ticket_history(&historyList, id); + rtclient_ticket_history(&historyList, id + , RTCLIENT_TICKET_RESULT_FORMAT_L); emit gotTicketHistory(historyList); } diff --git a/librtclient b/librtclient index 70e3bfd..f9e3eb4 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 70e3bfd86acc04ed1a87f63d58bd814bad07ad2d +Subproject commit f9e3eb4c9cf83d724d510f20391ab8f88f68fd71 -- cgit v1.2.3 From b3b08cf3beb03b3133a5925fdd6384765dcb6409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 14:15:44 +0800 Subject: No result namespace --- client.cxx | 2 +- librtclient | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client.cxx b/client.cxx index d2097aa..a887c76 100644 --- a/client.cxx +++ b/client.cxx @@ -125,7 +125,7 @@ namespace RTClient { { rtclient_ticket_history_list* historyList = nullptr; rtclient_ticket_history(&historyList, id - , RTCLIENT_TICKET_RESULT_FORMAT_L); + , RTCLIENT_TICKET_FORMAT_L); emit gotTicketHistory(historyList); } diff --git a/librtclient b/librtclient index f9e3eb4..829fd1f 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit f9e3eb4c9cf83d724d510f20391ab8f88f68fd71 +Subproject commit 829fd1f2baf9e92511683982d2a51244301c4837 -- cgit v1.2.3 From 4fe643833ec0207ce0de9044dc327dd81f3bfce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 14:17:17 +0800 Subject: Update --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 829fd1f..9fd7e32 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 829fd1f2baf9e92511683982d2a51244301c4837 +Subproject commit 9fd7e32936b96cdcd5329077662e2fcc546d2bdd -- cgit v1.2.3 From 9d7fc8def01999e5d1ed2d56ebd21d05ec6432a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 14:35:21 +0800 Subject: There are only 2 formats for ticket history return --- client.cxx | 3 +-- librtclient | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client.cxx b/client.cxx index a887c76..2dbf761 100644 --- a/client.cxx +++ b/client.cxx @@ -124,8 +124,7 @@ namespace RTClient { void Client::ticketHistory(int id) { rtclient_ticket_history_list* historyList = nullptr; - rtclient_ticket_history(&historyList, id - , RTCLIENT_TICKET_FORMAT_L); + rtclient_ticket_history(&historyList, id, true); emit gotTicketHistory(historyList); } diff --git a/librtclient b/librtclient index 9fd7e32..8cff9b9 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 9fd7e32936b96cdcd5329077662e2fcc546d2bdd +Subproject commit 8cff9b9d5a49e4c1a9364fd55f4887700ef2a4ae -- cgit v1.2.3 From 15a4a9135b6fae55ad8a849440422412eeac47c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 18:32:13 +0800 Subject: Fix long format ticket history --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 8cff9b9..406cd1b 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 8cff9b9d5a49e4c1a9364fd55f4887700ef2a4ae +Subproject commit 406cd1b125ff87cd70c8287490331c9610b23462 -- cgit v1.2.3 From 003695d6b876aa876b21d8f8264ccefda8c53236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 18:58:15 +0800 Subject: librtclient fix --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index 406cd1b..c4d2791 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit 406cd1b125ff87cd70c8287490331c9610b23462 +Subproject commit c4d27915da7677964c84992c1e34c31ad3a281eb -- cgit v1.2.3 From c0ec7d794a69116e01b51fc46f37b1af01e4066f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 20:27:46 +0800 Subject: librtclient update --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index c4d2791..e91014f 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit c4d27915da7677964c84992c1e34c31ad3a281eb +Subproject commit e91014fbc56b98d69b612f7a939138127ee21e60 -- cgit v1.2.3 From fd5de53d7f95084bacec1a880077de6bddcb3289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 21:30:19 +0800 Subject: librtclient update --- librtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtclient b/librtclient index e91014f..6012511 160000 --- a/librtclient +++ b/librtclient @@ -1 +1 @@ -Subproject commit e91014fbc56b98d69b612f7a939138127ee21e60 +Subproject commit 601251148de5bd8a42649e3b888d7824eb1d7743 -- cgit v1.2.3 From 6e3ee14209963c9a7190cc76925cc736fea83218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 21:30:32 +0800 Subject: Ticket history class --- qrtclient.pro | 2 + qrtclient/tickethistory.hxx | 109 ++++++++++++++++++++++++++++++++++++++++++++ tickethistory.cxx | 88 +++++++++++++++++++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 qrtclient/tickethistory.hxx create mode 100644 tickethistory.cxx diff --git a/qrtclient.pro b/qrtclient.pro index 1e53e4f..c425913 100644 --- a/qrtclient.pro +++ b/qrtclient.pro @@ -5,10 +5,12 @@ CONFIG += staticlib HEADERS += \ qrtclient/user.hxx \ qrtclient/ticket.hxx \ + qrtclient/tickethistory.hxx \ qrtclient/client.hxx SOURCES += \ user.cxx \ ticket.cxx \ + tickethistory.cxx \ client.cxx INCLUDEPATH += $$PWD/librtclient diff --git a/qrtclient/tickethistory.hxx b/qrtclient/tickethistory.hxx new file mode 100644 index 0000000..7d68652 --- /dev/null +++ b/qrtclient/tickethistory.hxx @@ -0,0 +1,109 @@ +#ifndef QRTCLIENT_TICKET_HISTORY_HXX +#define QRTCLIENT_TICKET_HISTORY_HXX + +#include +#include +#include + +struct rtclient_ticket_history_list; + +namespace RTClient { + + class TicketHistory + { + public: + TicketHistory(struct rtclient_ticket_history* history) + : m_id{history->id} + , m_ticket{history->ticket} + , m_timeTaken{history->time_taken} + , m_type{history->type} + , m_description{history->description} + , m_content{history->content} + , m_creator{history->creator} + { + if (history->field) + m_field = QString{history->field}; + if (history->old_value) + m_oldValue = QString{history->old_value}; + if (history->new_value) + m_newValue = QString{history->new_value}; + if (history->data) + m_data = QString{history->data}; + } + unsigned int id() const { return m_id; } + unsigned int ticket() const { return m_ticket; } + unsigned int timeTaken() const { return m_timeTaken; } +// Q_ENUM(rtclient_ticket_history_type) + rtclient_ticket_history_type type() const { return m_type; } + QString const& field() const { return m_field; } + QString const& oldValue() const { return m_oldValue; } + QString const& newValue() const { return m_newValue; } + QString const& data() const { return m_data; } + QString const& description() const { return m_description; } + QString const& content() const { return m_content; } + QString const& creator() const { return m_creator; } + QDateTime const& created() const { return m_created; } + + private: + unsigned int m_id; + unsigned int m_ticket; + unsigned int m_timeTaken; + rtclient_ticket_history_type m_type; + QString m_field; + QString m_oldValue; + QString m_newValue; + QString m_data; + QString m_description; + QString m_content; + QString m_creator; + QDateTime m_created; +// QList* m_attachments; + }; + + class TicketHistoryList : public QAbstractListModel + { + Q_OBJECT + + public: + enum TicketHistoryRoles { + IdRole = Qt::UserRole + 1, + TicketRole, + TimeTakenRole, + TypeRole, + FieldRole, + OldValueRole, + NewValueRole, + DataRole, + DescriptionRole, + ContentRole, + CreatorRole, + CreatedRole/*, + AttachmentsRole*/ + }; + + explicit TicketHistoryList(QObject* parent = nullptr) + : QAbstractListModel{parent} {} + + int rowCount(QModelIndex const& parent + = QModelIndex()) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex& index + , int role = Qt::DisplayRole + ) const Q_DECL_OVERRIDE; + + public slots: + void update(rtclient_ticket_history_list* list); + + protected: + QHash roleNames() const Q_DECL_OVERRIDE; + + signals: + void updated(); + + private: + QList histories; + void addTicketHistory(TicketHistory const& history); + }; + +} + +#endif // QRTCLIENT_TICKET_HISTORY_HXX diff --git a/tickethistory.cxx b/tickethistory.cxx new file mode 100644 index 0000000..d1af392 --- /dev/null +++ b/tickethistory.cxx @@ -0,0 +1,88 @@ +#include +#include "qrtclient/tickethistory.hxx" + +namespace RTClient { + + int TicketHistoryList::rowCount(QModelIndex const& parent) const + { + Q_UNUSED(parent) + return histories.count(); + } + + QVariant TicketHistoryList::data(QModelIndex const& index, int role) const + { + auto row = index.row(); + + if (row < 0 || row >= histories.count()) return QVariant(); + + auto history = histories[row]; + switch (role) { + case IdRole: + return history.id(); + case TicketRole: + return history.ticket(); + case TimeTakenRole: + return history.timeTaken(); + case TypeRole: + return history.type(); + case FieldRole: + return history.field(); + case OldValueRole: + return history.oldValue(); + case NewValueRole: + return history.newValue(); + case DataRole: + return history.data(); + case DescriptionRole: + return history.description(); + case ContentRole: + return history.content(); + case CreatorRole: + return history.creator(); + case CreatedRole: + return history.created(); + /* + case AttachmentsRole: + return history.attachments(); + */ + default: + return QVariant(); + } + } + + QHash TicketHistoryList::roleNames() const + { + return QHash{ + {IdRole, "id"} + , {TicketRole, "ticket"} + , {TimeTakenRole, "timeTaken"} + , {TypeRole, "type"} + , {FieldRole, "field"} + , {OldValueRole, "oldValue"} + , {NewValueRole, "newValue"} + , {DataRole, "data"} + , {DescriptionRole, "description"} + , {ContentRole, "content"} + , {CreatorRole, "creator"} + , {CreatedRole, "created"} +// , {AttachmentsRole, "attachments"} + }; + } + + 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]}); + emit updated(); + } + +} -- cgit v1.2.3 From b628ffd96ce55f2fab838b4c9626dde873370ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 22:30:46 +0800 Subject: Free the ticket history list after updated still not so good design --- tickethistory.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tickethistory.cxx b/tickethistory.cxx index d1af392..4243d7c 100644 --- a/tickethistory.cxx +++ b/tickethistory.cxx @@ -78,10 +78,12 @@ namespace RTClient { void TicketHistoryList::update(rtclient_ticket_history_list* list) { - if (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(); } -- cgit v1.2.3 From 5567338ace1f591c6a0e7a54da0cf15667e3b462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Oct 2019 22:47:49 +0800 Subject: Ticket history long format can be set --- client.cxx | 4 ++-- qrtclient/client.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client.cxx b/client.cxx index 2dbf761..6711461 100644 --- a/client.cxx +++ b/client.cxx @@ -121,10 +121,10 @@ namespace RTClient { emit searchedTicket(ticketList); } - void Client::ticketHistory(int id) + void Client::ticketHistory(int id, bool longFormat) { rtclient_ticket_history_list* historyList = nullptr; - rtclient_ticket_history(&historyList, id, true); + rtclient_ticket_history(&historyList, id, longFormat); emit gotTicketHistory(historyList); } diff --git a/qrtclient/client.hxx b/qrtclient/client.hxx index b672620..e9e6b0f 100644 --- a/qrtclient/client.hxx +++ b/qrtclient/client.hxx @@ -63,7 +63,7 @@ namespace RTClient { , QString const& due = nullptr , QString const& text = nullptr); void searchTicket(QString const& owner); - void ticketHistory(int id); + void ticketHistory(int id, bool longFormat = false); signals: void loggedIn(QString const& name); -- cgit v1.2.3