From: helge Date: Tue, 5 Oct 2004 15:15:52 +0000 (+0000) Subject: made toolbars context sensitive and configurable X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95e15ab1f373587589ddb3f5f885ccbcdf52fedd;p=scalable-opengroupware.org made toolbars context sensitive and configurable git-svn-id: http://svn.opengroupware.org/SOGo/trunk@359 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 6504db88..6da63f70 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,14 @@ 2004-10-05 Helge Hess + * v0.9.21 + + * UIxMailTree: made toolbar configurable using 'toolbar' slot on the + clientObject + + * product.plist: added toolbar configurations + + * UIxMailMainFrame.wox: moved toolbar to own component + * UIxMailListView: added simple navigation (v0.9.20) * v0.9.19 diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index aacadd4e..6c2c8cc4 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -19,6 +19,7 @@ MailerUI_OBJC_FILES += \ \ UIxMailMainFrame.m \ UIxMailTree.m \ + UIxMailToolbar.m \ \ UIxMailAccountsView.m \ UIxMailAccountView.m \ @@ -39,6 +40,7 @@ MailerUI_RESOURCE_FILES += \ MailerUI_RESOURCE_FILES += \ UIxMailMainFrame.wox \ UIxMailTree.wox \ + UIxMailToolbar.wox \ \ UIxMailAccountsView.wox \ UIxMailAccountView.wox \ diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index c597fbd0..99736d0c 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -98,6 +98,10 @@ } - (NSString *)imap4SortKey { + NSString *sort; + + sort = [[[self context] request] formValueForKey:@"sort"]; + return @"SUBJECT"; } diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index adee279d..2554e226 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -28,14 +28,14 @@ - + - + - + @@ -43,7 +43,7 @@ - + diff --git a/SOGo/UI/Mailer/UIxMailMainFrame.wox b/SOGo/UI/Mailer/UIxMailMainFrame.wox index 5bcc5ac1..108b1021 100644 --- a/SOGo/UI/Mailer/UIxMailMainFrame.wox +++ b/SOGo/UI/Mailer/UIxMailMainFrame.wox @@ -28,45 +28,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Get MailWriteAddress Book ReplyReply AllForward DeleteJunk PrintStop
+ diff --git a/SOGo/UI/Mailer/UIxMailToolbar.m b/SOGo/UI/Mailer/UIxMailToolbar.m new file mode 100644 index 00000000..82a6d0c2 --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailToolbar.m @@ -0,0 +1,125 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// $Id$ + +#include + +@class NSArray, NSDictionary; + +@interface UIxMailToolbar : UIxComponent +{ + NSArray *toolbarConfig; + NSArray *toolbarGroup; + NSDictionary *buttonInfo; +} +@end + +#include +#include "common.h" +#include + +@implementation UIxMailToolbar + +- (void)dealloc { + [self->toolbarGroup release]; + [self->toolbarConfig release]; + [self->buttonInfo release]; + [super dealloc]; +} + +/* notifications */ + +- (void)sleep { + [self->toolbarGroup release]; self->toolbarGroup = nil; + [self->toolbarConfig release]; self->toolbarConfig = nil; + [self->buttonInfo release]; self->buttonInfo = nil; + [super sleep]; +} + +/* accessors */ + +- (void)setToolbarGroup:(id)_group { + ASSIGN(self->toolbarGroup, _group); +} +- (id)toolbarGroup { + return self->toolbarGroup; +} + +- (void)setButtonInfo:(id)_info { + ASSIGN(self->buttonInfo, _info); +} +- (id)buttonInfo { + return self->buttonInfo; +} + +/* toolbar */ + +- (id)toolbarConfig { + id tmp; + + if (self->toolbarConfig != nil) + return [self->toolbarConfig isNotNull] ? self->toolbarConfig : nil; + + tmp = [[self clientObject] lookupName:@"toolbar" inContext:[self context] + acquire:NO]; + if ([tmp isKindOfClass:[NSException class]]) { + [self logWithFormat: + @"ERROR: not toolbar configuration found on SoObject: %@ (%@)", + [self clientObject], [[self clientObject] soClass]]; + self->toolbarConfig = [[NSNull null] retain]; + return nil; + } + self->toolbarConfig = [tmp retain]; + return self->toolbarConfig; +} + +/* labels */ + +- (NSString *)buttonLabel { + WOResourceManager *rm; + NSArray *languages; + WOContext *ctx; + NSString *key, *label; + + key = [[self buttonInfo] valueForKey:@"label"]; + + /* lookup languages */ + + ctx = [self context]; + languages = [ctx hasSession] + ? [[ctx session] languages] + : [[ctx request] browserLanguages]; + + /* lookup resource manager */ + + if ((rm = [self resourceManager]) == nil) + rm = [[WOApplication application] resourceManager]; + if (rm == nil) + [self debugWithFormat:@"WARNING: missing resource manager!"]; + + /* lookup string */ + + label = [rm stringForKey:key inTableNamed:nil withDefaultValue:key + languages:languages]; + return label; +} + +@end /* UIxMailToolbar */ diff --git a/SOGo/UI/Mailer/UIxMailToolbar.wox b/SOGo/UI/Mailer/UIxMailToolbar.wox new file mode 100644 index 00000000..e0c3a469 --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailToolbar.wox @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + +
diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 7cb001ac..49f242e5 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=20 +SUBMINOR_VERSION:=21 diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index f272c668..7c2732e4 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -60,6 +60,44 @@ categories = { SOGoMailFolder = { + slots = { + toolbar = { + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { + link = "getMail"; + cssClass = "tbicon_getmail"; label = "Get Mail"; + }, + { + link = "compose"; target = "_blank"; + cssClass = "tbicon_compose"; label = "Write"; + }, + { + link = "addressbook"; target = "addressbook"; + cssClass = "tbicon_addressbook"; label = "Write"; + } + ), + ( /* second group */ + { link = "#"; + cssClass = "tbicon_reply"; label = "Reply"; }, + { link = "#"; + cssClass = "tbicon_replyall"; label = "Reply All"; }, + { link = "#"; cssClass = "tbicon_forward"; label = "Forward"; }, + ), + ( /* third group */ + { link = "#"; + cssClass = "tbicon_delete"; label = "Delete"; }, + { link = "#"; + cssClass = "tbicon_junk"; label = "Junk"; }, + ), + ( /* fourth group */ + { link = "#"; cssClass = "tbicon_print"; label = "Print"; }, + { link = "#"; cssClass = "tbicon_stop"; label = "Stop"; }, + ), + ); + }; + }; methods = { view = { protectedBy = "View"; @@ -85,10 +123,53 @@ pageName = "UIxMailListView"; actionName = "getMail"; }; + + compose = { + protectedBy = "View"; + pageName = "UIxMailEditor"; + }; }; }; SOGoMailObject = { + slots = { + toolbar = { + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { + link = "getMail"; + cssClass = "tbicon_getmail"; label = "Get Mail"; + }, + { + link = "compose"; target = "_blank"; + cssClass = "tbicon_compose"; label = "Write"; + }, + { + link = "addressbook"; target = "addressbook"; + cssClass = "tbicon_addressbook"; label = "Write"; + } + ), + ( /* second group */ + { link = "#"; + cssClass = "tbicon_reply"; label = "Reply"; }, + { link = "#"; + cssClass = "tbicon_replyall"; label = "Reply All"; }, + { link = "#"; cssClass = "tbicon_forward"; label = "Forward"; }, + ), + ( /* third group */ + { link = "#"; + cssClass = "tbicon_delete"; label = "Delete"; }, + { link = "#"; + cssClass = "tbicon_junk"; label = "Junk"; }, + ), + ( /* fourth group */ + { link = "#"; cssClass = "tbicon_print"; label = "Print"; }, + { link = "#"; cssClass = "tbicon_stop"; label = "Stop"; }, + ), + ); + }; + }; methods = { view = { protectedBy = "View"; @@ -119,6 +200,19 @@ }; SOGoMailAccounts = { + slots = { + toolbar = { + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { + link = "getMail"; + cssClass = "tbicon_getmail"; label = "Get Mail"; + }, + ) + ); + }; + }; methods = { view = { protectedBy = "View"; @@ -128,6 +222,19 @@ }; SOGoMailAccount = { + slots = { + toolbar = { + protectedBy = "View"; + value = ( /* the toolbar groups */ + ( /* first group */ + { + link = "getMail"; + cssClass = "tbicon_getmail"; label = "Get Mail"; + }, + ) + ); + }; + }; methods = { view = { protectedBy = "View";