summaryrefslogtreecommitdiff
path: root/qrtclient/ticket.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'qrtclient/ticket.hxx')
-rw-r--r--qrtclient/ticket.hxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/qrtclient/ticket.hxx b/qrtclient/ticket.hxx
index 2ad8008..25c067f 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)
@@ -36,6 +43,9 @@ namespace RTClient {
, int role = Qt::DisplayRole
) const Q_DECL_OVERRIDE;
+ public slots:
+ void update(rtclient_ticketlist* ticketList);
+
protected:
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
@@ -43,9 +53,6 @@ namespace RTClient {
void updated();
void rowCountChanged();
- private slots:
- void update(rtclient_ticketlist* ticketList);
-
private:
QList<Ticket> tickets;
void addTicket(Ticket const& ticket);