Develop and Download Open Source Software

Browse CVS Repository

Contents of /undmail/guiproto/MainController.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.13 - (show annotations) (download)
Sun Jan 26 14:50:49 2003 UTC (21 years, 2 months ago) by footashida
Branch: MAIN
Changes since 1.12: +34 -12 lines
*** empty log message ***

1 #import "MainController.h"
2 #import "MailBoxOutlineDataSource.h"
3 #import "MainToolbarSource.h"
4 #import "IconedCell.h"
5 #import "ComposeToolbarSource.h"
6 #import "PreferenceToolbarSource.h"
7 #import "PreferenceController.h"
8 #import "DUMMailBoxManager.h"
9 #import "MailBoxTableDataSource.h"
10 #import "DUMMail.h"
11 #import "DUMMailBox.h"
12 @implementation MainController
13 -(void)setupToolbar{
14 NSToolbar *toolbar;
15 MainToolbarSource *mainToolbarSource;
16 ComposeToolbarSource *composeToolbarSource;
17 toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainToolBar"];
18 mainToolbarSource = [[MainToolbarSource alloc] initWithController:self];
19 [toolbar setDelegate:mainToolbarSource];
20 [window setToolbar:toolbar];
21 [toolbar release];
22
23 toolbar = [[NSToolbar alloc] initWithIdentifier:@"ComposeToolBar"];
24 composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self];
25 [toolbar setDelegate:composeToolbarSource];
26 [composeWindow setToolbar:toolbar];
27 [toolbar release];
28 }
29
30
31 -(void)awakeFromNib{
32 MailBoxOutlineDataSource *ds;
33 NSButtonCell *mailCheckButtonCell;
34 NSButtonCell *mailDeleteButtonCell;
35
36 [window center];
37
38 mailBoxManager = [[DUMMailBoxManager alloc] init];
39 ds = [[MailBoxOutlineDataSource alloc]
40 initWithMailBoxManager:mailBoxManager];
41 [folderTree setDataSource:ds];
42
43 [self setupToolbar];
44
45
46 mailCheckButtonCell = [[NSButtonCell alloc] init];
47 mailDeleteButtonCell = [[NSButtonCell alloc] init];
48 [mailCheckButtonCell setButtonType:NSSwitchButton];
49 [mailDeleteButtonCell setButtonType:NSSwitchButton];
50
51 [mailCheckButtonCell setTitle:@""];
52 [mailDeleteButtonCell setTitle:@""];
53
54 [[mailCheckTable tableColumnWithIdentifier:@"MailCheckFlag"] setDataCell:mailCheckButtonCell];
55 [[mailCheckTable tableColumnWithIdentifier:@"MailDeleteFlag"] setDataCell:mailDeleteButtonCell];
56 }
57 - (void)applicationDidFinishLaunching:(NSNotification*)notif
58 {
59 NSTableColumn* tableColumn;
60 IconedCell* iconedCell;
61 // �t�H���_�c���[���A�A�C�R��+�������\���������������ACell�����X���s���B
62 tableColumn = [folderTree tableColumnWithIdentifier:@"folderview"];
63 iconedCell = [[[IconedCell alloc] init] autorelease];
64 [tableColumn setDataCell:iconedCell];
65 }
66 -(IBAction)createNewMessage:(id)sender{
67 [composeWindow makeKeyAndOrderFront:nil];
68 }
69 -(IBAction)showPreference:(id)sender{
70 if(prefController == nil){
71 prefController = [[PreferenceController alloc] init];
72 }
73 [prefController showWindow:self];
74 }
75 -(IBAction)createRule:(id)sender{
76 [self showPreference:self];
77 [prefController selectPreferenceTabWithName:@"rule_tab"];
78 }
79 - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item{
80 MailBoxTableDataSource *ds;
81
82 if([mailList dataSource] == nil){
83 ds = [[MailBoxTableDataSource alloc] initWithMailBox:item];
84 [mailList setDataSource:ds];
85 }else{
86 ds = [mailList dataSource];
87 [ds changeMailBox:item];
88 }
89 [mailList reloadData];
90 return YES;
91 }
92 - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex{
93 MailBoxTableDataSource *ds;
94 DUMMailBox *selectedMailBox;
95 DUMMail *mail;
96 NSString *text;
97
98 ds = [aTableView dataSource];
99 selectedMailBox = [ds mailBox];
100 mail = [selectedMailBox mailAtIndex:rowIndex];
101 text = [mailContents string];
102 [mailContents replaceCharactersInRange:NSMakeRange(0, [text length])
103 withString:[mail content]];
104 return YES;
105 }
106 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26