Changeset 23481
- Timestamp:
- 05/17/2008 11:21:00 PM (7 months ago)
- Files:
-
- trunk/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h (modified) (1 diff)
- trunk/Plugins/Dual Window Interface/AIMessageViewController.h (modified) (1 diff)
- trunk/Plugins/Dual Window Interface/AIMessageViewController.m (modified) (1 diff)
- trunk/Plugins/WebKit Message View/AIWebKitMessageViewController.h (modified) (2 diffs)
- trunk/Plugins/WebKit Message View/AIWebKitMessageViewController.m (modified) (1 diff)
- trunk/Source/AIInterfaceController.h (modified) (1 diff)
- trunk/Source/AIInterfaceController.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h
r23478 r23481 396 396 */ 397 397 @protocol AIMessageDisplayController <NSObject> 398 - (void)setChatContentSource:(NSString *)source; 399 - (NSString *)chatContentSource; 400 - (NSString *)contentSourceName; // Unique name for this particular style of "content source". 401 398 402 - (NSView *)messageView; 399 403 - (NSView *)messageScrollView; trunk/Plugins/Dual Window Interface/AIMessageViewController.h
r23084 r23481 79 79 80 80 //Message Display 81 - (NSObject<AIMessageDisplayController> *)messageDisplayController; 81 82 - (NSView *)view; 82 83 - (void)adiumPrint:(id)sender; trunk/Plugins/Dual Window Interface/AIMessageViewController.m
r23404 r23481 372 372 373 373 [controllerView_messages setNextResponder:textView_outgoing]; 374 } 375 376 /*! 377 * @brief The message display controller 378 */ 379 - (NSObject<AIMessageDisplayController> *)messageDisplayController 380 { 381 return messageDisplayController; 374 382 } 375 383 trunk/Plugins/WebKit Message View/AIWebKitMessageViewController.h
r22467 r23481 1 /*1 /* 2 2 * Adium is the legal property of its developers, whose names are listed in the copyright file included 3 3 * with this source distribution. … … 97 97 - (void)setShouldReflectPreferenceChanges:(BOOL)inValue; 98 98 99 /*! 100 * @brief Set the HTML content for the "Chat" area. 101 */ 102 - (void)setChatContentSource:(NSString *)source; 103 104 /*! 105 * @brief Get the HTML content for the "Chat" area. 106 */ 107 - (NSString *)chatContentSource; 108 99 109 - (void)setPreferencesChangedDelegate:(id)inDelegate; 100 110 @end trunk/Plugins/WebKit Message View/AIWebKitMessageViewController.m
r23300 r23481 1358 1358 } 1359 1359 1360 /*! 1361 * @brief Set the HTML content for the "Chat" area. 1362 */ 1363 - (void)setChatContentSource:(NSString *)source 1364 { 1365 if (!webViewIsReady) { 1366 // If the webview isn't ready yet, wait a very short amount of time before trying again 1367 [self performSelector:@selector(setChatContentSource:) 1368 withObject:source 1369 afterDelay:0.01]; 1370 } else { 1371 // Add the old "Chat" element to the window. 1372 [(DOMHTMLElement *)[[[webView mainFrame] DOMDocument] getElementById:@"Chat"] setOuterHTML:source]; 1373 1374 NSString *scrollToBottomScript; 1375 if ((scrollToBottomScript = [messageStyle scriptForScrollingAfterAddingMultipleContentObjects])) { 1376 [webView stringByEvaluatingJavaScriptFromString:scrollToBottomScript]; 1377 } 1378 } 1379 } 1380 1381 /*! 1382 * @brief Get the HTML content for the "Chat" area. 1383 */ 1384 - (NSString *)chatContentSource 1385 { 1386 return [(DOMHTMLElement *)[[[webView mainFrame] DOMDocument] getElementById:@"Chat"] outerHTML]; 1387 } 1388 1389 /*! 1390 * @brief The unique name for this style of "content source" 1391 */ 1392 - (NSString *)contentSourceName 1393 { 1394 return [[[messageStyle bundle] bundlePath] lastPathComponent]; 1395 } 1396 1360 1397 @end trunk/Source/AIInterfaceController.h
r23478 r23481 18 18 #import <Adium/AIAdiumProtocol.h> 19 19 20 @class AIMenuController, AIChat, AIListObject ;20 @class AIMenuController, AIChat, AIListObject, AIMessageViewController; 21 21 22 22 @interface AIInterfaceController : NSObject <AIInterfaceController> { trunk/Source/AIInterfaceController.m
r23478 r23481 44 44 #import <Adium/AIServiceIcons.h> 45 45 #import <Adium/AISortController.h> 46 #import "AIMessageTabViewItem.h" 46 47 #import "KFTypeSelectTableView.h" 47 48 #import <KNShelfSplitview.h> 49 50 #import "AIMessageViewController.h" 48 51 49 52 #define ERROR_MESSAGE_WINDOW_TITLE AILocalizedString(@"Adium : Error","Error message window title") … … 256 259 //Restore saved containers 257 260 [self restoreSavedContainers]; 261 } else if (!saveContainers) { 262 [[adium preferenceController] setPreference:nil 263 forKey:KEY_CONTAINERS 264 group:PREF_GROUP_INTERFACE]; 258 265 } 259 266 } … … 414 421 415 422 // Open the chat into the container we've created above. 416 [self openChat:chat inContainerWithID:[dict objectForKey:@"ID"] atIndex:-1]; 423 AIMessageTabViewItem *tabViewItem = [self openChat:chat inContainerWithID:[dict objectForKey:@"ID"] atIndex:-1]; 424 425 // Restore the display buffer of the chat. 426 NSObject<AIMessageDisplayController> *displayController = [(AIMessageViewController *)[tabViewItem messageViewController] messageDisplayController]; 427 428 // Only load the old content if the content name is the same. 429 if ([[displayController contentSourceName] isEqualToString:[chatDict objectForKey:@"ChatContentsName"]]) { 430 [displayController setChatContentSource:[chatDict objectForKey:@"ChatContents"]]; 431 } 417 432 } 418 433 … … 431 446 // end of session. 432 447 if (!saveContainers) { 433 [[adium preferenceController] setPreference:nil434 forKey:KEY_CONTAINERS435 group:PREF_GROUP_INTERFACE];436 448 return; 437 449 } … … 443 455 444 456 while ((dict = [enumerator nextObject])) { 445 NSMutableArray *containerContents = [NSMutableArray array]; 457 NSMutableArray *containerContents = [NSMutableArray array]; 446 458 NSEnumerator *containedEnumerator = [[dict objectForKey:@"Content"] objectEnumerator]; 447 459 AIChat *chat; 448 460 449 461 while ((chat = [containedEnumerator nextObject])) { 450 if ([chat isOpen]) { 451 if ([chat isGroupChat]) { 452 // -chatCreationDictionary may be nil, so put it last. 453 [containerContents addObject:[NSDictionary dictionaryWithObjectsAndKeys: 454 [NSNumber numberWithBool:YES], @"IsGroupChat", 455 [chat name], @"Name", 456 [[chat account] internalObjectID], @"AccountID", 457 [chat chatCreationDictionary], @"ChatCreationInfo",nil]]; 458 } else { 459 [containerContents addObject:[NSDictionary dictionaryWithObjectsAndKeys: 460 [[chat listObject] UID], @"UID", 461 [[chat listObject] serviceID], @"serviceID", 462 [[chat account] internalObjectID], @"AccountID",nil]]; 463 } 462 NSMutableDictionary *newContainerDict = [NSMutableDictionary dictionary]; 463 464 // Save the current display buffer. 465 NSObject<AIMessageDisplayController> *displayController = [(AIMessageViewController *)[(AIMessageTabViewItem *)[chat statusObjectForKey:@"MessageTabViewItem"] messageViewController] messageDisplayController]; 466 [newContainerDict setObject:[displayController chatContentSource] 467 forKey:@"ChatContents"]; 468 469 [newContainerDict setObject:[displayController contentSourceName] 470 forKey:@"ChatContentsName"]; 471 472 [newContainerDict setObject:[[chat account] internalObjectID] forKey:@"AccountID"]; 473 474 // Save chat-specific information. 475 if ([chat isGroupChat]) { 476 // -chatCreationDictionary may be nil, so put it last. 477 [newContainerDict addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: 478 [NSNumber numberWithBool:YES], @"IsGroupChat", 479 [chat name], @"Name", 480 [chat chatCreationDictionary], @"ChatCreationInfo",nil]]; 481 } else { 482 [newContainerDict addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: 483 [[chat listObject] UID], @"UID", 484 [[chat listObject] serviceID], @"serviceID", 485 [[chat account] internalObjectID], @"AccountID",nil]]; 464 486 } 487 488 [containerContents addObject:newContainerDict]; 465 489 } 466 490