Commit 2bd39e94 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[accountsmodel] Expose provider's display name

This is a human-facing name, e.g. 'Google' instead of 'google'
parent 81380cb3
......@@ -99,14 +99,17 @@ AccountsModel::~AccountsModel()
QHash<int, QByteArray> AccountsModel::roleNames() const
{
static QHash<int, QByteArray> roles{{IdRole, "id"},
{ServicesRole, "services"},
{EnabledRole, "enabled"},
{CredentialsIdRole, "credentialsId"},
{DisplayNameRole, "displayName"},
{ProviderNameRole, "providerName"},
{IconNameRole, "iconName"},
{DataObjectRole, "dataObject"}};
static QHash<int, QByteArray> roles{
{IdRole, "id"},
{ServicesRole, "services"},
{EnabledRole, "enabled"},
{CredentialsIdRole, "credentialsId"},
{DisplayNameRole, "displayName"},
{ProviderNameRole, "providerName"},
{IconNameRole, "iconName"},
{DataObjectRole, "dataObject"},
{ProviderDisplayNameRole, "providerDisplayName"},
};
return roles;
}
......@@ -156,6 +159,9 @@ QVariant AccountsModel::data(const QModelIndex &index, int role) const
case ProviderNameRole:
data.setValue(account->providerName());
break;
case ProviderDisplayNameRole:
data.setValue(account->provider().displayName());
break;
case IconNameRole: {
QString iconName = QStringLiteral("user-identity");
if (account->provider().isValid() && !account->provider().iconName().isEmpty()) {
......
......@@ -44,6 +44,7 @@ public:
ProviderNameRole,
IconNameRole,
DataObjectRole,
ProviderDisplayNameRole,
};
explicit AccountsModel(QObject *parent = nullptr);
~AccountsModel() override;
......
Supports Markdown
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