summaryrefslogtreecommitdiff
path: root/controller.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'controller.cxx')
-rw-r--r--controller.cxx30
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();