Commit 9a2791a9 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

account settings: fix button visibility

Fix visibility for register name button for non jams accounts

Change-Id: I23aa8aa32ff0dabf352ca323fecb12b15ed470d0
parent 2d621cbe
......@@ -157,7 +157,15 @@ typedef NS_ENUM(NSInteger, TagViews) {
NSString* displayName = @(account.profileInfo.alias.c_str());
[displayNameField setStringValue:displayName];
[ringIDField setStringValue:@(account.profileInfo.uri.c_str())];
if(account.registeredName.empty()) {
lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
bool hideLocalAccountConfig = !accountProperties.managerUri.empty();
[passwordButton setHidden:hideLocalAccountConfig];
[linkDeviceButton setHidden:hideLocalAccountConfig];
[passwordField setHidden:hideLocalAccountConfig];
[exportAccountButton setHidden: hideLocalAccountConfig];
if(account.registeredName.empty() && !hideLocalAccountConfig) {
[registerNameButton setHidden:NO];
buttonRegisterWidthConstraint.constant = 260.0;
} else {
......@@ -167,17 +175,9 @@ typedef NS_ENUM(NSInteger, TagViews) {
[registeredNameField setStringValue:@(account.registeredName.c_str())];
lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
[passwordButton setTitle:accountProperties.archiveHasPassword ? @"Change password" : @"Create password"];
self.accountEnabled = account.enabled;
bool hideLocalAccountConfig = !accountProperties.managerUri.empty();
[registerNameButton setHidden:hideLocalAccountConfig];
[passwordButton setHidden:hideLocalAccountConfig];
[linkDeviceButton setHidden:hideLocalAccountConfig];
[passwordField setHidden:hideLocalAccountConfig];
[exportAccountButton setHidden: hideLocalAccountConfig];
NSMutableAttributedString *colorTitle = [[NSMutableAttributedString alloc] initWithAttributedString:[removeAccountButton attributedTitle]];
NSRange titleRange = NSMakeRange(0, [colorTitle length]);
[colorTitle addAttribute:NSForegroundColorAttributeName value:[NSColor errorColor] range:titleRange];
......
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