summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controller.cxx2
-rw-r--r--worker.cxx13
-rw-r--r--worker.hxx1
3 files changed, 14 insertions, 2 deletions
diff --git a/controller.cxx b/controller.cxx
index 757d475..4962072 100644
--- a/controller.cxx
+++ b/controller.cxx
@@ -4,7 +4,7 @@
Controller::Controller(QObject* parent) : QObject{parent}
{
- Worker* worker = new Worker{};
+ Worker* worker = new Worker{parent};
worker->moveToThread(&thread);
connect(&thread, &QThread::finished, worker, &QObject::deleteLater);
diff --git a/worker.cxx b/worker.cxx
index b3c42aa..df0e832 100644
--- a/worker.cxx
+++ b/worker.cxx
@@ -1,4 +1,6 @@
+#include <QQmlApplicationEngine>
#include "rtclient.h"
+#include "user.hxx"
#include "worker.hxx"
Worker::Worker(QObject* parent) :
@@ -9,10 +11,19 @@ Worker::Worker(QObject* parent) :
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()
+{
+ auto engine = dynamic_cast<QQmlApplicationEngine*>(this->parent());
+ auto user = engine->singletonInstance<User*>(User::typeId);
QString query{"Owner='"};
- query.append(name);
+ query.append(user->name());
query.append("'");
rtclient_search(query.toLatin1().constData());
}
diff --git a/worker.hxx b/worker.hxx
index 660361e..ee5f027 100644
--- a/worker.hxx
+++ b/worker.hxx
@@ -13,6 +13,7 @@ class Worker : public QObject
public slots:
void logIn(QString const& name, QString const& password);
+ void getTaskList();
};
#endif // WORKER_HXX