summaryrefslogtreecommitdiff
path: root/controller.cxx
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-30 19:17:59 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-30 19:17:59 +0800
commit53da54bab9b2d5c80ea8267a9542a89d38511b2d (patch)
tree420b75ab8f05826aed0eb57c11149b81b5a2c4d0 /controller.cxx
parentff41408163358dac8d2a1f60e8c42aeaef0d3a6e (diff)
Attempt to show real ticket history data
Not working yet
Diffstat (limited to 'controller.cxx')
-rw-r--r--controller.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/controller.cxx b/controller.cxx
index b27896c..5a1d786 100644
--- a/controller.cxx
+++ b/controller.cxx
@@ -63,13 +63,34 @@ Controller::Controller(QObject* parent) : QObject{parent}
connect(client, &Client::searchedTicket, ticketList, &TicketList::update);
- connect(client, &Client::loggedIn, [appWindow,this]() {
+ auto ticketHistory = [appWindow,this,&client]() {
+ auto homeView = appWindow->findChild<QObject*>("home");
+ connect(client, &Client::gotTicketHistory, [homeView]
+ (rtclient_ticket_history_list* list) {
+ auto history = list->histories[list->length - 1];
+ QMetaObject::invokeMethod(homeView
+ , "ticketHistory"
+ , Q_ARG(QString
+ , QString{history
+ ->description})
+ , Q_ARG(QString
+ , QString{history
+ ->content})
+ , Q_ARG(QString
+ , QString{history
+ ->creator}));
+ });
+ };
+
+ connect(client, &Client::loggedIn, [appWindow,this,ticketHistory]() {
auto loginView = appWindow->findChild<QObject*>("login");
- connect(ticketList, &TicketList::updated, [loginView]() {
+ connect(ticketList, &TicketList::updated
+ , [loginView,this,ticketHistory]() {
QMetaObject::invokeMethod(loginView
, "pushHome");
+ ticketHistory();
});
- });
+ });
connect(appWindow, SIGNAL(ticketHistory(int))
, client, SLOT(ticketHistory(int)));