Changeset 4466
- Timestamp:
- 02/01/07 11:32:55 (2 years ago)
- Files:
-
- WiredClient/trunk/WCChat.m (modified) (1 diff)
- WiredClient/trunk/WCConnectionController.h (modified) (2 diffs)
- WiredClient/trunk/WCConnectionController.m (modified) (9 diffs)
- WiredClient/trunk/WCFiles.m (modified) (1 diff)
- WiredClient/trunk/WCMessages.m (modified) (2 diffs)
- WiredClient/trunk/WCNews.m (modified) (1 diff)
- WiredClient/trunk/WCPublicChat.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCChat.m
r4439 r4466 1539 1539 1540 1540 - (void)topicSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 1541 if(returnCode == NS RunStoppedResponse) {1541 if(returnCode == NSAlertDefaultReturn) { 1542 1542 [[self connection] sendCommand:WCTopicCommand 1543 1543 withArgument:[NSSWF:@"%u", [self chatID]] WiredClient/trunk/WCConnectionController.h
r4455 r4466 42 42 - (id)initWithWindowNibName:(NSString *)windowNibName name:(NSString *)name connection:(WCServerConnection *)connection; 43 43 44 - ( NSDictionary *)windowTemplate;45 - ( BOOL)isHidden;44 - (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate; 45 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate; 46 46 47 47 - (void)setName:(NSString *)name; … … 51 51 - (void)setReleasedWhenClosed:(BOOL)value; 52 52 - (BOOL)isReleasedWhenClosed; 53 - (NSDictionary *)windowTemplate; 54 - (BOOL)isHidden; 53 55 54 56 - (BOOL)beginConfirmDisconnectSheetModalForWindow:(NSWindow *)window modalDelegate:(id)delegate didEndSelector:(SEL)selector contextInfo:(void *)contextInfo; 55 56 - (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate;57 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate;58 57 59 58 - (IBAction)disconnect:(id)sender; WiredClient/trunk/WCConnectionController.m
r4457 r4466 84 84 } 85 85 86 87 88 #pragma mark - 89 90 - (void)_WC_applicationWillTerminate:(NSNotification *)notification { 91 [self _saveWindowTemplate]; 92 } 93 94 95 96 - (void)_WC_windowWillClose:(NSNotification *)notification { 97 if([self isReleasedWhenClosed]) { 98 [self _saveWindowTemplate]; 99 100 [self autorelease]; 101 } 102 } 103 104 105 106 - (void)_serverConnectionShouldLoadWindowTemplate:(NSNotification *)notification { 107 [self _loadWindowTemplate]; 108 } 109 110 111 112 - (void)_serverConnectionShouldSaveWindowTemplate:(NSNotification *)notification { 113 [self _saveWindowTemplate]; 114 } 115 116 117 118 - (void)_connectionWillTerminate:(NSNotification *)notification { 119 [self _saveWindowTemplate]; 120 } 121 122 123 124 - (void)_connectionDidTerminate:(NSNotification *)notification { 125 [_connection removeObserver:self]; 126 _connection = NULL; 127 } 128 129 130 131 - (void)_serverConnectionShouldHide:(NSNotification *)notification { 132 NSWindow *sheet; 133 134 _wasVisible = [[self window] isVisible]; 135 _hidden = YES; 136 137 if(_wasVisible) { 138 sheet = [[self window] attachedSheet]; 139 140 if(sheet) 141 [NSApp endSheet:sheet returnCode:NSAlertAlternateReturn]; 142 143 [[self window] orderOut:self]; 144 } 145 } 146 147 148 149 - (void)_serverConnectionShouldUnhide:(NSNotification *)notification { 150 if(_wasVisible) 151 [[self window] orderFront:self]; 152 153 _hidden = NO; 154 } 155 156 157 158 159 - (void)_disconnectSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 160 if(returnCode == NSAlertDefaultReturn) 161 [[self connection] disconnect]; 162 } 163 86 164 @end 87 165 … … 107 185 108 186 [_connection addObserver:self 187 selector:@selector(_serverConnectionShouldLoadWindowTemplate:) 188 name:WCServerConnectionShouldLoadWindowTemplate]; 189 190 [_connection addObserver:self 191 selector:@selector(_serverConnectionShouldSaveWindowTemplate:) 192 name:WCServerConnectionShouldSaveWindowTemplate]; 193 194 [_connection addObserver:self 109 195 selector:@selector(_connectionWillTerminate:) 110 196 name:WCConnectionWillTerminate]; … … 122 208 name:WCServerConnectionShouldUnhide]; 123 209 124 [_connection addObserver:self125 selector:@selector(_serverConnectionShouldLoadWindowTemplate:)126 name:WCServerConnectionShouldLoadWindowTemplate];127 128 [_connection addObserver:self129 selector:@selector(_serverConnectionShouldSaveWindowTemplate:)130 name:WCServerConnectionShouldSaveWindowTemplate];131 132 210 if([self respondsToSelector:@selector(connectionDidConnect:)]) { 133 211 [_connection addObserver:self … … 183 261 name:WCServerConnectionPrivilegesDidChange]; 184 262 } 185 263 186 264 return self; 187 265 } … … 199 277 200 278 [super dealloc]; 201 }202 203 204 205 #pragma mark -206 207 - (void)_WC_applicationWillTerminate:(NSNotification *)notification {208 [self _saveWindowTemplate];209 }210 211 212 213 - (void)_WC_windowWillClose:(NSNotification *)notification {214 if([self isReleasedWhenClosed]) {215 [self _saveWindowTemplate];216 217 [self autorelease];218 }219 }220 221 222 223 - (void)_connectionWillTerminate:(NSNotification *)notification {224 [self _saveWindowTemplate];225 }226 227 228 229 - (void)_connectionDidTerminate:(NSNotification *)notification {230 [_connection removeObserver:self];231 _connection = NULL;232 }233 234 235 236 - (void)_serverConnectionShouldHide:(NSNotification *)notification {237 _wasVisible = [[self window] isVisible];238 _hidden = YES;239 240 [[self window] orderOut:self];241 }242 243 244 245 - (void)_serverConnectionShouldUnhide:(NSNotification *)notification {246 if(_wasVisible)247 [[self window] orderFront:self];248 249 _hidden = NO;250 }251 252 253 254 - (void)_serverConnectionShouldLoadWindowTemplate:(NSNotification *)notification {255 [self _loadWindowTemplate];256 }257 258 259 260 - (void)_serverConnectionShouldSaveWindowTemplate:(NSNotification *)notification {261 [self _saveWindowTemplate];262 279 } 263 280 … … 276 293 277 294 295 - (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate { 296 } 297 298 299 300 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 301 } 302 303 304 305 #pragma mark - 306 307 - (void)setName:(NSString *)name { 308 [name retain]; 309 [_name release]; 310 311 _name = name; 312 } 313 314 315 316 - (NSString *)name { 317 return _name; 318 } 319 320 321 322 - (void)setConnection:(WCServerConnection *)connection { 323 [connection retain]; 324 [_connection release]; 325 326 _connection = connection; 327 } 328 329 330 331 - (WCServerConnection *)connection { 332 return _connection; 333 } 334 335 336 337 - (void)setReleasedWhenClosed:(BOOL)value { 338 _releasedWhenClosed = value; 339 } 340 341 342 343 - (BOOL)isReleasedWhenClosed { 344 return _releasedWhenClosed; 345 } 346 347 348 278 349 - (NSDictionary *)windowTemplate { 279 350 if(!_windowTemplate) … … 287 358 - (BOOL)isHidden { 288 359 return _hidden; 289 }290 291 292 293 #pragma mark -294 295 - (void)setName:(NSString *)name {296 [name retain];297 [_name release];298 299 _name = name;300 }301 302 303 304 - (NSString *)name {305 return _name;306 }307 308 309 310 - (void)setConnection:(WCServerConnection *)connection {311 [connection retain];312 [_connection release];313 314 _connection = connection;315 }316 317 318 319 - (WCServerConnection *)connection {320 return _connection;321 }322 323 324 325 - (void)setReleasedWhenClosed:(BOOL)value {326 _releasedWhenClosed = value;327 }328 329 330 331 - (BOOL)isReleasedWhenClosed {332 return _releasedWhenClosed;333 360 } 334 361 … … 360 387 #pragma mark - 361 388 362 - (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate {363 }364 365 366 367 - (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];375 }376 377 378 379 #pragma mark -380 381 389 - (BOOL)validateMenuItem:(NSMenuItem *)item { 382 390 SEL selector; … … 405 413 if([self beginConfirmDisconnectSheetModalForWindow:[[[self connection] chat] window] 406 414 modalDelegate:self 407 didEndSelector:@selector( disconnectSheetDidEnd:returnCode:contextInfo:)415 didEndSelector:@selector(_disconnectSheetDidEnd:returnCode:contextInfo:) 408 416 contextInfo:NULL]) { 409 417 [[self connection] disconnect]; WiredClient/trunk/WCFiles.m
r4439 r4466 875 875 [_createFolderPanel close]; 876 876 877 if(returnCode == NS RunStoppedResponse) {877 if(returnCode == NSAlertDefaultReturn) { 878 878 path = [[[self _currentPath] path] stringByAppendingPathComponent:[_createFolderTextField stringValue]]; 879 879 WiredClient/trunk/WCMessages.m
r4439 r4466 837 837 838 838 - (void)broadcastSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 839 if(returnCode == NS RunStoppedResponse)839 if(returnCode == NSAlertDefaultReturn) 840 840 [[self connection] sendCommand:WCBroadcastCommand withArgument:[_broadcastTextView string]]; 841 841 … … 870 870 WCConversation *conversation; 871 871 872 if(returnCode == NS RunStoppedResponse) {872 if(returnCode == NSAlertDefaultReturn) { 873 873 message = [WCMessage messageToUser:user string:[[[_replyTextView string] copy] autorelease]]; 874 874 [_allMessages addObject:message]; WiredClient/trunk/WCNews.m
r4439 r4466 351 351 352 352 - (void)postSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 353 if(returnCode == NS RunStoppedResponse)353 if(returnCode == NSAlertDefaultReturn) 354 354 [[self connection] sendCommand:WCPostCommand withArgument:[_postTextView string]]; 355 355 WiredClient/trunk/WCPublicChat.m
r4457 r4466 576 576 WCUser *user = (WCUser *) contextInfo; 577 577 578 if(returnCode == NS RunStoppedResponse) {578 if(returnCode == NSAlertDefaultReturn) { 579 579 [[self connection] sendCommand:WCBanCommand 580 580 withArgument:[NSSWF:@"%u", [user userID]] … … 603 603 WCUser *user = (WCUser *) contextInfo; 604 604 605 if(returnCode == NS RunStoppedResponse) {605 if(returnCode == NSAlertDefaultReturn) { 606 606 [[self connection] sendCommand:WCKickCommand 607 607 withArgument:[NSSWF:@"%u", [user userID]]
