summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------librtclient0
-rw-r--r--qrtclient/ticket.hxx11
-rw-r--r--ticket.cxx6
3 files changed, 13 insertions, 4 deletions
diff --git a/librtclient b/librtclient
-Subproject a2667831d91ca18b9b8d41ad1d52a721103f875
+Subproject e39fa22f6896b7b7200229ffba95c56074a1753
diff --git a/qrtclient/ticket.hxx b/qrtclient/ticket.hxx
index 2ad8008..26e5643 100644
--- a/qrtclient/ticket.hxx
+++ b/qrtclient/ticket.hxx
@@ -2,6 +2,7 @@
#define QRTCLIENT_TICKET_HXX
#include <QAbstractListModel>
+#include <rtclient/ticket.h>
struct rtclient_ticketlist;
@@ -10,10 +11,15 @@ namespace RTClient {
class Ticket
{
public:
- Ticket(QString subject) : m_subject{subject} {}
+ Ticket(rtclient_ticket* ticket)
+ : m_id{ticket->id}
+ , m_subject{ticket->subject}
+ {}
+ unsigned int id() const { return m_id; }
QString const& subject() const { return m_subject; }
private:
+ unsigned int m_id;
QString m_subject;
};
@@ -24,7 +30,8 @@ namespace RTClient {
public:
enum TicketRoles {
- SubjectRole = Qt::UserRole + 1,
+ IdRole = Qt::UserRole + 1,
+ SubjectRole
};
explicit TicketList(QObject* parent = nullptr)
diff --git a/ticket.cxx b/ticket.cxx
index cd984c5..9518c74 100644
--- a/ticket.cxx
+++ b/ticket.cxx
@@ -1,5 +1,4 @@
#include <cstddef>
-#include <rtclient/ticket.h>
#include "qrtclient/ticket.hxx"
namespace RTClient {
@@ -18,6 +17,8 @@ namespace RTClient {
auto ticket = tickets[row];
switch (role) {
+ case IdRole:
+ return ticket.id();
case SubjectRole:
return ticket.subject();
default:
@@ -28,7 +29,8 @@ namespace RTClient {
QHash<int, QByteArray> TicketList::roleNames() const
{
return QHash<int, QByteArray>{
- {SubjectRole, "subject"}
+ {IdRole, "subject"}
+ , {SubjectRole, "subject"}
};
}