]> err.no Git - scalable-opengroupware.org/blob - UI/MailPartViewers/UIxMailPartMixedViewer.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1153 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / MailPartViewers / UIxMailPartMixedViewer.m
1 /*
2   Copyright (C) 2004-2005 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #import <UI/MailerUI/WOContext+UIxMailer.h>
23
24 #import "UIxMailRenderingContext.h"
25
26 #import "UIxMailPartViewer.h"
27
28 @interface UIxMailPartMixedViewer : UIxMailPartViewer
29 {
30   id           childInfo;
31   unsigned int childIndex;
32 }
33
34 @end
35
36 @implementation UIxMailPartMixedViewer
37
38 - (void)dealloc {
39   [self->childInfo release];
40   [super dealloc];
41 }
42
43 /* caches */
44
45 - (void)resetBodyInfoCaches {
46   [self->childInfo release]; self->childInfo = nil;
47   [super resetBodyInfoCaches];
48 }
49
50 /* accessors */
51
52 - (void)setChildInfo:(id)_info {
53   ASSIGN(self->childInfo, _info);
54 }
55 - (id)childInfo {
56   return self->childInfo;
57 }
58
59 - (void)setChildIndex:(unsigned int)_index {
60   self->childIndex = _index;
61 }
62 - (unsigned int)childIndex {
63   return self->childIndex;
64 }
65
66 - (NSString *)childPartName {
67   char buf[8];
68   sprintf(buf, "%d", [self childIndex] + 1);
69   return [NSString stringWithCString:buf];
70 }
71
72 - (id)childPartPath {
73   NSArray *pp;
74
75   pp = [self partPath];
76   return [pp count] > 0
77     ? [pp arrayByAddingObject:[self childPartName]]
78     : [NSArray arrayWithObject:[self childPartName]];
79 }
80
81 /* nested viewers */
82
83 - (id)contentViewerComponent {
84   id info;
85   
86   info = [self childInfo];
87   return [[[self context] mailRenderingContext] viewerForBodyInfo:info];
88 }
89
90 @end /* UIxMailPartMixedViewer */