Changeset 3996

Show
Ignore:
Timestamp:
03/28/06 20:01:55 (3 years ago)
Author:
morris
Message:

Add Restore All Layouts To Default command

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/Localizable.strings

    r3964 r3996  
    164164   Delete ignore dialog button title 
    165165   Delete file button title 
     166   Restore all layouts to default dialog button title 
    166167   Disconnect dialog button title 
    167168   Delete account dialog button title 
     
    292293"File or Folder Not Found" = "File or Folder Not Found"; 
    293294 
     295/* File plural */ 
     296"files" = "files"; 
     297 
    294298/* Files toolbar item */ 
    295299"Files" = "Files"; 
    296  
    297 /* File plural */ 
    298 "files" = "files"; 
    299300 
    300301/* Transfer finished (files, transferred, speed, time) */ 
     
    365366"Message Received" = "Message Received"; 
    366367 
     368/* Message plural */ 
     369"messages" = "messages"; 
     370 
    367371/* Messages toolbar item 
    368372   Messages window title */ 
    369373"Messages" = "Messages"; 
    370374 
    371 /* Message plural */ 
    372 "messages" = "messages"; 
    373  
    374375/* News toolbar item 
    375376   News window title */ 
     
    382383"No" = "No"; 
    383384 
    384 /* Make layout default dialog button title 
     385/* Restore all layouts to default dialog button title 
     386   Make layout default dialog button title 
    385387   Restore layout to default dialog button title */ 
    386388"OK" = "OK"; 
     
    409411/* Ping received message (interval) */ 
    410412"Received ping reply after %.2fms" = "Received ping reply after %.2fms"; 
     413 
     414/* Restore all layouts to default dialog title */ 
     415"Restore All Layouts To Default?" = "Restore All Layouts To Default?"; 
    411416 
    412417/* Restore layout to default dialog title */ 
     
    500505"The transfer of \"%@\" failed." = "The transfer of \"%@\" failed."; 
    501506 
    502 /* Clear news dialog description 
    503    Delete ignore dialog description 
     507/* Delete ignore dialog description 
     508   Delete tracker bookmark dialog description 
     509   Clear news dialog description 
     510   Delete bookmark dialog description 
     511   Clear messages dialog description 
     512   Delete file dialog description 
    504513   Delete account dialog description 
    505    Make layout default dialog button description 
    506    Delete file dialog description 
    507    Delete highlight dialog description 
    508    Restore layout to default dialog button description 
    509    Delete tracker bookmark dialog description 
    510    Delete bookmark dialog description 
    511    Clear messages dialog description */ 
     514   Delete highlight dialog description */ 
    512515"This cannot be undone." = "This cannot be undone."; 
    513516 
    514517/* WCWiredClientProtocolMismatch description */ 
    515518"This server uses a newer protocol version than this client supports. Protocol errors may occur during the connection." = "This server uses a newer protocol version than this client supports. Protocol errors may occur during the connection."; 
     519 
     520/* Restore all layouts to default dialog button description */ 
     521"This will restore all windows for all connections to the previously saved default layout." = "This will restore all windows for all connections to the previously saved default layout."; 
     522 
     523/* Restore layout to default dialog button description */ 
     524"This will restore all windows for the currently shown connection to the previously saved default layout." = "This will restore all windows for the currently shown connection to the previously saved default layout."; 
     525 
     526/* Make layout default dialog button description */ 
     527"This will set the windows for the currently shown connection as the default layout." = "This will set the windows for the currently shown connection as the default layout."; 
    516528 
    517529/* Message to (nick) */ 
  • WiredClient/trunk/English.lproj/MainMenu.nib/classes.nib

    r3963 r3996  
    4949                preferences = id;  
    5050                previousConnection = id;  
     51                restoreAllLayoutsToDefault = id;  
    5152                restoreLayoutToDefault = id;  
    5253                showDock = id;  
  • WiredClient/trunk/WCAccounts.m

    r3977 r3996  
    251251 
    252252- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    253         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCAccountsWindow"]]; 
     253        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCAccountsWindow"] restoreSize:YES visibility:![self isHidden]]; 
    254254        [_accountsTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCAccountsTableView"]]; 
    255255} 
  • WiredClient/trunk/WCApplicationController.h

    r3963 r3996  
    6262- (IBAction)makeLayoutDefault:(id)sender; 
    6363- (IBAction)restoreLayoutToDefault:(id)sender; 
     64- (IBAction)restoreAllLayoutsToDefault:(id)sender; 
    6465 
    6566- (IBAction)manual:(id)sender; 
  • WiredClient/trunk/WCApplicationController.m

    r3963 r3996  
    302302           selector == @selector(previousConnection:) || 
    303303           selector == @selector(makeLayoutDefault:) || 
    304            selector == @selector(restoreLayoutToDefault:)) 
     304           selector == @selector(restoreLayoutToDefault:) || 
     305           selector == @selector(restoreAllLayoutsToDefault:)) 
    305306                return [[WCDock dock] validateMenuItem:item]; 
    306307         
     
    512513 
    513514 
     515- (IBAction)restoreAllLayoutsToDefault:(id)sender { 
     516        [[WCDock dock] restoreAllLayoutsToDefault:sender]; 
     517} 
     518 
     519 
     520 
    514521#pragma mark - 
    515522 
  • WiredClient/trunk/WCConnectionController.h

    r3977 r3996  
    3333         
    3434        BOOL                                    _hidden; 
     35        BOOL                                    _wasVisible; 
    3536        BOOL                                    _releasedWhenClosed; 
    3637} 
     
    4142 
    4243- (NSDictionary *)windowTemplate; 
     44- (BOOL)isHidden; 
    4345 
    4446- (void)setName:(NSString *)name; 
     
    4648- (void)setConnection:(WCServerConnection *)connection; 
    4749- (WCServerConnection *)connection; 
    48 - (void)setHidden:(BOOL)value; 
    49 - (BOOL)isHidden; 
    5050- (void)setReleasedWhenClosed:(BOOL)value; 
    5151- (BOOL)isReleasedWhenClosed; 
  • WiredClient/trunk/WCConnectionController.m

    r3977 r3996  
    220220 
    221221- (void)_serverConnectionShouldHide:(NSNotification *)notification { 
    222         _hidden = ![[self window] isOnScreen]; 
     222        _wasVisible = [[self window] isVisible]; 
     223        _hidden = YES; 
    223224 
    224225        [[self window] orderOut:self]; 
     
    228229 
    229230- (void)_serverConnectionShouldUnhide:(NSNotification *)notification { 
    230         if(!_hidden
     231        if(_wasVisible
    231232                [[self window] orderFront:self]; 
     233 
     234        _hidden = NO; 
    232235} 
    233236 
     
    267270 
    268271 
     272- (BOOL)isHidden { 
     273        return _hidden; 
     274} 
     275 
     276 
     277 
    269278#pragma mark - 
    270279 
     
    295304- (WCServerConnection *)connection { 
    296305        return _connection; 
    297 } 
    298  
    299  
    300  
    301 - (void)setHidden:(BOOL)value { 
    302         _hidden = value; 
    303 } 
    304  
    305  
    306  
    307 - (BOOL)isHidden { 
    308         return _hidden; 
    309306} 
    310307 
  • WiredClient/trunk/WCConsole.m

    r3977 r3996  
    136136 
    137137- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    138         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCConsoleWindow"]]; 
     138        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCConsoleWindow"] restoreSize:YES visibility:![self isHidden]]; 
    139139} 
    140140 
  • WiredClient/trunk/WCDock.h

    r3963 r3996  
    6565- (IBAction)makeLayoutDefault:(id)sender; 
    6666- (IBAction)restoreLayoutToDefault:(id)sender; 
     67- (IBAction)restoreAllLayoutsToDefault:(id)sender; 
    6768 
    6869@end 
  • WiredClient/trunk/WCDock.m

    r3963 r3996  
    340340                return ([[[NSApp keyWindow] windowController] isKindOfClass:[WCConnectionController class]] && 
    341341                                [WCSettings windowTemplateForKey:WCWindowTemplatesDefault] != NULL); 
     342        else if(selector == @selector(restoreAllLayoutsToDefault:)) 
     343                return ([_shownConnections count] > 0 && [WCSettings windowTemplateForKey:WCWindowTemplatesDefault] != NULL); 
    342344 
    343345        return YES; 
     
    481483                                                  alternateButton:NULL 
    482484                                                          otherButton:NSLS(@"Cancel", @"Make layout default dialog button title") 
    483                                 informativeTextWithFormat:NSLS(@"This cannot be undone.", @"Make layout default dialog button description")]; 
     485                                informativeTextWithFormat:NSLS(@"This will set the windows for the currently shown connection as the default layout.", @"Make layout default dialog button description")]; 
    484486         
    485487        if([alert runModal] == NSAlertDefaultReturn) { 
     
    502504                                                  alternateButton:NULL 
    503505                                                          otherButton:NSLS(@"Cancel", @"Restore layout to default dialog button title") 
    504                                 informativeTextWithFormat:NSLS(@"This cannot be undone.", @"Restore layout to default dialog button description")]; 
     506                                informativeTextWithFormat:NSLS(@"This will restore all windows for the currently shown connection to the previously saved default layout.", @"Restore layout to default dialog button description")]; 
    505507 
    506508        if([alert runModal] == NSAlertDefaultReturn) { 
     
    511513                 
    512514                [connection postNotificationName:WCServerConnectionShouldLoadWindowTemplate]; 
     515        } 
     516} 
     517 
     518 
     519 
     520- (IBAction)restoreAllLayoutsToDefault:(id)sender { 
     521        NSAlert                         *alert; 
     522        WCServerConnection      *connection; 
     523        unsigned int            i, count; 
     524         
     525        alert = [NSAlert alertWithMessageText:NSLS(@"Restore All Layouts To Default?", @"Restore all layouts to default dialog title") 
     526                                                        defaultButton:NSLS(@"OK", @"Restore all layouts to default dialog button title") 
     527                                                  alternateButton:NULL 
     528                                                          otherButton:NSLS(@"Cancel", @"Restore all layouts to default dialog button title") 
     529                                informativeTextWithFormat:NSLS(@"This will restore all windows for all connections to the previously saved default layout.", @"Restore all layouts to default dialog button description")]; 
     530 
     531        if([alert runModal] == NSAlertDefaultReturn) { 
     532                count = [_shownConnections count]; 
     533                 
     534                for(i = 0; i < count; i++) { 
     535                        connection = [_shownConnections objectAtIndex:i]; 
     536                         
     537                        [WCSettings setWindowTemplate:[WCSettings windowTemplateForKey:WCWindowTemplatesDefault] 
     538                                                                   forKey:[connection identifier]]; 
     539                         
     540                        [connection postNotificationName:WCServerConnectionShouldLoadWindowTemplate]; 
     541                } 
    513542        } 
    514543} 
  • WiredClient/trunk/WCMessages.m

    r3977 r3996  
    495495 
    496496- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    497         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesWindow"]]; 
     497        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesWindow"] restoreSize:YES visibility:![self isHidden]]; 
    498498        [_conversationsSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesConversationsSplitView"]]; 
    499499        [_messagesSplitView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCMessagesMessagesSplitView"]]; 
  • WiredClient/trunk/WCNews.m

    r3977 r3996  
    181181 
    182182- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    183         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCNewsWindow"]]; 
     183        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCNewsWindow"] restoreSize:YES visibility:![self isHidden]]; 
    184184} 
    185185 
  • WiredClient/trunk/WCPublicChat.m

    r3977 r3996  
    241241 
    242242- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    243         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCChatWindow"]]; 
     243        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCChatWindow"] restoreSize:YES visibility:![self isHidden]]; 
    244244         
    245245        [super windowTemplateShouldLoad:windowTemplate]; 
  • WiredClient/trunk/WCSearch.m

    r3986 r3996  
    269269 
    270270- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    271         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCSearchWindow"]]; 
     271        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCSearchWindow"] restoreSize:YES visibility:![self isHidden]]; 
    272272        [_searchTableView setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCSearchTableView"]]; 
    273273} 
  • WiredClient/trunk/WCServerInfo.m

    r3977 r3996  
    185185 
    186186- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    187         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCServerInfoWindow"]]; 
     187        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCServerInfoWindow"] restoreSize:NO visibility:![self isHidden]]; 
    188188} 
    189189 
     
    191191 
    192192- (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 
    193         [windowTemplate setObject:[[self window] propertiesDictionaryWithoutFrameSize] forKey:@"WCServerInfoWindow"]; 
     193        [windowTemplate setObject:[[self window] propertiesDictionary] forKey:@"WCServerInfoWindow"]; 
    194194} 
    195195 
  • WiredClient/trunk/WCTrackers.m

    r3994 r3996  
    452452 
    453453        tracker = [self _selectedTracker]; 
    454         url = [tracker URL]; 
    455  
    456         if(!url && [tracker netService]) { 
    457                 address = [WIAddress addressWithNetService:[tracker netService] error:&error]; 
     454         
     455        if([tracker type] == WCTrackerServer) { 
     456                url = [tracker URL]; 
    458457                 
    459                 if(address) 
    460                         url = [WIURL URLWithScheme:@"wired" host:[address string] port:[address port]]; 
    461                 else 
    462                         [[error alert] beginSheetModalForWindow:[self window] modalDelegate:NULL didEndSelector:NULL contextInfo:NULL]; 
    463         } 
    464  
    465         if(url) { 
    466                 if([[url scheme] isEqualToString:@"wired"]) { 
    467                         connection = [WCServerConnection serverConnectionWithURL:url]; 
    468  
    469                         [connection showWindow:self]; 
    470  
    471                         if(([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) == 0) 
    472                                 [connection connect]; 
     458                if(!url && [tracker netService]) { 
     459                        address = [WIAddress addressWithNetService:[tracker netService] error:&error]; 
     460                         
     461                        if(address) 
     462                                url = [WIURL URLWithScheme:@"wired" host:[address string] port:[address port]]; 
     463                        else 
     464                                [[error alert] beginSheetModalForWindow:[self window] modalDelegate:NULL didEndSelector:NULL contextInfo:NULL]; 
    473465                } 
     466                 
     467                if(url) { 
     468                        if([[url scheme] isEqualToString:@"wired"]) { 
     469                                connection = [WCServerConnection serverConnectionWithURL:url]; 
     470                                 
     471                                [connection showWindow:self]; 
     472                                 
     473                                if(([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) == 0) 
     474                                        [connection connect]; 
     475                        } 
     476                } 
     477        } else { 
     478                NSLog(@"expand %@", tracker); 
    474479        } 
    475480} 
  • WiredClient/trunk/WCTransfers.m

    r3977 r3996  
    10601060 
    10611061- (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 
    1062         [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCTransfersWindow"]]; 
     1062        [[self window] setPropertiesFromDictionary:[windowTemplate objectForKey:@"WCTransfersWindow"] restoreSize:YES visibility:![self isHidden]]; 
    10631063} 
    10641064