diff options
| -rw-r--r-- | Home.qml | 10 | ||||
| -rw-r--r-- | TicketDetails.qml | 79 | ||||
| -rw-r--r-- | TicketHistory.qml | 58 | ||||
| -rw-r--r-- | TicketList.qml | 6 | ||||
| -rw-r--r-- | controller.cxx | 31 | ||||
| -rw-r--r-- | kelakon.qrc | 2 | ||||
| m--------- | larva | 0 | ||||
| m--------- | qrtclient | 0 | 
8 files changed, 96 insertions, 90 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 b7cb477..0000000 --- a/TicketDetails.qml +++ /dev/null @@ -1,79 +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: attachmentSeparator -            color: "#000000" -            text: qsTr("Attachments") -            anchors.left: parent.left -            anchors.leftMargin: 16 -            anchors.top: ticketBriefForm.bottom -            anchors.topMargin: 8 -            font.weight: Font.Medium -            font.pixelSize: 16 -            font.family: "Work Sans" -        } - -        TicketAttachmentForm { -            id: ticketAttachmentForm -            anchors.top: attachmentSeparator.bottom -            anchors.topMargin: 16 -            anchors.right: parent.right -            anchors.rightMargin: 16 -            anchors.left: parent.left -            anchors.leftMargin: 16 -        } -        Label { -            id: activitiesSeparator -            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: ticketAttachmentForm.bottom -            anchors.topMargin: 24 -        } - -		TaskHistoryForm { -            id: taskHistoryForm -			anchors.right: parent.right -			anchors.rightMargin: 0 -			anchors.left: parent.left -			anchors.leftMargin: 0 -            anchors.top: activitiesSeparator.bottom -            anchors.topMargin: 16 -        } -    } -} - -/*##^## -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 a229495..5a1d786 100644 --- a/controller.cxx +++ b/controller.cxx @@ -59,17 +59,38 @@ Controller::Controller(QObject* parent) : QObject{parent}  	connect(this, static_cast<void (Controller::*)(QString const&)>  			(&Controller::checked) -			, client, &Client::ticketSearch); +			, client, &Client::searchTicket); -	connect(client, &Client::ticketSearched, ticketList, &TicketList::update); +	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 cb249baa8d8dcc54dd575f82d5cb3134957c71b +Subproject bd0e74d11e666126c97c34c5b508dbe811b128c |