summaryrefslogtreecommitdiff
path: root/controller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'controller.cxx')
-rw-r--r--controller.cxx31
1 files changed, 26 insertions, 5 deletions
diff --git a/controller.cxx b/controller.cxx
index a229495..5a1d786 100644
--- a/controller.cxx
+++ b/controller.cxx
@@ -59,17 +59,38 @@ Controller::Controller(QObject* parent) : QObject{parent}
connect(this, static_cast<void (Controller::*)(QString const&)>
(&Controller::checked)
- , client, &Client::ticketSearch);
+ , client, &Client::searchTicket);
- connect(client, &Client::ticketSearched, ticketList, &TicketList::update);
+ 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)));