Commit a1f07bf7 authored by Alexandre Lision's avatar Alexandre Lision

call: set displayName for ring accounts

Send the alias of the Ring account as the displayName
This is retro-compatible, by setting the displayName field on any ring
account created before this change.

Issue: #77365
Change-Id: Ifbe6269fa5fd6095cd0f61bfb23e443998418a16
parent b65c0270
......@@ -206,6 +206,7 @@
switch ([textField tag]) {
case ALIAS_TAG:
[self currentAccount]->setAlias([[textField stringValue] UTF8String]);
[self currentAccount]->setDisplayName([[textField stringValue] UTF8String]);
break;
case HOSTNAME_TAG:
[self currentAccount]->setHostname([[textField stringValue] UTF8String]);
......
......@@ -148,6 +148,7 @@
switch ([textField tag]) {
case ALIAS_TAG:
[self currentAccount]->setAlias([[textField stringValue] UTF8String]);
[self currentAccount]->setDisplayName([[textField stringValue] UTF8String]);
break;
case HOSTNAME_TAG:
[self currentAccount]->setHostname([[textField stringValue] UTF8String]);
......
......@@ -180,7 +180,8 @@ public:
auto newAccName = [[NSString alloc] initWithFormat:@"%@ account",
AccountModel::instance()->protocolModel()->data(qIdx, Qt::DisplayRole).toString().toNSString(), nil];
AccountModel::instance()->add([newAccName UTF8String], qIdx);
auto acc = AccountModel::instance()->add([newAccName UTF8String], qIdx);
acc->setDisplayName(acc->alias());
AccountModel::instance()->save();
}
......
......@@ -123,14 +123,17 @@
- (BOOL) checkForRingAccount
{
BOOL foundRingAcc = NO;
for (int i = 0 ; i < AccountModel::instance()->rowCount() ; ++i) {
QModelIndex idx = AccountModel::instance()->index(i);
Account* acc = AccountModel::instance()->getAccountByModelIndex(idx);
if(acc->protocol() == Account::Protocol::RING) {
return YES;
if (acc->displayName().isEmpty())
acc->setDisplayName(acc->alias());
foundRingAcc = YES;
}
}
return FALSE;
return foundRingAcc;
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
......
......@@ -122,6 +122,8 @@
NSString* newAccName = @"My Ring";
Account* newAcc = AccountModel::instance()->add([newAccName UTF8String], Account::Protocol::RING);
newAcc->setAlias([[nickname stringValue] UTF8String]);
newAcc->setDisplayName([[nickname stringValue] UTF8String]);
newAcc->setUpnpEnabled(YES); // Always active upnp
newAcc << Account::EditAction::SAVE;
}
......
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