summaryrefslogtreecommitdiff
path: root/client.cxx
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-15 18:42:35 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-15 18:42:35 +0800
commitcd679da218281c5716001a4e2055451ab9bcc926 (patch)
tree43c1a719690062d4c0f65bbff593b7e5e23b5eb9 /client.cxx
A Qt Core based library that depends on librtclient
and can be used for a Qt based project
Diffstat (limited to 'client.cxx')
-rw-r--r--client.cxx34
1 files changed, 34 insertions, 0 deletions
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 <rtclient/client.h>
+#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();
+ }
+
+}