diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-02 22:25:16 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-10-02 22:25:16 +0800 |
commit | 760893427955122a011f6b70aad9c0f79359637c (patch) | |
tree | a1732d3a83c36ea570331ccbf95782fec6d0c7ff /controller.cxx | |
parent | 95fe18a60e62d9761f522ccb659c1d1fe4ea30f9 (diff) |
TaskHistory list now uses real data
Diffstat (limited to 'controller.cxx')
-rw-r--r-- | controller.cxx | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/controller.cxx b/controller.cxx index 133f2d8..14f6468 100644 --- a/controller.cxx +++ b/controller.cxx @@ -9,7 +9,6 @@ Controller::Controller(QObject* parent) : QObject{parent} - , m_ticketSubject{""} { #ifdef ANDROID QDir location{QStandardPaths::writableLocation(QStandardPaths @@ -45,6 +44,11 @@ Controller::Controller(QObject* parent) ticketList = new TicketList; engine->rootContext()->setContextProperty("ticketList", ticketList); + using RTClient::TicketHistoryList; + ticketHistoryList = new TicketHistoryList; + engine->rootContext()->setContextProperty("ticketHistoryList" + , ticketHistoryList); + connect(appWindow, SIGNAL(logIn(QString, QString)) , client, SLOT(logIn(QString, QString))); @@ -71,26 +75,11 @@ Controller::Controller(QObject* parent) }); }); - connect(appWindow, SIGNAL(ticketId(int)) + connect(appWindow, SIGNAL(ticketHistory(int)) , client, SLOT(ticketHistory(int))); - connect(appWindow, SIGNAL(ticketSubject(QString)) - , this, SLOT(setTicketSubject(QString))); - connect(client, &Client::gotTicketHistory - , [appWindow,this](rtclient_ticket_history_list* list) { - auto history = list->histories[0]; - QMetaObject::invokeMethod(appWindow, "ticketHistory" - , Q_ARG(QVariant, m_ticketSubject) - , Q_ARG(QVariant - , QString{history->content}) - , Q_ARG(QVariant - , QString{history->creator}) - , Q_ARG(QVariant - , QString{asctime(history - ->created)})); - rtclient_ticket_history_list_free(list); - }); + , ticketHistoryList, &TicketHistoryList::update); connect(appWindow, SIGNAL(ticketNew(QString, QString)) , client, SLOT(ticketNew(QString, QString))); @@ -98,11 +87,6 @@ Controller::Controller(QObject* parent) thread.start(); } -void Controller::setTicketSubject(QString const& subject) -{ - if (m_ticketSubject != subject) m_ticketSubject = subject; -} - Controller::~Controller() { thread.quit(); |