Skip to content
Snippets Groups Projects
Commit 76d59690 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

wizard: fix wizard cancellation

wrong redirection to main window if user do not create his account

Tuleap: #255
Change-Id: Ib984525610ede06084c2625de819b3112604dfde
parent c0657f46
No related branches found
No related tags found
No related merge requests found
......@@ -26,5 +26,6 @@
- (void) showWizard;
- (void) showMainWindow;
- (BOOL) checkForRingAccount;
@end
......@@ -140,7 +140,7 @@
if(self.wizard == nil) {
self.wizard = [[RingWizardWC alloc] initWithWindowNibName:@"RingWizard"];
}
[self.wizard.window orderFront:self];
[self.wizard.window makeKeyAndOrderFront:self];
}
- (void) showMainWindow
......@@ -148,9 +148,6 @@
if(self.ringWindowController == nil) {
self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow"];
}
self.wizard = nil;
[self.ringWindowController.window makeKeyAndOrderFront:self];
}
......@@ -160,7 +157,7 @@
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) {
if(acc->protocol() == Account::Protocol::RING && !acc->isNew()) {
if (acc->displayName().isEmpty())
acc->setDisplayName(acc->alias());
foundRingAcc = YES;
......@@ -222,20 +219,25 @@
- (void)handleQuitEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
delete CallModel::instance().QObject::parent();
[[NSApplication sharedApplication] terminate:self];
[self cleanExit];
}
-(void)applicationWillTerminate:(NSNotification *)notification
{
[self cleanExit];
}
- (void) cleanExit
{
[self.wizard close];
[self.ringWindowController close];
delete CallModel::instance().QObject::parent();
[[NSApplication sharedApplication] terminate:self];
}
#if ENABLE_SPARKLE
#pragma mark -
#pragma mark Sparkle delegate
#pragma mark - Sparkle delegate
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update
{
......
......@@ -61,7 +61,9 @@ NSInteger const NICKNAME_TAG = 1;
[self.window makeKeyAndOrderFront:nil];
[self.window setLevel:NSStatusWindowLevel];
[self.window makeMainWindow];
if(![self checkForRingAccount]) {
AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
if(![appDelegate checkForRingAccount]) {
accountToCreate = AccountModel::instance().add("", Account::Protocol::RING);
} else {
[indicationLabel setStringValue:NSLocalizedString(@"Ring is already ready to work",
......@@ -75,18 +77,6 @@ NSInteger const NICKNAME_TAG = 1;
[pvkPathControl setDelegate:self];
}
- (BOOL) checkForRingAccount
{
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;
}
}
return false;
}
- (void) displayHash:(NSString* ) hash
{
[nickname setFrameSize:NSMakeSize(400, nickname.frame.size.height)];
......@@ -323,7 +313,9 @@ NSInteger const NICKNAME_TAG = 1;
- (void)windowWillClose:(NSNotification *)notification
{
AppDelegate *appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate];
[appDelegate showMainWindow];
if ([appDelegate checkForRingAccount]) {
[appDelegate showMainWindow];
}
}
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment