Develop and Download Open Source Software

Browse CVS Repository

Annotation of /undmail/guiproto/MainController.m

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


Revision 1.13 - (hide 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 footashida 1.1 #import "MainController.h"
2 footashida 1.12 #import "MailBoxOutlineDataSource.h"
3 footashida 1.2 #import "MainToolbarSource.h"
4 footashida 1.1 #import "IconedCell.h"
5 footashida 1.2 #import "ComposeToolbarSource.h"
6 footashida 1.3 #import "PreferenceToolbarSource.h"
7 footashida 1.12 #import "PreferenceController.h"
8     #import "DUMMailBoxManager.h"
9     #import "MailBoxTableDataSource.h"
10 footashida 1.13 #import "DUMMail.h"
11     #import "DUMMailBox.h"
12 footashida 1.1 @implementation MainController
13 footashida 1.13 -(void)setupToolbar{
14 footashida 1.1 NSToolbar *toolbar;
15 footashida 1.2 MainToolbarSource *mainToolbarSource;
16     ComposeToolbarSource *composeToolbarSource;
17 footashida 1.5 toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainToolBar"];
18 footashida 1.2 mainToolbarSource = [[MainToolbarSource alloc] initWithController:self];
19     [toolbar setDelegate:mainToolbarSource];
20 footashida 1.1 [window setToolbar:toolbar];
21     [toolbar release];
22    
23 footashida 1.5 toolbar = [[NSToolbar alloc] initWithIdentifier:@"ComposeToolBar"];
24 footashida 1.2 composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self];
25     [toolbar setDelegate:composeToolbarSource];
26 footashida 1.1 [composeWindow setToolbar:toolbar];
27     [toolbar release];
28 footashida 1.13 }
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 footashida 1.1
46 footashida 1.5 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 footashida 1.1 }
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 footashida 1.2 -(IBAction)showPreference:(id)sender{
70 footashida 1.12 if(prefController == nil){
71     prefController = [[PreferenceController alloc] init];
72 footashida 1.3 }
73 footashida 1.12 [prefController showWindow:self];
74 footashida 1.1 }
75 footashida 1.9 -(IBAction)createRule:(id)sender{
76     [self showPreference:self];
77 footashida 1.12 [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 footashida 1.13 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 footashida 1.12 return YES;
105 footashida 1.9 }
106 footashida 1.1 @end

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