Changeset 4455

Show
Ignore:
Timestamp:
01/30/07 18:29:03 (2 years ago)
Author:
morris
Message:

Don't close the chat window when disconnecting

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/PublicChat.nib/info.nib

    r4146 r4455  
    2323        </array> 
    2424        <key>IBSystem Version</key> 
    25         <string>8I127</string> 
     25        <string>8L127</string> 
    2626</dict> 
    2727</plist> 
  • WiredClient/trunk/English.lproj/ReleaseNotes.rtf

    r4439 r4455  
    1 {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf42
     1{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf41
    22{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;} 
    33{\colortbl;\red255\green255\blue255;\red126\green126\blue126;} 
     
    3333- Fix a problem with transfer queueing when adding multiple transfers at the same time\ 
    3434- Don't scroll chat to bottom after changing preferences\ 
     35- Don't close the chat window when disconnecting\ 
    3536- Localization updates 
    3637\f0\b \cf2 \ 
  • WiredClient/trunk/WCConnection.h

    r4439 r4455  
    130130 
    131131- (void)connect; 
    132 - (void)close
     132- (void)disconnect
    133133- (void)terminate; 
    134134 
  • WiredClient/trunk/WCConnectionController.h

    r4439 r4455  
    5252- (BOOL)isReleasedWhenClosed; 
    5353 
     54- (BOOL)beginConfirmDisconnectSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate didEndSelector:(SEL)selector contextInfo:(void *)contextInfo; 
     55 
    5456- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate; 
    5557- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate; 
  • WiredClient/trunk/WCConnectionController.m

    r4439 r4455  
    337337#pragma mark - 
    338338 
     339- (BOOL)beginConfirmDisconnectSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate didEndSelector:(SEL)selector contextInfo:(void *)contextInfo { 
     340        if([WCSettings boolForKey:WCConfirmDisconnect] && [[self connection] isConnected]) { 
     341                NSBeginAlertSheet(NSLS(@"Are you sure you want to disconnect?", @"Disconnect dialog title"), 
     342                                                  NSLS(@"Disconnect", @"Disconnect dialog button"), 
     343                                                  NSLS(@"Cancel", @"Disconnect dialog button title"), 
     344                                                  NULL, 
     345                                                  window, 
     346                                                  delegate, 
     347                                                  selector, 
     348                                                  NULL, 
     349                                                  contextInfo, 
     350                                                  NSLS(@"Disconnecting will close any ongoing file transfers.", @"Disconnect dialog description")); 
     351                 
     352                return NO; 
     353        } 
     354         
     355        return YES; 
     356} 
     357 
     358 
     359 
     360#pragma mark - 
     361 
    339362- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    340363} 
     
    343366 
    344367- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
     368} 
     369 
     370 
     371 
     372- (void)disconnectSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 
     373        if(returnCode == NSAlertDefaultReturn) 
     374                [[self connection] disconnect]; 
    345375} 
    346376 
     
    359389        connected = [[self connection] isConnected]; 
    360390         
    361         if(selector == @selector(reconnect:)) 
     391        if(selector == @selector(disconnect:)) 
     392                return (connected && ![[self connection] isDisconnecting]); 
     393        else if(selector == @selector(reconnect:)) 
    362394                return !connected; 
    363395        else if(selector == @selector(files:) || selector == @selector(postNews:) || selector == @selector(broadcast:)) 
     
    370402 
    371403- (IBAction)disconnect:(id)sender { 
    372         [[[[self connection] chat] window] performClose:self]; 
     404        if(![[self connection] isDisconnecting]) { 
     405                if([self beginConfirmDisconnectSheetModalForWindow:[[[self connection] chat] window] 
     406                                                                                         modalDelegate:self 
     407                                                                                        didEndSelector:@selector(disconnectSheetDidEnd:returnCode:contextInfo:) 
     408                                                                                           contextInfo:NULL]) { 
     409                        [[self connection] disconnect]; 
     410                } 
     411        } 
    373412} 
    374413 
  • WiredClient/trunk/WCLink.h

    r4439 r4455  
    5858 
    5959- (void)connect; 
    60 - (void)close
     60- (void)disconnect
    6161- (void)terminate; 
    6262- (void)sendCommand:(NSString *)command; 
  • WiredClient/trunk/WCLink.m

    r4439 r4455  
    145145 
    146146 
    147 - (void)close
     147- (void)disconnect
    148148        _closing = YES; 
    149149        _reading = NO; 
  • WiredClient/trunk/WCPublicChat.m

    r4439 r4455  
    214214 
    215215- (BOOL)windowShouldClose:(id)sender { 
    216         if([WCSettings boolForKey:WCConfirmDisconnect] && [[self connection] isConnected]) { 
    217                 NSBeginAlertSheet(NSLS(@"Are you sure you want to disconnect?", @"Disconnect dialog title"), 
    218                                                   NSLS(@"Disconnect", @"Disconnect dialog button"), 
    219                                                   NSLS(@"Cancel", @"Disconnect dialog button title"), 
    220                                                   NULL, 
    221                                                   [self window], 
    222                                                   self, 
    223                                                   @selector(disconnectSheetDidEnd:returnCode:contextInfo:), 
    224                                                   NULL, 
    225                                                   NULL, 
    226                                                   NSLS(@"Disconnecting will close any ongoing file transfers.", @"Disconnect dialog description")); 
    227  
    228                 return NO; 
    229         } 
    230  
    231         return YES; 
     216        return [self beginConfirmDisconnectSheetModalForWindow:[self window] 
     217                                                                                         modalDelegate:self 
     218                                                                                        didEndSelector:@selector(terminateSheetDidEnd:returnCode:contextInfo:) 
     219                                                                                           contextInfo:NULL]; 
    232220} 
    233221 
     
    316304                 
    317305                if([[self window] isVisible]) { 
    318                         [[NSNotificationCenter defaultCenter] postNotificationName:WCServerConnectionTriggeredEvent eventTag:WCEventsError]; 
    319                         [[error alert] beginSheetModalForWindow:[self window]]; 
     306                        if(![[self connection] isDisconnecting]) { 
     307                                [[NSNotificationCenter defaultCenter] postNotificationName:WCServerConnectionTriggeredEvent eventTag:WCEventsError]; 
     308                                [[error alert] beginSheetModalForWindow:[self window]]; 
     309                        } 
    320310 
    321311                        [self printEvent:[NSSWF:NSLS(@"Lost connection to %@", @"Disconnected chat message"), [[self connection] name]]]; 
     
    472462 
    473463 
    474 - (void)disconnectSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 
     464- (void)terminateSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 
    475465        if(returnCode == NSAlertDefaultReturn) 
    476466                [self close]; 
     
    537527- (BOOL)validateToolbarItem:(NSToolbarItem *)item { 
    538528        SEL                     selector; 
     529        BOOL            connected; 
    539530         
    540531        selector = [item action]; 
     532        connected = [[self connection] isConnected]; 
    541533         
    542534        if(selector == @selector(disconnect:)) 
    543                 return [NSApp isActive]
     535                return (connected && ![[self connection] isDisconnecting] && [NSApp isActive])
    544536        else if(selector == @selector(files:)) 
    545                 return [[self connection] isConnected]
     537                return connected
    546538 
    547539        return YES; 
  • WiredClient/trunk/WCServerConnection.h

    r4439 r4455  
    6666        BOOL                                                                                    _dismissingWindow; 
    6767        BOOL                                                                                    _closingWindow; 
     68        BOOL                                                                                    _disconnecting; 
    6869        BOOL                                                                                    _reconnecting; 
    6970        BOOL                                                                                    _hidden; 
     
    147148- (void)unhide; 
    148149 
     150- (BOOL)isDisconnecting; 
    149151- (BOOL)isReconnecting; 
    150152- (BOOL)isHidden; 
  • WiredClient/trunk/WCServerConnection.m

    r4439 r4455  
    430430                _loginFailed = YES; 
    431431                 
    432                 [_link close]; 
     432                [_link disconnect]; 
    433433        } 
    434434} 
     
    877877        _sentLogin              = NO; 
    878878        _loginFailed    = NO; 
     879        _disconnecting  = NO; 
    879880         
    880881        [self _connect]; 
     
    883884 
    884885 
    885 - (void)close { 
    886         [_link close]; 
     886- (void)disconnect { 
     887        _disconnecting = YES; 
     888         
     889        [_link disconnect]; 
    887890} 
    888891 
     
    944947 
    945948#pragma mark - 
     949 
     950- (BOOL)isDisconnecting { 
     951        return _disconnecting; 
     952} 
     953 
     954 
    946955 
    947956- (BOOL)isReconnecting { 
  • WiredClient/trunk/WCTrackerConnection.m

    r4439 r4455  
    336336 
    337337 
    338 - (void)close
    339         [_link close]; 
     338- (void)disconnect
     339        [_link disconnect]; 
    340340} 
    341341