From: helge Date: Sat, 2 Oct 2004 20:11:06 +0000 (+0000) Subject: mailer improvements X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d50085c73af00fc9637633f3ec8365d8aa822dbb;p=scalable-opengroupware.org mailer improvements git-svn-id: http://svn.opengroupware.org/SOGo/trunk@342 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 793d2f22..325083a2 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2004-10-02 Helge Hess + + * SOGoMailFolder.[hm]: removed ability to restrict UID fetch range, + need to fetch all (qualifier matching!) UIDs anyway (v0.9.19) + 2004-10-01 Helge Hess * more work on fetching mails (v0.9.18) diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.h b/SOGo/SoObjects/Mailer/SOGoMailFolder.h index 82ac0d5d..4b622cab 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.h @@ -42,8 +42,7 @@ /* messages */ -- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so - range:(NSRange)_r; +- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so; - (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts; @end diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 2d1c9dab..5025b049 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -42,11 +42,10 @@ /* messages */ -- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so - range:(NSRange)_r -{ +- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so { return [[self mailManager] fetchUIDsInURL:[self imap4URL] - qualifier:_q sortOrdering:_so range:_r + qualifier:_q sortOrdering:_so + range:NSMakeRange(0, 100000) password:[self imap4Password]]; } diff --git a/SOGo/SoObjects/Mailer/SOGoMailManager.m b/SOGo/SoObjects/Mailer/SOGoMailManager.m index 39efa976..f65ae96c 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailManager.m +++ b/SOGo/SoObjects/Mailer/SOGoMailManager.m @@ -375,9 +375,22 @@ static NSTimeInterval PoolScanInterval = 5 * 60; - (NSArray *)fetchUIDs:(NSArray *)_uids inURL:(NSURL *)_url parts:(NSArray *)_parts password:(NSString *)_pwd { + /* + Allowed fetch keys: + UID + BODY.PEEK[
]<> + BODYSTRUCTURE + ENVELOPE [this is a parsed header, but does not include type] + FLAGS + INTERNALDATE + RFC822 + RFC822.HEADER + RFC822.SIZE + RFC822.TEXT + */ NGImap4Client *client; NSDictionary *result; - + if (_uids == nil) return nil; if ([_uids count] == 0) diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index cd35ad0f..93c8cd1d 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=18 +SUBMINOR_VERSION:=19 diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index 5162ee99..ac900420 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,7 @@ 2004-10-02 Helge Hess + * more work on UI (v0.9.9) + * added formatters for mail list (v0.9.8) * v0.9.7 diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index cc86c777..3b256fea 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -25,6 +25,8 @@ @interface UIxMailListView : UIxComponent { + NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ + NSArray *messages; id message; } @@ -37,14 +39,19 @@ @implementation UIxMailListView - (void)dealloc { - [self->message release]; + [self->sortedUIDs release]; + [self->messages release]; + [self->message release]; [super dealloc]; } /* notifications */ - (void)sleep { - [self->message release]; self->message = nil; + [self->sortedUIDs release]; self->sortedUIDs = nil; + [self->messages release]; self->messages = nil; + [self->message release]; self->message = nil; + [self logWithFormat:@"SLEEP"]; [super sleep]; } @@ -74,37 +81,105 @@ return [[[self message] valueForKey:@"uid"] stringValue]; } -- (NSArray *)messages { - NSArray *uids; - NSArray *msgs; +/* fetching messages */ + +- (NSArray *)fetchKeys { + /* Note: see SOGoMailManager.m for allowed IMAP4 keys */ + static NSArray *keys = nil; + if (keys == nil) + keys = [[NSArray alloc] initWithObjects:@"FLAGS", @"ENVELOPE", nil]; + return keys; +} + +- (id)qualifier { + return nil; +} + +- (NSString *)imap4SortKey { + return @"SUBJECT"; +} - uids = [[self clientObject] fetchUIDsMatchingQualifier:nil - sortOrdering:@"SUBJECT" - range:NSMakeRange(0, 50)]; +- (NSRange)fetchRange { + return NSMakeRange(0, 50); +} + +- (NSArray *)sortedUIDs { + if (self->sortedUIDs != nil) + return self->sortedUIDs; + + self->sortedUIDs + = [[[self clientObject] fetchUIDsMatchingQualifier:[self qualifier] + sortOrdering:[self imap4SortKey]] retain]; + return self->sortedUIDs; +} +- (unsigned int)totalMessageCount { + return [self->sortedUIDs count]; +} +- (BOOL)showsAllMessages { + return ([[self sortedUIDs] count] <= [self fetchRange].length) ? YES : NO; +} + +- (NSRange)fetchBlock { + NSRange r; + unsigned len; + NSArray *uids; + + r = [self fetchRange]; + uids = [self sortedUIDs]; + + /* only need to restrict if we have a lot */ + if ((len = [uids count]) <= r.length) { + r.location = 0; + r.length = len; + return r; + } - [self logWithFormat:@"#UIDs: %d", [uids count]]; - - /* - Allowed fetch keys: - UID - BODY.PEEK[
]<> - BODYSTRUCTURE - ENVELOPE [this is a parsed header, but does not include type] - FLAGS - INTERNALDATE - RFC822 - RFC822.HEADER - RFC822.SIZE - RFC822.TEXT - */ + if (len < r.location) { +#warning CHECK CONDITION (< vs <=) + /* out of range, recover at first block */ + r.location = 0; + return r; + } - msgs = [[self clientObject] fetchUIDs:uids - parts:[NSArray arrayWithObjects: - @"FLAGS", - @"ENVELOPE", - nil]]; - [self logWithFormat:@" msg #%d", [[msgs valueForKey:@"fetch"] count]]; - return [msgs valueForKey:@"fetch"]; + if (r.location + r.length > len) + r.length = len - r.location; + return r; +} +- (unsigned int)firstMessageNumber { + return [self fetchBlock].location + 1; +} +- (unsigned int)lastMessageNumber { + NSRange r; + + r = [self fetchBlock]; + return r.location + r.length; +} +- (BOOL)hasPrevious { + return [self fetchBlock].location == 0 ? NO : YES; +} +- (BOOL)hasNext { + NSRange r = [self fetchBlock]; + return r.location + r.length >= [[self sortedUIDs] count] ? NO : YES; +} + +- (NSArray *)messages { + NSArray *uids; + NSArray *msgs; + NSRange r; + unsigned len; + + if (self->messages != nil) + return self->messages; + + r = [self fetchBlock]; + uids = [self sortedUIDs]; + if ((len = [uids count]) > r.length) + /* only need to restrict if we have a lot */ + uids = [uids subarrayWithRange:r]; + + msgs = [[self clientObject] fetchUIDs:uids parts:[self fetchKeys]]; + self->messages = [[msgs valueForKey:@"fetch"] retain]; + return self->messages; } /* URL processing */ @@ -146,4 +221,9 @@ return [self redirectToLocation:@"view"]; } +- (id)getMailAction { + // TODO: we might want to flush the caches? + return [self redirectToLocation:@"view"]; +} + @end /* UIxMailListView */ diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index 1ab00da6..bed43b2b 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -46,7 +46,31 @@ - + + + + + + + + + + prev | + + + + + + + + + + | next + + + + + diff --git a/SOGo/UI/Mailer/UIxMailMainFrame.m b/SOGo/UI/Mailer/UIxMailMainFrame.m index 025a8d7f..d545c4fb 100644 --- a/SOGo/UI/Mailer/UIxMailMainFrame.m +++ b/SOGo/UI/Mailer/UIxMailMainFrame.m @@ -27,7 +27,8 @@ NSString *title; NSString *rootURL; NSString *userRootURL; - id item; + id item; + BOOL hideFolderTree; } - (NSString *)rootURL; @@ -51,6 +52,13 @@ /* accessors */ +- (void)setHideFolderTree:(BOOL)_flag { + self->hideFolderTree = _flag; +} +- (BOOL)hideFolderTree { + return self->hideFolderTree; +} + - (void)setTitle:(NSString *)_value { ASSIGNCOPY(self->title, _value); } diff --git a/SOGo/UI/Mailer/UIxMailMainFrame.wox b/SOGo/UI/Mailer/UIxMailMainFrame.wox index 4e91dc6c..100339b9 100644 --- a/SOGo/UI/Mailer/UIxMailMainFrame.wox +++ b/SOGo/UI/Mailer/UIxMailMainFrame.wox @@ -27,17 +27,24 @@ --> - - - + + + + + + + @@ -65,24 +72,30 @@
- - - + + + +
-
Folders
-
-
-
- + + + + + + + + - - - -
+
Folders
+
+
+
+ +
- -
- -
+
+ +
+
diff --git a/SOGo/UI/Mailer/UIxMailView.m b/SOGo/UI/Mailer/UIxMailView.m index e04f18b5..0341e336 100644 --- a/SOGo/UI/Mailer/UIxMailView.m +++ b/SOGo/UI/Mailer/UIxMailView.m @@ -59,4 +59,9 @@ return [self redirectToLocation:url]; } +- (id)getMailAction { + // TODO: we might want to flush the caches? + return [self redirectToLocation:@"view"]; +} + @end /* UIxMailView */ diff --git a/SOGo/UI/Mailer/UIxMailView.wox b/SOGo/UI/Mailer/UIxMailView.wox index 3ef7f9ec..95dae8ae 100644 --- a/SOGo/UI/Mailer/UIxMailView.wox +++ b/SOGo/UI/Mailer/UIxMailView.wox @@ -6,10 +6,40 @@ xmlns:uix="OGo:uix" xmlns:rsrc="OGo:url" xmlns:label="OGo:label" - className="UIxPageFrame" + className="UIxMailMainFrame" title="name" + const:hideFolderTree="1" > -

Mail View

+ + + + + + + + + + + + + + + + + +
:Re: Statuslist
: + + Maxime Wacker [mwacker@linagora.com] +
:08.09.2004 15:32
: + + Helge Hess [helge.hess@skyrix.com] +
+ +
+ a b c
+ +
+ diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 28292b54..81be7eb6 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=8 +SUBMINOR_VERSION:=9 diff --git a/SOGo/UI/Mailer/mailer.css b/SOGo/UI/Mailer/mailer.css index 1275fb3e..29cfbfa6 100644 --- a/SOGo/UI/Mailer/mailer.css +++ b/SOGo/UI/Mailer/mailer.css @@ -137,11 +137,26 @@ td.tb_icon a { /* mail tableview */ .tableview { - font-size: 9pt; - font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; + font-size: 9pt; + font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; vertical-align: top; } +td.tbtv_navcell { + border-width: 1; + border-style: solid; + border-top-color: white; + border-left-color: white; + border-bottom-color: #808080; + border-right-color: #808080; + padding-top: 4px; + padding-bottom: 3px; + padding-left: 4px; + padding-right: 4px; + + background-color: #D4D0C8; +} + td.tbtv_headercell { border-width: 1; border-style: solid; @@ -224,3 +239,38 @@ div.mailer_unreadicon a { margin: 0px auto; display: block; } + +/* fields (key/value UI), eg used in mail viewer */ + +table.mailer_fieldtable { + width: 100%; + + border-bottom-color: #808080; + border-bottom-width: 1; + border-bottom-style: solid; +} +tr.mailer_fieldrow { + font-size: 9pt; + font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif; +} +td.mailer_fieldname { + padding-left: 24px; + text-align: right; + font-weight: bold; +} +td.mailer_fieldvalue { + width: 95%; +} +td.mailer_subjectfieldvalue { + font-weight: bold; +} +td.mailer_fieldvalue a { + text-decoration: underline; +} + +div.mailer_mailcontent { + border-top-color: white; + border-top-width: 1; + border-top-style: solid; + background-color: white; +} diff --git a/SOGo/UI/Mailer/product.plist b/SOGo/UI/Mailer/product.plist index 492458f9..6ce95d4a 100644 --- a/SOGo/UI/Mailer/product.plist +++ b/SOGo/UI/Mailer/product.plist @@ -74,6 +74,11 @@ pageName = "UIxMailListView"; actionName = "markMessageRead"; }; + getMail = { + protectedBy = "View"; + pageName = "UIxMailListView"; + actionName = "getMail"; + }; }; }; @@ -83,6 +88,13 @@ protectedBy = "View"; pageName = "UIxMailView"; }; + + getMail = { + protectedBy = "View"; + pageName = "UIxMailView"; + actionName = "getMail"; + }; + delete = { protectedBy = "View"; pageName = "UIxMailView";