summaryrefslogtreecommitdiff
path: root/worker.cxx
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-07 17:42:11 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-07 17:42:11 +0800
commite04036b24aef79b9b7eb370c35c9f7b8ade77846 (patch)
tree3a3855d902a1f6f13c36ae2c82bcb5ff9b05635a /worker.cxx
parent129d7c1a7962e3552983e11593f764906994f1dc (diff)
The worker cannot have a parent
because it has to be moved to a different thread
Diffstat (limited to 'worker.cxx')
-rw-r--r--worker.cxx12
1 files changed, 3 insertions, 9 deletions
diff --git a/worker.cxx b/worker.cxx
index df0e832..5af91fb 100644
--- a/worker.cxx
+++ b/worker.cxx
@@ -3,27 +3,21 @@
#include "user.hxx"
#include "worker.hxx"
-Worker::Worker(QObject* parent) :
- QObject{parent}
+Worker::Worker()
{
rtclient_init("https://darapsa.co.id/rt");
}
void Worker::logIn(QString const& name, QString const& password)
{
- auto engine = dynamic_cast<QQmlApplicationEngine*>(this->parent());
- auto user = engine->singletonInstance<User*>(User::typeId);
- user->setName(name);
rtclient_login(name.toLatin1().constData(), password.toLatin1().constData());
rtclient_user(name.toLatin1().constData());
}
-void Worker::getTaskList()
+void Worker::search(QString const& owner)
{
- auto engine = dynamic_cast<QQmlApplicationEngine*>(this->parent());
- auto user = engine->singletonInstance<User*>(User::typeId);
QString query{"Owner='"};
- query.append(user->name());
+ query.append(owner);
query.append("'");
rtclient_search(query.toLatin1().constData());
}