diff --git a/src/account.cpp b/src/account.cpp index 245c5f046cc2ea30f9d78a574a90346dbcb9231b..6645313d5d8cb5016792e5b49cda654968687b0f 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -1259,6 +1259,8 @@ QVariant Account::roleData(int role) const return extension<SecurityEvaluationExtension>()->securityLevelIcon(this); } break; + case CAST(Account::Role::LastStatusChangeTimeStamp): + return QVariant::fromValue(statusModel()->lastTimeStamp()); default: return QVariant(); } diff --git a/src/account.h b/src/account.h index 41b6c64b074647842950d0df199d38cf3d2bfc71..a61c2ce1217b65c3eee4ee7ab99c2c5a32a44f64 100644 --- a/src/account.h +++ b/src/account.h @@ -307,6 +307,7 @@ class LIB_EXPORT Account : public ItemBase { HasActiveCallLimit , SecurityLevel , SecurityLevelIcon , + LastStatusChangeTimeStamp , }; ///@enum RoleState Whether a role can be used in a certain context diff --git a/src/accountmodel.cpp b/src/accountmodel.cpp index 984b31c2d8bb144db39cba030fb79b834e624a0a..2ad0697f66cfb0c7d7b85e012294567cd10b3647 100644 --- a/src/accountmodel.cpp +++ b/src/accountmodel.cpp @@ -198,6 +198,7 @@ QHash<int,QByteArray> AccountModel::roleNames() const roles.insert(CAST(Account::Role::TurnServerRealm ) ,QByteArray("turnServerRealm" )); roles.insert(CAST(Account::Role::TurnServerEnabled ) ,QByteArray("turnEnabled" )); roles.insert(CAST(Account::Role::TlsPrivateKey ) ,QByteArray("tlsPrivateKey" )); + roles.insert(CAST(Account::Role::LastStatusChangeTimeStamp ) ,QByteArray("lastStatusChangeTimeStamp" )); } return roles; diff --git a/src/accountstatusmodel.cpp b/src/accountstatusmodel.cpp index 98bf1c5376df5ec1716542e2b954089097cb40ac..6cdc2f7e067e5494cf409bf13293825f4782687b 100644 --- a/src/accountstatusmodel.cpp +++ b/src/accountstatusmodel.cpp @@ -56,6 +56,7 @@ struct AccountStatusRow { QString description; int code ; QDateTime time ; + time_t timestamp ; uint counter ; AccountStatusModel::Type type ; }; @@ -68,6 +69,7 @@ public: //Attributes Account* m_pAccount; QVector<AccountStatusRow*> m_lRows; + time_t m_FallbackTime_t; }; @@ -76,9 +78,11 @@ code(_code),counter(0), time(QDateTime::currentDateTime()),type(_type) { description = _description; + timestamp = time.toTime_t(); } -AccountStatusModelPrivate::AccountStatusModelPrivate(Account* parent) : m_pAccount(parent) +AccountStatusModelPrivate::AccountStatusModelPrivate(Account* parent) : m_pAccount(parent), +m_FallbackTime_t(QDateTime::currentDateTime().toTime_t()) { } @@ -221,3 +225,11 @@ int AccountStatusModel::lastErrorCode() const return d_ptr->m_lRows.last()->code; } + +time_t AccountStatusModel::lastTimeStamp() const +{ + if (d_ptr->m_lRows.isEmpty()) + return d_ptr->m_FallbackTime_t; + + return d_ptr->m_lRows.last()->timestamp; +} diff --git a/src/accountstatusmodel.h b/src/accountstatusmodel.h index 6f5540b3f1ad7f50aaee67f0ee39df7e58c3dff8..c76c328f2ffeb815ae8da45678932343d4f7e10d 100644 --- a/src/accountstatusmodel.h +++ b/src/accountstatusmodel.h @@ -65,6 +65,7 @@ public: //Getter QString lastErrorMessage() const; int lastErrorCode () const; + time_t lastTimeStamp () const; private: //Private mutators