From 96b7e87198f4d8e764d371b7d5bf19f689456be5 Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 12 Feb 2005 21:00:46 +0000 Subject: [PATCH] implemented flag filtering (OGo bug #1210) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@548 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Mailer/ChangeLog | 8 +- SOGo/UI/Mailer/GNUmakefile | 2 + SOGo/UI/Mailer/UIxMailFilterPanel.m | 148 ++++++++++++++++++++++++++ SOGo/UI/Mailer/UIxMailFilterPanel.wox | 23 ++++ SOGo/UI/Mailer/UIxMailListView.m | 50 +++------ SOGo/UI/Mailer/UIxMailListView.wox | 17 +-- SOGo/UI/Mailer/UIxMailMoveToPopUp.m | 5 +- SOGo/UI/Mailer/Version | 45 ++++---- 8 files changed, 222 insertions(+), 76 deletions(-) create mode 100644 SOGo/UI/Mailer/UIxMailFilterPanel.m create mode 100644 SOGo/UI/Mailer/UIxMailFilterPanel.wox diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index b9047079..5f029d32 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,11 +1,17 @@ 2005-02-12 Helge Hess + * v0.9.100 + + * added support for filter popup (OGo bug #1210) + + * UIxMailListView: moved filter selection to an own component + * v0.9.99 * product.plist: also map index method of mail folder to UIxMailListView - * UIxMailListView.m: added subject/sender searching (bug OGo #1209) + * UIxMailListView.m: added subject/sender searching (OGo bug #1209) 2005-02-10 Helge Hess diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index abe80885..b9caf48d 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -28,6 +28,7 @@ MailerUI_OBJC_FILES += \ UIxMailView.m \ UIxMailSortableTableHeader.m \ UIxMailMoveToPopUp.m \ + UIxMailFilterPanel.m \ \ UIxMailEditor.m \ UIxMailEditorAttach.m \ @@ -66,6 +67,7 @@ MailerUI_RESOURCE_FILES += \ UIxMailView.wox \ UIxMailSortableTableHeader.wox \ UIxMailMoveToPopUp.wox \ + UIxMailFilterPanel.wox \ \ UIxMailEditor.wox \ UIxMailEditorAttach.wox \ diff --git a/SOGo/UI/Mailer/UIxMailFilterPanel.m b/SOGo/UI/Mailer/UIxMailFilterPanel.m new file mode 100644 index 00000000..6004bb0d --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailFilterPanel.m @@ -0,0 +1,148 @@ +/* + Copyright (C) 2000-2005 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. + */ + +#include + +@interface UIxMailFilterPanel : WOComponent +{ + NSString *searchText; +} + +@end + +#include +#include "common.h" + +@implementation UIxMailFilterPanel + +static NSArray *filters = nil; +static NSDictionary *filterToQualifier = nil; + ++ (void)initialize { + // TODO: also available: answered, draft [custom: NotJunk and Junk] + // Note: we currently cannot use: "flags != 'deleted'" + static NSString *quals[] = { + @"all", nil, + @"read", @"flags = 'seen' AND NOT (flags = 'deleted')", + @"unread", @"flags = 'unseen' AND NOT (flags = 'deleted')", + @"deleted", @"flags = 'deleted'", + @"flagged", @"flags = 'flagged'", + nil, nil + }; + NSMutableDictionary *md; + NSMutableArray *ma; + unsigned i; + + md = [[NSMutableDictionary alloc] initWithCapacity:8]; + ma = [[NSMutableArray alloc] initWithCapacity:4]; + + for (i = 0; quals[i] != nil; i += 2) { + [ma addObject:quals[i]]; + if (quals[i + 1] != nil) { + [md setObject:[EOQualifier qualifierWithQualifierFormat:quals[i + 1]] + forKey:quals[i]]; + } + } + + filterToQualifier = [md copy]; + filters = [ma copy]; + [md release]; md = nil; + [ma release]; ma = nil; +} + +- (void)dealloc { + [self->searchText release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setSearchText:(NSString *)_txt { + ASSIGNCOPY(self->searchText, _txt); +} +- (NSString *)searchText { + if (self->searchText == nil) { + // TODO: kinda hack + self->searchText = + [[[[self context] request] formValueForKey:@"searchtext"] copy]; + } + return self->searchText; +} + +/* filters */ + +- (NSArray *)filters { + return filters; +} + +/* qualifiers */ + +- (EOQualifier *)searchTextQualifier { + EOQualifier *q; + NSString *s; + + s = [self searchText]; + if ([s length] == 0) + return nil; + + q = [EOQualifier qualifierWithQualifierFormat: + @"(subject doesContain: %@) OR " + @"(from doesContain: %@)", + s, s]; + return q; +} + +- (NSString *)filterLabel { +#if 1 + return [[[self context] page] labelForKey:[self valueForKey:@"filter"]]; +#else + return [self valueForKey:@"filter"]; +#endif +} + +- (NSString *)selectedFilter { + return [[[self context] request] formValueForKey:@"filterpopup"]; +} + +- (EOQualifier *)filterQualifier { + NSString *selectedFilter; + + selectedFilter = [self selectedFilter]; + + return [selectedFilter length] > 0 + ? [filterToQualifier objectForKey:selectedFilter] : nil; +} + +- (EOQualifier *)qualifier { + EOQualifier *sq, *fq; + NSArray *qa; + + sq = [self searchTextQualifier]; + fq = [self filterQualifier]; + + if (fq == nil) return sq; + if (sq == nil) return fq; + + qa = [NSArray arrayWithObjects:fq, sq, nil]; + return [[[EOAndQualifier alloc] initWithQualifierArray:qa] autorelease]; +} + +@end /* UIxMailFilterPanel */ diff --git a/SOGo/UI/Mailer/UIxMailFilterPanel.wox b/SOGo/UI/Mailer/UIxMailFilterPanel.wox new file mode 100644 index 00000000..f87d879b --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailFilterPanel.wox @@ -0,0 +1,23 @@ + +
+ : + + + : + + +
diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index c7109a7c..08b0341b 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -28,13 +28,15 @@ object. */ +@class EOQualifier; + @interface UIxMailListView : UIxComponent { - NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ - NSArray *messages; - unsigned firstMessageNumber; - id message; - NSString *searchText; + NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ + NSArray *messages; + unsigned firstMessageNumber; + id message; + EOQualifier *qualifier; } - (NSString *)defaultSortKey; @@ -54,7 +56,7 @@ static int attachmentFlagSize = 8096; - (void)dealloc { - [self->searchText release]; + [self->qualifier release]; [self->sortedUIDs release]; [self->messages release]; [self->message release]; @@ -64,9 +66,10 @@ static int attachmentFlagSize = 8096; /* notifications */ - (void)sleep { + [self->qualifier release]; self->qualifier = nil; [self->sortedUIDs release]; self->sortedUIDs = nil; - [self->messages release]; self->messages = nil; - [self->message release]; self->message = nil; + [self->messages release]; self->messages = nil; + [self->message release]; self->message = nil; [super sleep]; } @@ -79,16 +82,11 @@ static int attachmentFlagSize = 8096; return self->message; } -- (void)setSearchText:(NSString *)_txt { - ASSIGNCOPY(self->searchText, _txt); +- (void)setQualifier:(EOQualifier *)_msg { + ASSIGN(self->qualifier, _msg); } -- (NSString *)searchText { - if (self->searchText == nil) { - // TODO: kinda hack - self->searchText = - [[[[self context] request] formValueForKey:@"searchtext"] copy]; - } - return self->searchText; +- (EOQualifier *)qualifier { + return self->qualifier; } - (BOOL)showToAddress { @@ -162,24 +160,6 @@ static int attachmentFlagSize = 8096; return keys; } -- (EOQualifier *)searchTextQualifier { - EOQualifier *q; - NSString *s; - - s = [self searchText]; - if ([s length] == 0) - return nil; - - q = [EOQualifier qualifierWithQualifierFormat: - @"(subject doesContain: %@) OR " - @"(from doesContain: %@)", - s, s]; - return q; -} -- (EOQualifier *)qualifier { - return [self searchTextQualifier]; -} - - (NSString *)defaultSortKey { return @"DATE"; } diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index 14bf9dcc..a4e87025 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -9,22 +9,7 @@ className="UIxMailMainFrame" title="panelTitle" > -
- - - : - - -
+
diff --git a/SOGo/UI/Mailer/UIxMailMoveToPopUp.m b/SOGo/UI/Mailer/UIxMailMoveToPopUp.m index ddefe1e2..19179c54 100644 --- a/SOGo/UI/Mailer/UIxMailMoveToPopUp.m +++ b/SOGo/UI/Mailer/UIxMailMoveToPopUp.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2000-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include @@ -53,6 +52,8 @@ [super dealloc]; } +/* accessors */ + - (void)setIdentifier:(NSString *)_identifier { ASSIGN(self->identifier, _identifier); } diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 67953ae1..aa1272ea 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,25 +1,26 @@ # version file -SUBMINOR_VERSION:=99 +SUBMINOR_VERSION:=100 -# v0.9.99 requires libNGMime v4.5.212 -# v0.9.97 requires SoObjects/Mailer v0.9.71 -# v0.9.97 requires libNGExtensions v4.5.142 -# v0.9.94 requires SoObjects/Mailer v0.9.69 -# v0.9.94 requires libNGMime v4.5.210 -# v0.9.91 requires SoObjects/Mailer v0.9.68 -# v0.9.89 requires SoObjects/Mailer v0.9.67 -# v0.9.87 requires SoObjects/Mailer v0.9.65 -# v0.9.86 requires SoObjects/Mailer v0.9.64 -# v0.9.85 requires SoObjects/Mailer v0.9.63 -# v0.9.84 requires libNGMime v4.5.209 -# v0.9.81 requires SoObjects/Sieve v0.9.5 -# v0.9.80 requires SoObjects/Mailer v0.9.59 -# v0.9.78 requires SoObjects/Mailer v0.9.58 -# v0.9.77 requires SoObjects/Mailer v0.9.57 -# v0.9.74 requires SoObjects/Mailer v0.9.56 -# v0.9.70 requires libNGExtensions v4.5.136 -# v0.9.69 requires libNGMime v4.5.203 -# v0.9.50 requires libNGMime v4.3.190 -# v0.9.43 requires libNGObjWeb v4.3.73 -# v0.9.42 requires libNGObjWeb v4.3.72 +# v0.9.100 requires libNGMime v4.5.213 +# v0.9.99 requires libNGMime v4.5.212 +# v0.9.97 requires SoObjects/Mailer v0.9.71 +# v0.9.97 requires libNGExtensions v4.5.142 +# v0.9.94 requires SoObjects/Mailer v0.9.69 +# v0.9.94 requires libNGMime v4.5.210 +# v0.9.91 requires SoObjects/Mailer v0.9.68 +# v0.9.89 requires SoObjects/Mailer v0.9.67 +# v0.9.87 requires SoObjects/Mailer v0.9.65 +# v0.9.86 requires SoObjects/Mailer v0.9.64 +# v0.9.85 requires SoObjects/Mailer v0.9.63 +# v0.9.84 requires libNGMime v4.5.209 +# v0.9.81 requires SoObjects/Sieve v0.9.5 +# v0.9.80 requires SoObjects/Mailer v0.9.59 +# v0.9.78 requires SoObjects/Mailer v0.9.58 +# v0.9.77 requires SoObjects/Mailer v0.9.57 +# v0.9.74 requires SoObjects/Mailer v0.9.56 +# v0.9.70 requires libNGExtensions v4.5.136 +# v0.9.69 requires libNGMime v4.5.203 +# v0.9.50 requires libNGMime v4.3.190 +# v0.9.43 requires libNGObjWeb v4.3.73 +# v0.9.42 requires libNGObjWeb v4.3.72 -- 2.39.5