]> err.no Git - scalable-opengroupware.org/blob - UI/MailerUI/UIxMailTreeBlockJS.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1017 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / MailerUI / UIxMailTreeBlockJS.m
1 /* UIxMailTreeBlockJS.m - this file is part of $PROJECT_NAME_HERE$
2  *
3  * Copyright (C) 2006 Inverse groupe conseil
4  *
5  * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
6  *
7  * This file is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This file is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #import "UIxMailTreeBlockJS.h"
24
25 #import "Common/UIxPageFrame.h"
26
27 @implementation UIxMailTreeBlockJS
28
29 - (id) init
30 {
31   if ((self = [super init]))
32     {
33       item = nil;
34     }
35
36   return self;
37 }
38
39 - (void) setItem: (UIxMailTreeBlock *) newItem
40 {
41   item = newItem;
42 }
43
44 - (UIxMailTreeBlock *) item
45 {
46   return item;
47 }
48
49 - (WOResourceManager *) resourceManager
50 {
51   WOResourceManager *resourceManager;
52   id c;
53
54   resourceManager = nil;
55
56   c = self;
57   while (!resourceManager
58          && c)
59     if ([c respondsToSelector: @selector(pageResourceManager)])
60       resourceManager = [c pageResourceManager];
61     else
62       c = [c parent];
63
64   return resourceManager;
65 }
66
67 - (NSString *) iconName
68 {
69   WOResourceManager *resourceManager;
70   NSString *iconName, *rsrcIconName;
71
72   iconName = [item iconName];
73   if ([iconName length] > 0)
74     {
75       resourceManager = [self resourceManager];
76       rsrcIconName = [resourceManager urlForResourceNamed: iconName
77                                       inFramework: nil
78                                       languages: nil
79                                       request: [[self context] request]];
80     }
81   else
82     rsrcIconName = nil;
83
84   return rsrcIconName;
85 }
86
87 - (void) setTreeObjectName: (NSString *) newName
88 {
89   treeObjectName = newName;
90 }
91
92 - (NSString *) treeObjectName
93 {
94   return treeObjectName;
95 }
96
97 - (BOOL) isAccount
98 {
99   return ([item parent] == 0);
100 }
101
102 - (BOOL) isInbox
103 {
104   return ([[item name] isEqualToString: @"INBOX"]);
105 }
106
107 - (BOOL) isTrash
108 {
109   return NO;
110 }
111
112
113 @end