summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ticket.cxx53
-rw-r--r--tickethistory.cxx117
2 files changed, 83 insertions, 87 deletions
diff --git a/ticket.cxx b/ticket.cxx
index 7b21bc8..e42207b 100644
--- a/ticket.cxx
+++ b/ticket.cxx
@@ -3,36 +3,35 @@
namespace RTClient {
- int TicketList::rowCount(QModelIndex const& parent) const
- {
- Q_UNUSED(parent)
- return tickets.count();
- }
+int TicketList::rowCount(QModelIndex const& parent) const
+{
+ Q_UNUSED(parent)
+ return tickets.count();
+}
- QVariant TicketList::data(QModelIndex const& index, int role) const
- {
- auto row = index.row();
-
- if (row < 0 || row >= tickets.count()) return QVariant();
-
- auto ticket = tickets[row];
- switch (role) {
- case IdRole:
- return ticket.id();
- case SubjectRole:
- return ticket.subject();
- default:
- return QVariant();
- }
- }
+QVariant TicketList::data(QModelIndex const& index, int role) const
+{
+ auto row = index.row();
- QHash<int, QByteArray> TicketList::roleNames() const
- {
- return QHash<int, QByteArray>{
- {IdRole, "id"}
- , {SubjectRole, "subject"}
- };
+ if (row < 0 || row >= tickets.count()) return QVariant();
+
+ auto ticket = tickets[row];
+ switch (role) {
+ case IdRole:
+ return ticket.id();
+ case SubjectRole:
+ return ticket.subject();
+ default:
+ return QVariant();
}
+}
+
+QHash<int, QByteArray> TicketList::roleNames() const
+{
+ return QHash<int, QByteArray>{{IdRole, "id"},
+ {SubjectRole, "subject"}
+ };
+}
void TicketList::addTicket(Ticket const& ticket)
{
diff --git a/tickethistory.cxx b/tickethistory.cxx
index 80fc478..d163882 100644
--- a/tickethistory.cxx
+++ b/tickethistory.cxx
@@ -3,71 +3,68 @@
namespace RTClient {
- int TicketHistoryList::rowCount(QModelIndex const& parent) const
- {
- Q_UNUSED(parent)
- return histories.count();
- }
+int TicketHistoryList::rowCount(QModelIndex const& parent) const
+{
+ Q_UNUSED(parent)
+ return histories.count();
+}
- QVariant TicketHistoryList::data(QModelIndex const& index, int role) const
- {
- auto row = index.row();
+QVariant TicketHistoryList::data(QModelIndex const& index, int role) const
+{
+ auto row = index.row();
- if (row < 0 || row >= histories.count()) return QVariant();
+ if (row < 0 || row >= histories.count()) return QVariant();
- auto history = histories[row];
- switch (role) {
- case IdRole:
- return history.id();
- case TicketRole:
- return history.ticket();
- case TimeTakenRole:
- return history.timeTaken();
- case TypeRole:
- return history.type();
- case FieldRole:
- return history.field();
- case OldValueRole:
- return history.oldValue();
- case NewValueRole:
- return history.newValue();
- case DataRole:
- return history.data();
- case DescriptionRole:
- return history.description();
- case ContentRole:
- return history.content();
- case CreatorRole:
- return history.creator();
- case CreatedRole:
- return history.created();
- /*
- case AttachmentsRole:
- return history.attachments();
- */
- default:
- return QVariant();
- }
+ auto history = histories[row];
+ switch (role) {
+ case IdRole:
+ return history.id();
+ case TicketRole:
+ return history.ticket();
+ case TimeTakenRole:
+ return history.timeTaken();
+ case TypeRole:
+ return history.type();
+ case FieldRole:
+ return history.field();
+ case OldValueRole:
+ return history.oldValue();
+ case NewValueRole:
+ return history.newValue();
+ case DataRole:
+ return history.data();
+ case DescriptionRole:
+ return history.description();
+ case ContentRole:
+ return history.content();
+ case CreatorRole:
+ return history.creator();
+ case CreatedRole:
+ return history.created();/*
+ case AttachmentsRole:
+ return history.attachments();*/
+ default:
+ return QVariant();
}
+}
- QHash<int, QByteArray> TicketHistoryList::roleNames() const
- {
- return QHash<int, QByteArray>{
- {IdRole, "id"}
- , {TicketRole, "ticket"}
- , {TimeTakenRole, "timeTaken"}
- , {TypeRole, "type"}
- , {FieldRole, "field"}
- , {OldValueRole, "oldValue"}
- , {NewValueRole, "newValue"}
- , {DataRole, "data"}
- , {DescriptionRole, "description"}
- , {ContentRole, "content"}
- , {CreatorRole, "creator"}
- , {CreatedRole, "created"}
-// , {AttachmentsRole, "attachments"}
- };
- }
+QHash<int, QByteArray> TicketHistoryList::roleNames() const
+{
+ return QHash<int, QByteArray>{{IdRole, "id"},
+ {TicketRole, "ticket"},
+ {TimeTakenRole, "timeTaken"},
+ {TypeRole, "type"},
+ {FieldRole, "field"},
+ {OldValueRole, "oldValue"},
+ {NewValueRole, "newValue"},
+ {DataRole, "data"},
+ {DescriptionRole, "description"},
+ {ContentRole, "content"},
+ {CreatorRole, "creator"},
+ {CreatedRole, "created"}/*,
+ {AttachmentsRole, "attachments"}*/
+ };
+}
void TicketHistoryList::addTicketHistory(TicketHistory const& history)
{