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

fix: creation SIP account

Change-Id: I90a5c57ebfa67011ab75843e0803956713f3058c
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 0f699814
......@@ -208,6 +208,7 @@ typedef NS_ENUM(NSInteger, TagViews) {
{
if([userNameField isEditable]) {
[self setEditingMode:NO];
[self saveAccount];
return;
}
[self setEditingMode:YES];
......@@ -239,7 +240,6 @@ typedef NS_ENUM(NSInteger, TagViews) {
[editAccountButton setTitle:@"Done"];
return;
}
[self saveAccount];
[editAccountButton setTitle:@"Edit Account"];
[self.view resignFirstResponder];
}
......
......@@ -21,7 +21,7 @@
#import "LrcModelsProtocol.h"
@protocol AddSIPAccountDelegate <NSObject>
- (void)close;
- (void)didCreateAccountWithSuccess:(BOOL)success;
- (void)showView:(NSView*)view;
@end
......
......@@ -71,7 +71,7 @@ NSTimer* timeoutTimer;
- (IBAction)cancel:(id)sender
{
[self.delegate close];
[self.delegate didCreateAccountWithSuccess: NO];
}
- (IBAction)addAccount:(id)sender
......@@ -82,9 +82,6 @@ NSTimer* timeoutTimer;
accountCreated = QObject::connect(self.accountModel,
&lrc::api::NewAccountModel::accountAdded,
[self] (const std::string& accountID) {
if(accountID.compare(accountToCreate) != 0) {
return;
}
if([photoView image]) {
NSImage *avatarImage = [photoView image];
auto imageToBytes = QByteArray::fromNSData([avatarImage TIFFRepresentation]).toBase64();
......@@ -98,14 +95,11 @@ NSTimer* timeoutTimer;
if(![passwordField.stringValue isEqualToString:@""]) {
accountProperties.password = [passwordField.stringValue UTF8String];
}
if(![userNameField.stringValue isEqualToString:@""]) {
accountProperties.username = [userNameField.stringValue UTF8String];
}
self.accountModel->setAccountConfig(accountID, accountProperties);
QObject::disconnect(accountCreated);
[self.delegate close];
[self.delegate didCreateAccountWithSuccess: YES];
});
accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [@"SIP" UTF8String]);
accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::SIP, [displayName UTF8String], "", "", "", [userNameField.stringValue UTF8String]);
timeoutTimer = [NSTimer scheduledTimerWithTimeInterval:5
target:self
......@@ -115,7 +109,7 @@ NSTimer* timeoutTimer;
-(void) addingAccountTimeout {
QObject::disconnect(accountCreated);
[self.delegate close];
[self.delegate didCreateAccountWithSuccess: YES];
}
......
......@@ -236,10 +236,4 @@
}
}
#pragma - AddSIPAccountDelegate methods
- (void)close {
[self showChooseWithCancelButton: isCancelable andAdvanced: withAdvanced];
}
@end
......@@ -133,7 +133,7 @@
<constraint firstAttribute="width" constant="240" id="GC7-gX-zlF"/>
<constraint firstAttribute="height" constant="20" id="tSi-eE-dyL"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" drawsBackground="YES" id="zmU-E8-9jO">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" drawsBackground="YES" id="zmU-E8-9jO">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
......@@ -178,7 +178,10 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kve-vV-IWV">
<rect key="frame" x="120" y="140" width="240" height="17"/>
<rect key="frame" x="120" y="140" width="240" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="1NU-Tg-a6A"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" drawsBackground="YES" id="9q6-1c-CYo">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
......
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