summaryrefslogtreecommitdiff
path: root/client.cxx
diff options
context:
space:
mode:
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();
+ }
+
+}