Commit 0ab46082 authored by Alexandre Lision's avatar Alexandre Lision

accounts: use human state name for account state

Issue: #78943
Change-Id: I967ee8d06fd8e4efc586a585af193aa529026755
parent a1eee3c0
...@@ -320,28 +320,28 @@ public: ...@@ -320,28 +320,28 @@ public:
if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME]) if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME])
{ {
cell.title = AccountModel::instance()->data(qIdx, Qt::DisplayRole).toString().toNSString(); cell.title = qIdx.data(Qt::DisplayRole).toString().toNSString();
} else if([[tableColumn identifier] isEqualToString:COLUMNID_STATE]) { } else if([[tableColumn identifier] isEqualToString:COLUMNID_STATE]) {
NSTextFieldCell* stateCell = cell; NSTextFieldCell* stateCell = cell;
Account::RegistrationState state = qvariant_cast<Account::RegistrationState>(qIdx.data((int)Account::Role::RegistrationState)); auto account = AccountModel::instance()->getAccountByModelIndex(qIdx);
switch (state) { auto humanState = account->toHumanStateName();
[stateCell setTitle:humanState.toNSString()];
switch (account->registrationState()) {
case Account::RegistrationState::READY: case Account::RegistrationState::READY:
[stateCell setTextColor:[NSColor colorWithCalibratedRed:116/255.0 green:179/255.0 blue:93/255.0 alpha:1.0]]; [stateCell setTextColor:[NSColor colorWithCalibratedRed:116/255.0 green:179/255.0 blue:93/255.0 alpha:1.0]];
[stateCell setTitle:@"Ready"];
break; break;
case Account::RegistrationState::TRYING: case Account::RegistrationState::TRYING:
[stateCell setTextColor:[NSColor redColor]]; [stateCell setTextColor:[NSColor redColor]];
[stateCell setTitle:@"Trying..."];
break; break;
case Account::RegistrationState::UNREGISTERED: case Account::RegistrationState::UNREGISTERED:
[stateCell setTextColor:[NSColor blackColor]]; [stateCell setTextColor:[NSColor blackColor]];
[stateCell setTitle:@"Unregistered"];
break; break;
case Account::RegistrationState::ERROR: case Account::RegistrationState::ERROR:
[stateCell setTextColor:[NSColor redColor]]; [stateCell setTextColor:[NSColor redColor]];
[stateCell setTitle:@"Error"];
break; break;
default: default:
[stateCell setTextColor:[NSColor blackColor]];
break; break;
} }
} else if([[tableColumn identifier] isEqualToString:COLUMNID_ENABLE]) { } else if([[tableColumn identifier] isEqualToString:COLUMNID_ENABLE]) {
......
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