diff options
-rw-r--r-- | Home.qml | 10 | ||||
-rw-r--r-- | TicketDetails.qml | 56 | ||||
-rw-r--r-- | TicketHistory.qml | 58 | ||||
-rw-r--r-- | TicketList.qml | 6 | ||||
-rw-r--r-- | controller.cxx | 27 | ||||
-rw-r--r-- | kelakon.qrc | 2 | ||||
m--------- | larva | 0 | ||||
m--------- | qrtclient | 0 |
8 files changed, 94 insertions, 65 deletions
@@ -3,6 +3,16 @@ import QtQuick.Controls 2.12 import "larva/features" HomeForm { + objectName: "home" + function ticketHistory(description, content, creator) { + pageView.push("TicketHistory.qml", { + "subject": subject + , "description": description + , "content": content + , "creator": creator + }) + } + menuButton.onClicked: drawer.open() profileButton.onClicked: pageView.push("Profile.qml") diff --git a/TicketDetails.qml b/TicketDetails.qml deleted file mode 100644 index d5a2dc9..0000000 --- a/TicketDetails.qml +++ /dev/null @@ -1,56 +0,0 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 -import QtQuick.Layouts 1.12 -import "larva/features" - -TaskDetailForm { - property string subject - backButton.onClicked: pageView.pop() - - StackView { - id: contentView - anchors.fill: parent - background: Rectangle { - color: "#FFFFFF" - } - - TaskBriefForm { - id: ticketBriefForm - anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - ticketSubject.text: subject - } - Label { - id: separator - color: "#000000" - text: qsTr("Activities") - font.weight: Font.Medium - font.pixelSize: 16 - font.family: "Work Sans" - anchors.left: parent.left - anchors.leftMargin: 16 - anchors.top: ticketBriefForm.bottom - anchors.topMargin: 8 - } - - TaskHistoryForm { - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.top: separator.bottom - anchors.topMargin: 8 - } - } -} - -/*##^## -Designer { - D{i:0;autoSize:true;height:480;width:640} -} -##^##*/ diff --git a/TicketHistory.qml b/TicketHistory.qml new file mode 100644 index 0000000..991b643 --- /dev/null +++ b/TicketHistory.qml @@ -0,0 +1,58 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Controls.Material 2.12 +import "larva/features" + +TaskDetailForm { + property string subject + property string description + property string content + property string creator + + backButton.onClicked: pageView.pop() + + StackView { + id: contentView + anchors.fill: parent + background: Rectangle { + color: "#FFFFFF" + } + + TaskBriefForm { + id: ticketBriefForm + anchors.top: parent.top + anchors.topMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + ticketSubject.text: subject + ticketCreator.text: creator + ticketCreatedText.text: description + } + + Label { + id: separator + color: "#000000" + text: qsTr("Activities") + font.weight: Font.Medium + font.pixelSize: 16 + font.family: "Work Sans" + anchors.left: parent.left + anchors.leftMargin: 16 + anchors.top: ticketBriefForm.bottom + anchors.topMargin: 8 + } + + TaskHistoryForm { + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.top: separator.bottom + anchors.topMargin: 8 + creator.text: creator + ticketDescription.text: content + } + } +} diff --git a/TicketList.qml b/TicketList.qml index ba874b9..d253aa8 100644 --- a/TicketList.qml +++ b/TicketList.qml @@ -8,11 +8,7 @@ TaskListForm { width: parent.width height: task.height taskTitle.text: subject - itemDelegate.onClicked: { - window.ticketHistory(id) - pageView.push("TicketDetails.qml" - , {"subject": subject}) - } + itemDelegate.onClicked: window.ticketHistory(id) } } } diff --git a/controller.cxx b/controller.cxx index b27896c..5a1d786 100644 --- a/controller.cxx +++ b/controller.cxx @@ -63,13 +63,34 @@ Controller::Controller(QObject* parent) : QObject{parent} connect(client, &Client::searchedTicket, ticketList, &TicketList::update); - connect(client, &Client::loggedIn, [appWindow,this]() { + auto ticketHistory = [appWindow,this,&client]() { + auto homeView = appWindow->findChild<QObject*>("home"); + connect(client, &Client::gotTicketHistory, [homeView] + (rtclient_ticket_history_list* list) { + auto history = list->histories[list->length - 1]; + QMetaObject::invokeMethod(homeView + , "ticketHistory" + , Q_ARG(QString + , QString{history + ->description}) + , Q_ARG(QString + , QString{history + ->content}) + , Q_ARG(QString + , QString{history + ->creator})); + }); + }; + + connect(client, &Client::loggedIn, [appWindow,this,ticketHistory]() { auto loginView = appWindow->findChild<QObject*>("login"); - connect(ticketList, &TicketList::updated, [loginView]() { + connect(ticketList, &TicketList::updated + , [loginView,this,ticketHistory]() { QMetaObject::invokeMethod(loginView , "pushHome"); + ticketHistory(); }); - }); + }); connect(appWindow, SIGNAL(ticketHistory(int)) , client, SLOT(ticketHistory(int))); diff --git a/kelakon.qrc b/kelakon.qrc index 670ff28..de92f96 100644 --- a/kelakon.qrc +++ b/kelakon.qrc @@ -5,7 +5,7 @@ <file>LoginPassword.qml</file> <file>Home.qml</file> <file>TicketList.qml</file> - <file>TicketDetails.qml</file> + <file>TicketHistory.qml</file> <file>Profile.qml</file> <file>Email.qml</file> <file>Password.qml</file> diff --git a/larva b/larva -Subproject 6c41f3de65255fd0286a6356a05fb8ed3edab6f +Subproject ed24552f650521b2a299c8340d97ae4df6a9948 diff --git a/qrtclient b/qrtclient -Subproject 3046c72a604df00cf54982a0985b3a70bdd6d99 +Subproject bd0e74d11e666126c97c34c5b508dbe811b128c |