2 Copyright (C) 2000-2005 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
22 #import <NGObjWeb/WOContext.h>
23 #import <NGObjWeb/WORequest.h>
24 #import <EOControl/EOQualifier.h>
25 #import <NGObjWeb/WOComponent.h>
27 @interface UIxMailFilterPanel : WOComponent
30 NSString *searchCriteria;
35 @implementation UIxMailFilterPanel
37 static NSArray *filters = nil;
38 // static NSDictionary *filterToQualifier = nil;
41 // TODO: also available: answered, draft [custom: NotJunk and Junk]
42 // Note: we currently cannot use: "flags != 'deleted'"
43 static NSString *quals[] = {
45 @"read", @"flags = 'seen' AND NOT (flags = 'deleted')",
46 @"unread", @"flags = 'unseen' AND NOT (flags = 'deleted')",
47 @"deleted", @"flags = 'deleted'",
48 @"flagged", @"flags = 'flagged'",
51 NSMutableDictionary *md;
55 md = [[NSMutableDictionary alloc] initWithCapacity:8];
56 ma = [[NSMutableArray alloc] initWithCapacity:4];
58 for (i = 0; quals[i] != nil; i += 2) {
59 [ma addObject:quals[i]];
60 if (quals[i + 1] != nil) {
61 [md setObject:[EOQualifier qualifierWithQualifierFormat:quals[i + 1]]
66 // filterToQualifier = [md copy];
68 [md release]; md = nil;
69 [ma release]; ma = nil;
74 if ((self = [super init]))
85 [searchCriteria release];
92 - (void) setSearchText: (NSString *) _txt
94 ASSIGN (searchText, _txt);
97 - (void) setSearchCriteria: (NSString *) _txt
99 ASSIGN (searchText, _txt);
102 - (NSString *) searchText
106 searchText = [[context request] formValueForKey: @"value"];
113 - (NSString *) searchCriteria
117 searchCriteria = [[context request] formValueForKey: @"criteria"];
118 [searchCriteria retain];
121 return searchCriteria;
126 - (NSArray *) filters
133 // - (EOQualifier *) searchTextQualifier
138 // s = [self searchText];
139 // if ([s length] == 0)
142 // q = [EOQualifier qualifierWithQualifierFormat:
143 // @"(subject doesContain: %@) OR "
144 // @"(from doesContain: %@)",
149 // - (NSString *) filterLabel
152 // return [[context page] labelForKey:[self valueForKey:@"filter"]];
154 // return [self valueForKey:@"filter"];
158 // - (NSString *) selectedFilter
160 // return [[context request] formValueForKey: @"filterpopup"];
163 // - (EOQualifier *) filterQualifier
165 // NSString *selectedFilter;
167 // selectedFilter = [self selectedFilter];
169 // return [selectedFilter length] > 0
170 // ? [filterToQualifier objectForKey:selectedFilter] : nil;
173 // - (EOQualifier *) qualifier
175 // EOQualifier *sq, *fq;
178 // sq = [self searchTextQualifier];
179 // fq = [self filterQualifier];
181 // if (fq == nil) return sq;
182 // if (sq == nil) return fq;
184 // qa = [NSArray arrayWithObjects:fq, sq, nil];
186 // return [[[EOAndQualifier alloc] initWithQualifierArray:qa] autorelease];
189 @end /* UIxMailFilterPanel */