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.15 - (hide annotations) (download)
Wed Jan 29 18:30:41 2003 UTC (21 years, 2 months ago) by footashida
Branch: MAIN
Changes since 1.14: +17 -2 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.12 #import "PreferenceController.h"
7     #import "DUMMailBoxManager.h"
8     #import "MailBoxTableDataSource.h"
9 footashida 1.13 #import "DUMMail.h"
10     #import "DUMMailBox.h"
11 footashida 1.14 #import "AddressBookController.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 footashida 1.15 -(void)dealloc{
58     [window release];
59     [composeWindow release];
60     [searchWindow release];
61     [mailList release];
62     [folderTree release];
63     [mailContents release];
64     [popServerTable release];
65     [smtpServerTable release];
66     [mailCheckTable release];
67     [mailBoxManager release];
68     [prefController release];
69     [addressbookController release];
70     [super dealloc];
71     }
72 footashida 1.1 - (void)applicationDidFinishLaunching:(NSNotification*)notif
73     {
74     NSTableColumn* tableColumn;
75     IconedCell* iconedCell;
76     // �t�H���_�c���[���A�A�C�R��+�������\���������������ACell�����X���s���B
77     tableColumn = [folderTree tableColumnWithIdentifier:@"folderview"];
78     iconedCell = [[[IconedCell alloc] init] autorelease];
79     [tableColumn setDataCell:iconedCell];
80     }
81     -(IBAction)createNewMessage:(id)sender{
82     [composeWindow makeKeyAndOrderFront:nil];
83     }
84 footashida 1.2 -(IBAction)showPreference:(id)sender{
85 footashida 1.12 if(prefController == nil){
86     prefController = [[PreferenceController alloc] init];
87 footashida 1.3 }
88 footashida 1.12 [prefController showWindow:self];
89 footashida 1.1 }
90 footashida 1.9 -(IBAction)createRule:(id)sender{
91     [self showPreference:self];
92 footashida 1.12 [prefController selectPreferenceTabWithName:@"rule_tab"];
93     }
94     - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item{
95     MailBoxTableDataSource *ds;
96    
97     if([mailList dataSource] == nil){
98     ds = [[MailBoxTableDataSource alloc] initWithMailBox:item];
99     [mailList setDataSource:ds];
100     }else{
101     ds = [mailList dataSource];
102     [ds changeMailBox:item];
103     }
104     [mailList reloadData];
105 footashida 1.13 return YES;
106     }
107     - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex{
108     MailBoxTableDataSource *ds;
109     DUMMailBox *selectedMailBox;
110     DUMMail *mail;
111     NSString *text;
112    
113     ds = [aTableView dataSource];
114     selectedMailBox = [ds mailBox];
115     mail = [selectedMailBox mailAtIndex:rowIndex];
116     text = [mailContents string];
117     [mailContents replaceCharactersInRange:NSMakeRange(0, [text length])
118     withString:[mail content]];
119 footashida 1.15 [mail setIsUnread:NO];
120     [folderTree reloadData];
121 footashida 1.12 return YES;
122 footashida 1.14 }
123     -(IBAction)showAddressBook{
124     if(addressbookController == nil){
125     addressbookController
126     = [[AddressBookController alloc] init];
127     }
128     [addressbookController showWindow:self];
129 footashida 1.9 }
130 footashida 1.1 @end

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