[zephyrchat-cvs] zchat/zChat ZChatAppController.h,1.16,1.17 ZChatAppController.mm,1.19,1.20
Status: Alpha
Brought to you by:
akosut
|
From: <ak...@us...> - 2003-04-10 20:47:48
|
Update of /cvsroot/zephyrchat/zchat/zChat
In directory sc8-pr-cvs1:/tmp/cvs-serv7691/zChat
Modified Files:
ZChatAppController.h ZChatAppController.mm
Log Message:
Use combo box (with friends in menu) for chat-with-person entry.
Index: ZChatAppController.h
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatAppController.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ZChatAppController.h 7 Apr 2003 21:01:52 -0000 1.16
+++ ZChatAppController.h 10 Apr 2003 20:47:42 -0000 1.17
@@ -23,7 +23,7 @@
IBOutlet NSButton *_newChatOK;
IBOutlet NSPopUpButton *_newChatType;
IBOutlet NSTabView *_newChatTabs;
- IBOutlet NSTextField *_newChatPerson;
+ IBOutlet NSComboBox *_newChatPerson;
IBOutlet NSTextField *_newChatChat;
IBOutlet NSTextField *_newChatInstance;
IBOutlet NSTextField *_newChatClass;
Index: ZChatAppController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatAppController.mm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- ZChatAppController.mm 7 Apr 2003 21:01:53 -0000 1.19
+++ ZChatAppController.mm 10 Apr 2003 20:47:43 -0000 1.20
@@ -251,12 +251,18 @@
[_newChatTabs takeSelectedTabViewItemFromSender:_newChatType];
[[_newChatRecipient itemAtIndex:0] setTitle:[NSString stringWithSTLString:recipient]];
+ [_newChatPerson removeAllItems];
+ NSArray *friendList = [[ZChatApp friendsWithFormat:NSLocalizedString(@"POPUP_USERNAME_FORMAT", nil)
+] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
+ [_newChatPerson addItemsWithObjectValues:friendList];
[_newChatPerson setStringValue:@""];
+
[_newChatChat setStringValue:@""];
[_newChatClass setStringValue:@""];
[_newChatInstance setStringValue:@""];
[_newChatRecipient selectItemAtIndex:0];
-
+
+
[_newChatOK setEnabled:NO];
if ([NSApp runModalForWindow:_newChatPanel] == NSOKButton) {
@@ -265,10 +271,18 @@
NSAssert((unsigned)[_newChatType indexOfSelectedItem] < 3, @"Invalid chat type");
switch ([_newChatType indexOfSelectedItem]) {
case 0: // Person
+ {
sender = [[_newChatPerson stringValue] stlString];
class_ = "message";
instance = "*";
- break;
+
+ // Use only the first word of the sender
+ string::size_type space_pos = sender.find(' ');
+ if (space_pos != string::npos) {
+ sender.resize(space_pos);
+ }
+
+ } break;
case 1: // Chat
sender = "*";
@@ -289,7 +303,7 @@
recipient = [[_newChatRecipient titleOfSelectedItem] stlString];
break;
}
-
+
ZQuad subscribe_to(class_, instance, recipient, sender);
ZCChatWindowController *controller
= [ZCChatWindowController windowControllerWithQuad:subscribe_to start:YES];
@@ -363,6 +377,12 @@
[_newChatOK setEnabled:[[_newChatClass stringValue] length]
&& [[_newChatInstance stringValue] length]];
break;
+ }
+}
+
+- (void)comboBoxWillDismiss:(NSNotification *)notification {
+ if ([notification object] == _newChatPerson) {
+ [self controlTextDidChange:nil];
}
}
|