Skip to content
Snippets Groups Projects
Commit 3394209f authored by Alexandre Lision's avatar Alexandre Lision Committed by gerrit2
Browse files

wizard: prepopulate field name

Use username's login provided by the system

Tuleap: #334
Change-Id: I61f18fa4e3265763d16aa6c1b4ae715c024bfe96
parent aa03df49
Branches
Tags
No related merge requests found
......@@ -32,7 +32,7 @@
@implementation RingWizardWC {
__unsafe_unretained IBOutlet NSButton* goToAppButton;
__unsafe_unretained IBOutlet NSTextField *nickname;
__unsafe_unretained IBOutlet NSTextField* nicknameField;
__unsafe_unretained IBOutlet NSProgressIndicator* progressBar;
__unsafe_unretained IBOutlet NSTextField* indicationLabel;
__unsafe_unretained IBOutlet NSButton* createButton;
......@@ -55,7 +55,7 @@ NSInteger const NICKNAME_TAG = 1;
[super windowDidLoad];
[passwordField setTag:PVK_PASSWORD_TAG];
[nickname setTag:NICKNAME_TAG];
[nicknameField setTag:NICKNAME_TAG];
isExpanded = false;
[self.window makeKeyAndOrderFront:nil];
......@@ -65,6 +65,8 @@ NSInteger const NICKNAME_TAG = 1;
if(![appDelegate checkForRingAccount]) {
accountToCreate = AccountModel::instance().add("", Account::Protocol::RING);
[nicknameField setStringValue:NSFullUserName()];
[self toggleCreateButton:NSFullUserName()];
} else {
[indicationLabel setStringValue:NSLocalizedString(@"Ring is already ready to work",
@"Display message to user")];
......@@ -79,10 +81,10 @@ NSInteger const NICKNAME_TAG = 1;
- (void) displayHash:(NSString* ) hash
{
[nickname setFrameSize:NSMakeSize(400, nickname.frame.size.height)];
[nickname setStringValue:hash];
[nickname setEditable:NO];
[nickname setHidden:NO];
[nicknameField setFrameSize:NSMakeSize(400, nicknameField.frame.size.height)];
[nicknameField setStringValue:hash];
[nicknameField setEditable:NO];
[nicknameField setHidden:NO];
[showCustomCertsButton setHidden:YES];
......@@ -100,7 +102,7 @@ NSInteger const NICKNAME_TAG = 1;
- (IBAction)createRingAccount:(id)sender
{
[nickname setHidden:YES];
[nicknameField setHidden:YES];
[progressBar setHidden:NO];
[createButton setEnabled:NO];
[indicationLabel setStringValue:NSLocalizedString(@"Just a moment...",
......@@ -173,6 +175,13 @@ NSInteger const NICKNAME_TAG = 1;
}
}
- (void) toggleCreateButton:(NSString*) alias
{
[createButton setEnabled:![alias isEqualToString:@""]];
accountToCreate->setAlias([alias UTF8String]);
accountToCreate->setDisplayName([alias UTF8String]);
}
- (IBAction)goToApp:(id)sender
{
[self.window close];
......@@ -182,7 +191,7 @@ NSInteger const NICKNAME_TAG = 1;
- (void) shareByEmail
{
NSMutableArray *shareItems = [[NSMutableArray alloc] initWithObjects:[nickname stringValue], nil];
NSMutableArray *shareItems = [[NSMutableArray alloc] initWithObjects:[nicknameField stringValue], nil];
NSSharingService* emailSharingService = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];
[emailSharingService performWithItems:shareItems];
}
......@@ -298,14 +307,7 @@ NSInteger const NICKNAME_TAG = 1;
}
// else it is NICKNAME_TAG field
if ([textField.stringValue isEqualToString:@""]) {
[createButton setEnabled:NO];
} else {
[createButton setEnabled:YES];
}
accountToCreate->setAlias([textField.stringValue UTF8String]);
accountToCreate->setDisplayName([textField.stringValue UTF8String]);
[self toggleCreateButton:textField.stringValue];
}
# pragma NSWindowDelegate methods
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="RingWizardWC">
......@@ -11,7 +11,7 @@
<outlet property="createButton" destination="rC1-mU-Scu" id="JrT-qi-fF5"/>
<outlet property="goToAppButton" destination="hKA-b6-heE" id="voO-WW-sdE"/>
<outlet property="indicationLabel" destination="PZB-UI-B3R" id="t79-DV-rKR"/>
<outlet property="nickname" destination="Phj-na-SP1" id="HYj-kV-lyE"/>
<outlet property="nicknameField" destination="Phj-na-SP1" id="e9d-3N-z9N"/>
<outlet property="passwordField" destination="1nU-BV-LdG" id="1fI-Xa-L9w"/>
<outlet property="progressBar" destination="nRx-qJ-VIe" id="qJ2-ra-GkK"/>
<outlet property="pvkContainer" destination="he3-z9-OHD" id="rmf-aA-Lv6"/>
......@@ -31,7 +31,7 @@
<rect key="frame" x="0.0" y="5" width="480" height="173"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rAn-Kv-PgL">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rAn-Kv-PgL">
<rect key="frame" x="18" y="117" width="231" height="36"/>
<textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Welcome to Ring" id="uqu-uh-Wao">
<font key="font" metaFont="system" size="30"/>
......@@ -61,7 +61,7 @@ DQ
<constraint firstAttribute="width" constant="96" id="EN6-qO-gH1"/>
</constraints>
</progressIndicator>
<button hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hKA-b6-heE">
<button hidden="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hKA-b6-heE">
<rect key="frame" x="306" y="17" width="80" height="29"/>
<buttonCell key="cell" type="bevel" title="Continue" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Kwr-LJ-K8C">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment