Commit 32a5ac24 authored by Martin Straka's avatar Martin Straka

Added message type text into message detail

parent 0c3ff0e6
......@@ -49,6 +49,39 @@ const QVector<QString> MessageDb::msgStatus = {"dmDeliveryTime",
const QVector<QString> MessageDb::fileItemIds = {"id", "message_id",
"dmEncodedContent", "_dmFileDescr", "LENGTH(dmEncodedContent)"};
const QString dmTypeToText(const QString &val)
{
if (val.size() != 1) {
qCritical() << "Unknown message type value" << val.toUtf8().constData();
return QString();
}
switch (val[0].toLatin1()) {
case 'V':
return QObject::tr("Public data message");
break;
case 'K':
return QObject::tr("Postal data message");
break;
case 'I':
return QObject::tr("Initialising postal data message");
break;
case 'O':
return QObject::tr("Reply postal data message");
break;
case 'X':
return QObject::tr("Initialising postal data message - expired");
break;
case 'Y':
return QObject::tr("Initialising postal data message - used");
break;
default:
qCritical() << "Unknown message type value" << val[0].toLatin1();
return QObject::tr("Unknown message typ");
break;
}
}
const QString msgStatusToText(int status)
{
switch (status) {
......@@ -452,7 +485,7 @@ QString MessageDb::getMessageDetailDataFromDb(qint64 dmId) const
"dmAnnotation, dmAttachmentSize, "
"dbIDSender, dmSender, dmSenderAddress, _dmCustomData, "
"dbIDRecipient, dmRecipient, dmRecipientAddress, "
"dmPersonalDelivery, dmAllowSubstDelivery "
"dmPersonalDelivery, dmAllowSubstDelivery, dmType "
"FROM messages WHERE dmID = :dmID";
if (!query.prepare(queryStr)) {
goto fail;
......@@ -469,6 +502,10 @@ QString MessageDb::getMessageDetailDataFromDb(qint64 dmId) const
(query.value(10).toBool()) ? QObject::tr("Yes") : QObject::tr("No"));
html += strongInfoLine(QObject::tr("Delivery by fiction"),
(query.value(11).toBool()) ? QObject::tr("Yes") : QObject::tr("No"));
if (!query.value(12).toString().isEmpty()) {
html += strongInfoLine(QObject::tr("Message type"),
dmTypeToText(query.value(12).toString()));
}
if (query.value(0).toInt() == TYPE_RECEIVED) {
/* Information about message sender. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment