From: helge Date: Wed, 13 Oct 2004 16:51:33 +0000 (+0000) Subject: minor cleanups and fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af024a7b415021ced977bf36f8359e4afd92e3c4;p=scalable-opengroupware.org minor cleanups and fixes git-svn-id: http://svn.opengroupware.org/SOGo/trunk@393 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 3921ca40..34eb3b60 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,13 @@ +2004-10-13 Helge Hess + + * v0.9.40 + + * product.plist: exported some missing icons + + * UIxMailToSelection.m: some code cleanup + + * UIxMailEditor.m (UIxComponent): added ivars for values + 2004-10-13 Marcus Mueller * UIxMailToSelection.m: sanitize CN's a bit before using them (v0.9.39) diff --git a/SOGo/UI/Mailer/UIxMailEditor.m b/SOGo/UI/Mailer/UIxMailEditor.m index dc850c93..532149ff 100644 --- a/SOGo/UI/Mailer/UIxMailEditor.m +++ b/SOGo/UI/Mailer/UIxMailEditor.m @@ -22,8 +22,21 @@ #include +/* + UIxMailEditor + + An mail editor component which works on SOGoDraftObject's. +*/ + +@class NSArray, NSString; + @interface UIxMailEditor : UIxComponent { + NSArray *to; + NSArray *cc; + NSArray *bcc; + NSString *subject; + NSString *text; } @end @@ -32,6 +45,52 @@ @implementation UIxMailEditor +- (void)dealloc { + [self->text release]; + [self->subject release]; + [self->to release]; + [self->cc release]; + [self->bcc release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setSubject:(NSString *)_value { + ASSIGNCOPY(self->subject, _value); +} +- (NSString *)subject { + return self->subject; +} + +- (void)setText:(NSString *)_value { + ASSIGNCOPY(self->text, _value); +} +- (NSString *)text { + return self->text; +} + +- (void)setTo:(NSArray *)_value { + ASSIGNCOPY(self->to, _value); +} +- (NSArray *)to { + return self->to; +} + +- (void)setCc:(NSArray *)_value { + ASSIGNCOPY(self->cc, _value); +} +- (NSArray *)cc { + return self->cc; +} + +- (void)setBcc:(NSArray *)_value { + ASSIGNCOPY(self->bcc, _value); +} +- (NSArray *)bcc { + return self->bcc; +} + /* requests */ - (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{ diff --git a/SOGo/UI/Mailer/UIxMailToSelection.m b/SOGo/UI/Mailer/UIxMailToSelection.m index c86e79a7..380dde23 100644 --- a/SOGo/UI/Mailer/UIxMailToSelection.m +++ b/SOGo/UI/Mailer/UIxMailToSelection.m @@ -24,22 +24,22 @@ #include /* - UIxMailToSelection - - Select a set of address headers for composing an email. - - Bindings: - to - array of strings suitable for placement in a To: header - cc - array of strings suitable for placement in a Cc: header - bcc - array of strings suitable for placement in a Bcc: header - - Sample: - - */ + UIxMailToSelection + + Select a set of address headers for composing an email. + + Bindings: + to - array of strings suitable for placement in a To: header + cc - array of strings suitable for placement in a Cc: header + bcc - array of strings suitable for placement in a Bcc: header + + Sample: + +*/ @class NSArray; @@ -48,10 +48,10 @@ NSArray *to; NSArray *cc; NSArray *bcc; - id item; - id address; + id item; + id address; NSArray *addressList; - int currentIndex; + int currentIndex; } - (void)setTo:(NSArray *)_to; @@ -77,9 +77,9 @@ static NSArray *headers = nil; + (void)initialize { static BOOL didInit = NO; - if(didInit) + if (didInit) return; - + didInit = YES; headers = [[NSArray alloc] initWithObjects:@"to", @"cc", @"bcc", nil]; } @@ -93,10 +93,9 @@ static NSArray *headers = nil; } - (void)dealloc { - [self->to release]; - [self->cc release]; - [self->bcc release]; - + [self->to release]; + [self->cc release]; + [self->bcc release]; [self->item release]; [self->address release]; [self->addressList release]; @@ -107,7 +106,7 @@ static NSArray *headers = nil; - (void)setTo:(NSArray *)_to { _to = [self properlySplitAddresses:_to]; - ASSIGN(self->to, _to); + ASSIGNCOPY(self->to, _to); } - (NSArray *)to { return self->to; @@ -115,7 +114,7 @@ static NSArray *headers = nil; - (void)setCc:(NSArray *)_cc { _cc = [self properlySplitAddresses:_cc]; - ASSIGN(self->cc, _cc); + ASSIGNCOPY(self->cc, _cc); } - (NSArray *)cc { return self->cc; @@ -123,7 +122,7 @@ static NSArray *headers = nil; - (void)setBcc:(NSArray *)_bcc { _bcc = [self properlySplitAddresses:_bcc]; - ASSIGN(self->bcc, _bcc); + ASSIGNCOPY(self->bcc, _bcc); } - (NSArray *)bcc { return self->bcc; @@ -154,16 +153,14 @@ static NSArray *headers = nil; NSMutableArray *ma; ma = [NSMutableArray arrayWithCapacity:3]; - if(self->to) - [ma addObject:self->to]; - if(self->cc) - [ma addObject:self->cc]; - if(self->bcc) - [ma addObject:self->bcc]; - /* ensure that min 1 object is available */ - if([ma count] == 0) { + if ([self->to isNotNull]) [ma addObject:self->to]; + if ([self->cc isNotNull]) [ma addObject:self->cc]; + if ([self->bcc isNotNull]) [ma addObject:self->bcc]; + + /* ensure that at least one object is available */ + if ([ma count] == 0) { NSArray *tmp = [NSArray arrayWithObject:@""]; - ASSIGN(self->to, tmp); + ASSIGNCOPY(self->to, tmp); [ma addObject:self->to]; } return ma; @@ -184,15 +181,21 @@ static NSArray *headers = nil; /* identifiers */ - (NSString *)currentRowId { - return [NSString stringWithFormat:@"row_%d", self->currentIndex]; + unsigned char buf[16]; + sprintf(buf, "row_%d", self->currentIndex); + return [NSString stringWithCString:buf]; } - (NSString *)currentPopUpId { - return [NSString stringWithFormat:@"popup_%d", self->currentIndex]; + unsigned char buf[16]; + sprintf(buf, "popup_%d", self->currentIndex); + return [NSString stringWithCString:buf]; } - (NSString *)currentAddressId { - return [NSString stringWithFormat:@"addr_%d", self->currentIndex]; + unsigned char buf[16]; + sprintf(buf, "addr_%d", self->currentIndex); + return [NSString stringWithCString:buf]; } - (NSString *)nextId { @@ -203,11 +206,11 @@ static NSArray *headers = nil; /* address handling */ - (NSArray *)properlySplitAddresses:(NSArray *)_addresses { - NSString *addrs; + NSString *addrs; NGMailAddressParser *parser; - NSArray *result; - NSMutableArray *ma; - unsigned i, count; + NSArray *result; + NSMutableArray *ma; + unsigned i, count; if(!_addresses || [_addresses count] == 0) return nil; @@ -223,8 +226,8 @@ static NSArray *headers = nil; count = [result count]; ma = [NSMutableArray arrayWithCapacity:count]; - for(i = 0; i < count; i++) { - NGMailAddress *addr; + for (i = 0; i < count; i++) { + NGMailAddress *addr; NSMutableString *s; BOOL hasName = NO; @@ -252,13 +255,13 @@ static NSArray *headers = nil; NSArray *keys; unsigned i, count; - rawTo = [NSMutableArray array]; - rawCc = [NSMutableArray array]; - rawBcc = [NSMutableArray array]; + rawTo = [NSMutableArray arrayWithCapacity:4]; + rawCc = [NSMutableArray arrayWithCapacity:4]; + rawBcc = [NSMutableArray arrayWithCapacity:2]; - keys = [_dict allKeys]; + keys = [_dict allKeys]; count = [keys count]; - for(i = 0; i < count; i++) { + for (i = 0; i < count; i++) { NSString *key; key = [keys objectAtIndex:i]; @@ -277,14 +280,16 @@ static NSArray *headers = nil; [rawBcc addObject:addr]; } } - + [self setTo:rawTo]; [self setCc:rawCc]; [self setBcc:rawBcc]; } - (NSString *)getIndexFromIdentifier:(NSString *)_identifier { - NSRange r = [_identifier rangeOfString:@"_"]; + NSRange r; + + r = [_identifier rangeOfString:@"_"]; return [_identifier substringFromIndex:NSMaxRange(r)]; } @@ -292,8 +297,7 @@ static NSArray *headers = nil; /* OK, we have a special form value processor */ NSDictionary *d; - d = [_rq formValues]; - if(!d) + if ((d = [_rq formValues]) == nil) return; #if 0 @@ -308,6 +312,8 @@ static NSArray *headers = nil; /* response generation */ - (NSString *)jsCode { + // TODO: can't we put this into a resource? + // TODO: might be better to use -stringByReplacingBindings: etc static NSString *script = \ @"var currentIndex = %d;\n" @"\n" @@ -428,10 +434,8 @@ static NSArray *headers = nil; unsigned idx; idx = [self->to count] + [self->cc count] + [self->bcc count]; - - return [NSString stringWithFormat: - script, - idx]; + + return [NSString stringWithFormat:script, idx]; } -@end +@end /* UIxMailToSelection */ diff --git a/SOGo/UI/Mailer/UIxMailToSelection.wox b/SOGo/UI/Mailer/UIxMailToSelection.wox index 357ca6d2..a74d881e 100644 --- a/SOGo/UI/Mailer/UIxMailToSelection.wox +++ b/SOGo/UI/Mailer/UIxMailToSelection.wox @@ -7,9 +7,10 @@ border="0" width="100%" > - + diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 760afe2d..d3d7995a 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=39 +SUBMINOR_VERSION:=40 diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 69950b48..65f9f893 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -38,6 +38,17 @@ "tbtb_search.png", "tbtb_trash.png", + "tbtb_compose_addressbook_30x30.png", + "tbtb_compose_attach_30x30.png", + "tbtb_compose_clip_30x30.png", + "tbtb_compose_cut_30x30.png", + "tbtb_compose_dup_30x30.png", + "tbtb_compose_file_30x30.png", + "tbtb_compose_lock_30x30.png", + "tbtb_compose_quote_30x30.png", + "tbtb_compose_send_30x30.png", + "tbtb_compose_spell_30x30.png", + "message-mail.png", "message-mail-read.png", @@ -48,7 +59,7 @@ "icon_read.gif", "icon_unread.gif", - "title_attachment.png", + "title_attachment_14x14.png", "title_config.png", "title_junk.png", "title_read_14x14.png",