Changeset 4460

Show
Ignore:
Timestamp:
01/31/07 15:44:12 (2 years ago)
Author:
morris
Message:

Add option to prevent multiple connections to the same host

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/Preferences.nib/classes.nib

    r4319 r4460  
    9898                "_postInChatButton" = NSButton;  
    9999                "_preferencesTabView" = NSTabView;  
     100                "_preventMultipleConnectionsButton" = NSButton;  
    100101                "_previewBackgroundColorWell" = NSColorWell;  
    101102                "_previewFontButton" = NSButton;  
  • WiredClient/trunk/English.lproj/Preferences.nib/info.nib

    r4165 r4460  
    1616        </array> 
    1717        <key>IBSystem Version</key> 
    18         <string>8I127</string> 
     18        <string>8L127</string> 
     19        <key>IBUserGuides</key> 
     20        <dict> 
     21                <key>5</key> 
     22                <dict> 
     23                        <key>guideLocations</key> 
     24                        <array> 
     25                                <string>Horizontal:234.000000</string> 
     26                        </array> 
     27                        <key>guidesLocked</key> 
     28                        <false/> 
     29                </dict> 
     30        </dict> 
    1931</dict> 
    2032</plist> 
  • WiredClient/trunk/English.lproj/ReleaseNotes.rtf

    r4458 r4460  
    3636- Automatically resume transfer when reconnecting after being disconnected\ 
    3737- Add a reconnect toolbar item\ 
     38- Add option to prevent multiple connections to the same host, and just showing that connection's windows instead\ 
    3839- Localization updates 
    3940\f0\b \cf2 \ 
  • WiredClient/trunk/French.lproj/Preferences.nib/classes.nib

    r4319 r4460  
    9898                "_postInChatButton" = NSButton;  
    9999                "_preferencesTabView" = NSTabView;  
     100                "_preventMultipleConnectionsButton" = NSButton;  
    100101                "_previewBackgroundColorWell" = NSColorWell;  
    101102                "_previewFontButton" = NSButton;  
  • WiredClient/trunk/French.lproj/Preferences.nib/info.nib

    r4151 r4460  
    1616        </array> 
    1717        <key>IBSystem Version</key> 
    18         <string>8I127</string> 
     18        <string>8L127</string> 
    1919</dict> 
    2020</plist> 
  • WiredClient/trunk/German.lproj/Preferences.nib/classes.nib

    r4319 r4460  
    9898                "_postInChatButton" = NSButton;  
    9999                "_preferencesTabView" = NSTabView;  
     100                "_preventMultipleConnectionsButton" = NSButton;  
    100101                "_previewBackgroundColorWell" = NSColorWell;  
    101102                "_previewFontButton" = NSButton;  
  • WiredClient/trunk/German.lproj/Preferences.nib/info.nib

    r4319 r4460  
    1111        <key>IBOldestOS</key> 
    1212        <integer>3</integer> 
     13        <key>IBOpenObjects</key> 
     14        <array> 
     15                <integer>5</integer> 
     16        </array> 
    1317        <key>IBSystem Version</key> 
    14         <string>8I127</string> 
     18        <string>8L127</string> 
    1519</dict> 
    1620</plist> 
  • WiredClient/trunk/Japanese.lproj/Preferences.nib/classes.nib

    r4319 r4460  
    103103                "_postInChatButton" = NSButton;  
    104104                "_preferencesTabView" = NSTabView;  
     105                "_preventMultipleConnectionsButton" = NSButton;  
    105106                "_previewBackgroundColorWell" = NSColorWell;  
    106107                "_previewFontButton" = NSButton;  
  • WiredClient/trunk/Japanese.lproj/Preferences.nib/info.nib

    r4319 r4460  
    1616        </array> 
    1717        <key>IBSystem Version</key> 
    18         <string>8I127</string> 
     18        <string>8L127</string> 
    1919</dict> 
    2020</plist> 
  • WiredClient/trunk/WCApplicationController.m

    r4439 r4460  
    6464 
    6565- (void)_connectWithBookmark:(NSDictionary *)bookmark; 
     66- (BOOL)_openConnectionWithURL:(WIURL *)url; 
    6667 
    6768@end 
     
    230231        [url setPassword:password ? password : @""]; 
    231232         
    232         connection = [WCServerConnection serverConnectionWithURL:url bookmark:bookmark]; 
    233          
    234         [connection showWindow:self]; 
    235         [connection connect]; 
    236  
     233        if(![self _openConnectionWithURL:url]) { 
     234                connection = [WCServerConnection serverConnectionWithURL:url bookmark:bookmark]; 
     235         
     236                [connection showWindow:self]; 
     237                [connection connect]; 
     238        } 
     239
     240 
     241 
     242 
     243- (BOOL)_openConnectionWithURL:(WIURL *)url { 
     244        WCServerConnection              *connection; 
     245         
     246        if([WCSettings boolForKey:WCPreventMultipleConnections]) { 
     247                connection = [[WCDock dock] connectionWithURL:url]; 
     248                 
     249                if(connection) { 
     250                        [[WCDock dock] openConnection:connection]; 
     251                         
     252                        return YES; 
     253                } 
     254        } 
     255         
     256        return NO; 
    237257} 
    238258 
     
    370390 
    371391- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { 
    372         if([WCSettings boolForKey:WCConfirmDisconnect] && [[WCDock dock] openConnections] > 0) 
     392        if([WCSettings boolForKey:WCConfirmDisconnect] && [[WCDock dock] connectedConnections] > 0) 
    373393                return [(WIApplication *) NSApp runTerminationDelayPanelWithTimeInterval:30.0]; 
    374394 
     
    475495 
    476496        if([[url scheme] isEqualToString:@"wired"]) { 
    477                 connection = [WCServerConnection serverConnectionWithURL:url]; 
    478          
    479                 [connection showWindow:self]; 
    480                 [connection connect]; 
     497                if(![self _openConnectionWithURL:url]) { 
     498                        connection = [WCServerConnection serverConnectionWithURL:url]; 
     499         
     500                        [connection showWindow:self]; 
     501                        [connection connect]; 
     502                } 
    481503        } 
    482504        else if([[url scheme] isEqualToString:@"wiredtracker"]) { 
  • WiredClient/trunk/WCDock.h

    r4439 r4460  
    5454+ (WCDock *)dock; 
    5555 
    56 - (unsigned int)openConnections; 
     56- (void)openConnection:(WCServerConnection *)connection; 
     57- (WCServerConnection *)connectionWithURL:(WIURL *)url; 
     58- (unsigned int)connectedConnections; 
    5759 
    5860- (IBAction)open:(id)sender; 
  • WiredClient/trunk/WCDock.m

    r4439 r4460  
    350350#pragma mark - 
    351351 
    352 - (unsigned int)openConnections { 
     352- (void)openConnection:(WCServerConnection *)connection { 
     353        [self _openConnection:connection]; 
     354
     355 
     356 
     357 
     358- (WCServerConnection *)connectionWithURL:(WIURL *)url { 
     359        NSEnumerator            *enumerator; 
     360        WCServerConnection      *connection; 
     361         
     362        enumerator = [_shownConnections objectEnumerator]; 
     363         
     364        while((connection = [enumerator nextObject])) { 
     365                if([url isEqual:[connection URL]]) 
     366                        return connection; 
     367        } 
     368         
     369        return NULL; 
     370
     371 
     372 
     373 
     374- (unsigned int)connectedConnections { 
    353375        NSEnumerator            *enumerator; 
    354376        WCServerConnection      *connection; 
  • WiredClient/trunk/WCPreferences.h

    r4439 r4460  
    3939        IBOutlet NSButton                                       *_showTrackersAtStartupButton; 
    4040        IBOutlet NSButton                                       *_autoHideOnSwitchButton; 
     41        IBOutlet NSButton                                       *_preventMultipleConnectionsButton; 
    4142        IBOutlet NSButton                                       *_confirmDisconnectButton; 
    4243         
  • WiredClient/trunk/WCPreferences.m

    r4439 r4460  
    335335 
    336336        [_autoHideOnSwitchButton setState:[WCSettings boolForKey:WCAutoHideOnSwitch]]; 
     337        [_preventMultipleConnectionsButton setState:[WCSettings boolForKey:WCPreventMultipleConnections]]; 
    337338        [_confirmDisconnectButton setState:[WCSettings boolForKey:WCConfirmDisconnect]]; 
    338339         
     
    435436 
    436437        [WCSettings setBool:[_autoHideOnSwitchButton state] forKey:WCAutoHideOnSwitch]; 
     438        [WCSettings setBool:[_preventMultipleConnectionsButton state] forKey:WCPreventMultipleConnections]; 
    437439        [WCSettings setBool:[_confirmDisconnectButton state] forKey:WCConfirmDisconnect]; 
    438440         
  • WiredClient/trunk/WCServerConnection.m

    r4455 r4460  
    3434#import "WCCache.h" 
    3535#import "WCConsole.h" 
     36#import "WCDock.h" 
    3637#import "WCLink.h" 
    3738#import "WCMessages.h" 
     
    378379        [_link release]; 
    379380        _link = NULL; 
     381         
     382        [self autorelease]; 
    380383} 
    381384 
  • WiredClient/trunk/WCSettings.h

    r4439 r4460  
    3838 
    3939#define WCAutoHideOnSwitch                                              @"WCAutoHideOnSwitch" 
     40#define WCPreventMultipleConnections                    @"WCPreventMultipleConnections" 
    4041#define WCConfirmDisconnect                                             @"WCConfirmDisconnect" 
    4142 
  • WiredClient/trunk/WCSettings.m

    r4439 r4460  
    176176                        WCAutoHideOnSwitch, 
    177177                [NSNumber numberWithBool:YES], 
     178                        WCPreventMultipleConnections, 
     179                [NSNumber numberWithBool:YES], 
    178180                        WCConfirmDisconnect, 
    179181                 
  • WiredClient/trunk/WCTrackers.m

    r4439 r4460  
    479479                        } 
    480480                } 
    481         } else { 
    482                 NSLog(@"expand %@", tracker); 
    483481        } 
    484482} 
     
    497495- (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreComing { 
    498496        [netService setDelegate:self]; 
    499         [netService resolve]; 
     497        [netService resolveWithTimeout:5.0]; 
    500498 
    501499        [_bonjourTracker addChild:[WCTracker bonjourServerWithNetService:netService]];