2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
23 #include <SOGoUI/UIxComponent.h>
25 @class NSArray, NSDictionary;
27 @interface UIxMailToolbar : UIxComponent
29 NSArray *toolbarConfig;
30 NSArray *toolbarGroup;
31 NSDictionary *buttonInfo;
35 #include <SOGo/SoObjects/Mailer/SOGoMailBaseObject.h>
37 #include <NGObjWeb/SoComponent.h>
39 @implementation UIxMailToolbar
42 [self->toolbarGroup release];
43 [self->toolbarConfig release];
44 [self->buttonInfo release];
51 [self->toolbarGroup release]; self->toolbarGroup = nil;
52 [self->toolbarConfig release]; self->toolbarConfig = nil;
53 [self->buttonInfo release]; self->buttonInfo = nil;
59 - (void)setToolbarGroup:(id)_group {
60 ASSIGN(self->toolbarGroup, _group);
63 return self->toolbarGroup;
66 - (void)setButtonInfo:(id)_info {
67 ASSIGN(self->buttonInfo, _info);
70 return self->buttonInfo;
78 if (self->toolbarConfig != nil)
79 return [self->toolbarConfig isNotNull] ? self->toolbarConfig : nil;
81 tmp = [[self clientObject] lookupName:@"toolbar" inContext:[self context]
83 if ([tmp isKindOfClass:[NSException class]]) {
84 [self errorWithFormat:
85 @"not toolbar configuration found on SoObject: %@ (%@)",
86 [self clientObject], [[self clientObject] soClass]];
87 self->toolbarConfig = [[NSNull null] retain];
90 self->toolbarConfig = [tmp retain];
91 return self->toolbarConfig;
96 - (NSString *)buttonLabel {
97 WOResourceManager *rm;
100 NSString *key, *label;
102 key = [[self buttonInfo] valueForKey:@"label"];
104 /* lookup languages */
106 ctx = [self context];
107 languages = [ctx hasSession]
108 ? [[ctx session] languages]
109 : [[ctx request] browserLanguages];
111 /* lookup resource manager */
113 if ((rm = [self resourceManager]) == nil)
114 rm = [[WOApplication application] resourceManager];
116 [self warnWithFormat:@"missing resource manager!"];
120 label = [rm stringForKey:key inTableNamed:nil withDefaultValue:key
121 languages:languages];
125 @end /* UIxMailToolbar */