Commit bdaa274b authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

UI/UX: standardize windows views

- standardize view for backup account, register username and change
password windows

Change-Id: I442a32cfa04ac9fe4af7fed2318cac6c4e264693
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 4a7bffe5
......@@ -25,8 +25,10 @@
@implementation PasswordChangeWC
{
__unsafe_unretained IBOutlet NSSecureTextField *oldPassword;
__unsafe_unretained IBOutlet NSTextField *oldPasswordTitle;
__unsafe_unretained IBOutlet NSSecureTextField *newPassword;
__unsafe_unretained IBOutlet NSSecureTextField *repeatedPassword;
__unsafe_unretained IBOutlet NSLayoutConstraint *newPasswordTopConstraint;
__unsafe_unretained IBOutlet NSImageView *repeatPasswordValid;
......@@ -51,9 +53,9 @@
[super windowDidLoad];
lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(self.selectedAccountID);
BOOL hasPassword = accountProperties.archiveHasPassword;
[oldPassword setEnabled:hasPassword];
[oldPassword setPlaceholderString:(hasPassword)?@"":NSLocalizedString(@"Account has no password", @"No password on this account text field placeholder")];
[oldPassword setHidden: !hasPassword];
[oldPasswordTitle setHidden: !hasPassword];
newPasswordTopConstraint.constant = hasPassword ? 15.0 : -oldPasswordTitle.frame.size.height;
}
-(IBAction)accept:(id)sender
......@@ -67,6 +69,7 @@
[self close];
} else {
[oldPassword setStringValue:@""];
[oldPassword setPlaceholderString:@"Enter your old password"];
[wrongPasswordPopover showRelativeToRect:oldPassword.visibleRect ofView:oldPassword preferredEdge:NSMinYEdge];
}
}
......
......@@ -39,12 +39,12 @@
/**
* KVO with the registeredNameField
*/
@property (nonatomic, weak)NSString* registeredName;
//@property (nonatomic, weak)NSString* registeredName;
/**
* KVO with the passwordField
*/
@property (nonatomic, weak)NSString* password;
//@property (nonatomic, weak)NSString* password;
/**
* KVO validators for the UI
......
......@@ -63,15 +63,17 @@ NSInteger const BLOCKCHAIN_NAME_TAG = 2;
[registeredNameField setTag:BLOCKCHAIN_NAME_TAG];
[ivLookupResult setHidden:YES];
[indicatorLookupResult setHidden:YES];
self.password = @"";
self.registeredName = @"";
// self.password = @"";
//self.registeredName = @"";
// [registeredNameField setPlaceholderString:@"Username..."];
// [passwordField setPlaceholderString:@"Password..."];
}
#pragma mark - Username validation delegate methods
- (BOOL)userNameAvailable
{
return (self.registeredName.length > 0 && self.isUserNameAvailable);
return (registeredNameField.stringValue.length > 0 && self.isUserNameAvailable);
}
- (void)showLookUpAvailable:(BOOL)available andText:(NSString *)message
......@@ -193,7 +195,7 @@ NSInteger const BLOCKCHAIN_NAME_TAG = 2;
[self showLoading];
[self setCallback];
self.isUserNameAvailable = self.accountModel->registerName(self.selectedAccountID, [self.password UTF8String], [self.registeredName UTF8String]);
self.isUserNameAvailable = self.accountModel->registerName(self.selectedAccountID, [passwordField.stringValue UTF8String], [registeredNameField.stringValue UTF8String]);
if (!self.isUserNameAvailable) {
NSLog(@"Could not initialize registerName operation");
QObject::disconnect(registrationEnded);
......@@ -212,7 +214,7 @@ NSInteger const BLOCKCHAIN_NAME_TAG = 2;
switch(status)
{
case lrc::api::account::RegisterNameStatus::SUCCESS: {
[self.delegate didRegisterName: self.registeredName withSuccess: YES];
[self.delegate didRegisterName: registeredNameField.stringValue withSuccess: YES];
break;
}
case lrc::api::account::RegisterNameStatus::INVALID_NAME:
......
......@@ -72,6 +72,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.view setAutoresizingMask: NSViewHeightSizable];
fileButtonTitleBackup = NSLocalizedString(@"Select archive",
@"export account button title");
}
- (void)show
......
......@@ -69,7 +69,6 @@
[newAccountWC setDelegate:self];
[self.window setBackgroundColor:[NSColor ringGreyHighlight]];
[self showChooseWithCancelButton:isCancelable andAdvanced: withAdvanced];
self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantLight];
}
- (void)removeSubviews
......
This diff is collapsed.
......@@ -169,3 +169,6 @@
/* Remove account alert message */
"By clicking \"OK\" you will remove this account on this device! This action can not be undone. Also, your registered name can be lost." = "By clicking \"OK\" you will remove this account on this device! This action can not be undone. Also, your registered name can be lost.";
/* export account button title */
"Select archive" = "Select archive";
......@@ -11,8 +11,8 @@
/* Class = "NSTextFieldCell"; title = "Password is incorrect"; ObjectID = "WyU-Dx-U1u"; */
"WyU-Dx-U1u.title" = "Password is incorrect";
/* Class = "NSTextFieldCell"; title = "Enter your old password"; ObjectID = "gPw-Jf-0M7"; */
"gPw-Jf-0M7.title" = "Enter your old password";
/* Class = "NSTextFieldCell"; title = "Old password"; ObjectID = "gPw-Jf-0M7"; */
"gPw-Jf-0M7.title" = "Old password";
/* Class = "NSTextFieldCell"; title = "Chose a new password"; ObjectID = "pZe-DO-jWp"; */
"pZe-DO-jWp.title" = "Chose a new password";
/* Class = "NSTextFieldCell"; title = "New password"; ObjectID = "pZe-DO-jWp"; */
"pZe-DO-jWp.title" = "New password";
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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