From cd679da218281c5716001a4e2055451ab9bcc926 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: Sun, 15 Sep 2019 18:42:35 +0800 Subject: A Qt Core based library that depends on librtclient and can be used for a Qt based project --- client.cxx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 client.cxx (limited to 'client.cxx') diff --git a/client.cxx b/client.cxx new file mode 100644 index 0000000..2f30b49 --- /dev/null +++ b/client.cxx @@ -0,0 +1,34 @@ +#include +#include "qrtclient/client.hxx" + +namespace RTClient { + + Client::Client(QString const& url) + { + rtclient_init(url.toLatin1().constData()); + } + + void Client::logIn(QString const& name, QString const& password) + { + rtclient_login(name.toLatin1().constData(), password.toLatin1().constData()); + struct rt_user* user = NULL; + rtclient_user_show(&user, name.toLatin1().constData()); + if (user) emit logged(user); + } + + void Client::search(QString const& owner) + { + QString query{"Owner='"}; + query.append(owner); + query.append("'"); + rt_ticketlist* taskList = NULL; + rtclient_ticket_search(&taskList, query.toLatin1().constData()); + if (taskList) emit foundTasks(taskList); + } + + Client::~Client() + { + rtclient_cleanup(); + } + +} -- cgit v1.2.3