]> err.no Git - scalable-opengroupware.org/blob - UI/MailerUI/UIxMailFolderMenu.m
initial sync
[scalable-opengroupware.org] / UI / MailerUI / UIxMailFolderMenu.m
1 /* UIxMailFolderMenu.m - this file is part of SOGo
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 <Foundation/NSArray.h>
24 #import <Foundation/NSString.h>
25
26 #import "UIxMailTreeBlock.h"
27 #import "UIxMailFolderMenu.h"
28
29 @implementation UIxMailFolderMenu
30
31 - (void) setMenuId: (NSString *) newMenuId
32 {
33   menuId = newMenuId;
34 }
35
36 - (NSString *) menuId
37 {
38   return menuId;
39 }
40
41 - (void) setParentMenu: (NSString *) newParentMenu
42 {
43   parentMenu = newParentMenu;
44 }
45
46 - (NSString *) parentMenu
47 {
48   return parentMenu;
49 }
50
51 - (NSArray *) levelledNodes
52 {
53   NSEnumerator *nodes;
54   NSMutableArray *levelledNodes;
55   UIxMailTreeBlock *block;
56
57   levelledNodes = [NSMutableArray new];
58   [levelledNodes autorelease];
59
60   nodes = [[self flattenedNodes] objectEnumerator];
61   block = [nodes nextObject];
62
63   while (block)
64     {
65       if ([block parent] == [parentMenu intValue])
66         [levelledNodes addObject: block];
67       block = [nodes nextObject];
68     }
69
70   return levelledNodes;
71 }
72
73 - (NSString *) iconForMenuItem
74 {
75   NSString *iconName;
76
77   iconName = [item iconName];
78   if (!iconName)
79     iconName = [self defaultIconName];
80
81   return [self urlForResourceFilename: iconName];
82 }
83
84 @end