From 31f74ef3bfe985be610e1c0a5a3f4df7d764ef72 Mon Sep 17 00:00:00 2001 From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> Date: Wed, 7 Oct 2015 16:45:14 -0400 Subject: [PATCH] roles: add IndexedLastUsed to Ring::Role enum This is used to get the history category enum value rather than the formatted string to be able to do comparisons, since the formatted string changes depending on the language. Issue: #81198 Change-Id: I215571beea11e9bb543fdbfba93041c43cd2e4f5 --- src/contactmethod.cpp | 2 ++ src/itemdataroles.h | 1 + src/person.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp index 2af2812a..b21f3feb 100644 --- a/src/contactmethod.cpp +++ b/src/contactmethod.cpp @@ -494,6 +494,8 @@ QVariant ContactMethod::roleData(int role) const case static_cast<int>(Call::Role::FormattedDate): cat = !lastCall ? QVariant() : HistoryTimeCategoryModel::timeToHistoryCategory(lastCall->startTimeStamp()); break; + case static_cast<int>(Ring::Role::IndexedLastUsed): + return QVariant(static_cast<int>(HistoryTimeCategoryModel::timeToHistoryConst(lastCall->startTimeStamp()))); case static_cast<int>(Call::Role::HasAVRecording): cat = cat = !lastCall ? QVariant() : lastCall->isAVRecording(); break; diff --git a/src/itemdataroles.h b/src/itemdataroles.h index 2c9334e6..30b163d9 100644 --- a/src/itemdataroles.h +++ b/src/itemdataroles.h @@ -41,6 +41,7 @@ enum class Role Number , LastUsed , FormattedLastUsed , + IndexedLastUsed , State , FormattedState , DropState , diff --git a/src/person.cpp b/src/person.cpp index ee205f0e..063f5bff 100644 --- a/src/person.cpp +++ b/src/person.cpp @@ -568,6 +568,7 @@ QVariant Person::roleData(int role) const case static_cast<int>(Ring::Role::FormattedLastUsed): case static_cast<int>(Person::Role::FormattedLastUsed): return QVariant(HistoryTimeCategoryModel::timeToHistoryCategory(lastUsedTime())); + case static_cast<int>(Ring::Role::IndexedLastUsed): case static_cast<int>(Person::Role::IndexedLastUsed): return QVariant(static_cast<int>(HistoryTimeCategoryModel::timeToHistoryConst(lastUsedTime()))); case static_cast<int>(Ring::Role::Object): -- GitLab