From 2ff6576f36693e1ccd1212b8f9ce9564919fb9e5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 3 Oct 2006 22:04:48 +0000 Subject: [PATCH] Monotone-Parent: 32b8651c607640726bff724790fc018ce587ad3e Monotone-Revision: db3a7e7fdd8662a109a9a31c651b6cfa55d16775 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-03T22:04:48 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 ++ UI/Contacts/GNUmakefile | 4 - ...tsListViewBase.h => UIxContactsListView.h} | 9 +- UI/Contacts/UIxContactsListView.m | 146 +++++++++++++++++- UI/Contacts/UIxContactsListViewBase.m | 139 ----------------- UI/Contacts/UIxContactsListViewContainer.h | 28 +++- .../UIxContactsListViewContainerBase.h | 49 ------ UI/Contacts/product.plist | 16 +- 8 files changed, 194 insertions(+), 206 deletions(-) rename UI/Contacts/{UIxContactsListViewBase.h => UIxContactsListView.h} (83%) delete mode 100644 UI/Contacts/UIxContactsListViewBase.m delete mode 100644 UI/Contacts/UIxContactsListViewContainerBase.h diff --git a/ChangeLog b/ChangeLog index 16b961b4c..6c0244f36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2006-10-03 Wolfgang Sourdeau + * UI/Contacts/UIxContactsSelectionViewContainer.m: removed since + we now use the action mechanism in UIxContactsListView to keep the + same view for the contact selectors and the regular contact view. + + * UI/Contacts/UIxContactsListViewContainer.[hm]: replaces + UIxContactsListViewContainerBase.[hm] + + * UI/Contacts/UIxContactsListView.[hm]: replaces UIxContactsListViewBase.[hm] + * UI/WebServerResources/generic.js: generalized emailstring handling functions. Generalized address book access functions. diff --git a/UI/Contacts/GNUmakefile b/UI/Contacts/GNUmakefile index e52b5541d..7faca8e7d 100644 --- a/UI/Contacts/GNUmakefile +++ b/UI/Contacts/GNUmakefile @@ -9,9 +9,6 @@ ContactsUI_PRINCIPAL_CLASS = ContactsUIProduct ContactsUI_LANGUAGES = English French ContactsUI_OBJC_FILES = \ - UIxContactsListViewBase.m \ - UIxContactsListViewContainerBase.m \ - \ UIxContactsSchedulerSelection.m \ UIxContactsMailerSelection.m \ \ @@ -22,7 +19,6 @@ ContactsUI_OBJC_FILES = \ UIxContactsListView.m \ UIxContactsListViewContainer.m \ UIxContactSelector.m \ - UIxContactsSelectionViewContainer.m \ UIxContactFoldersView.m \ ContactsUI_RESOURCE_FILES += \ diff --git a/UI/Contacts/UIxContactsListViewBase.h b/UI/Contacts/UIxContactsListView.h similarity index 83% rename from UI/Contacts/UIxContactsListViewBase.h rename to UI/Contacts/UIxContactsListView.h index 87ea5df23..92b4a72e4 100644 --- a/UI/Contacts/UIxContactsListViewBase.h +++ b/UI/Contacts/UIxContactsListView.h @@ -19,8 +19,8 @@ 02111-1307, USA. */ -#ifndef __UIxContactsListViewBase_H__ -#define __UIxContactsListViewBase_H__ +#ifndef __UIxContactsListView_H__ +#define __UIxContactsListView_H__ #import @@ -29,12 +29,13 @@ @protocol SOGoContactObject; -@interface UIxContactsListViewBase : UIxComponent +@interface UIxContactsListView : UIxComponent { NSString *searchText; NSDictionary *currentContact; + NSString *selectorComponentClass; } @end -#endif /* __UIxContactsListViewBase_H__ */ +#endif /* __UIxContactsListView_H__ */ diff --git a/UI/Contacts/UIxContactsListView.m b/UI/Contacts/UIxContactsListView.m index a3aa898d7..5e33fbdf8 100644 --- a/UI/Contacts/UIxContactsListView.m +++ b/UI/Contacts/UIxContactsListView.m @@ -19,10 +19,150 @@ 02111-1307, USA. */ -#include "UIxContactsListViewBase.h" +#import +#import +#import -@interface UIxContactsListView : UIxContactsListViewBase -@end +#import "common.h" + +#import "UIxContactsListView.h" @implementation UIxContactsListView + +- (id) init +{ + if ((self = [super init])) + { + selectorComponentClass = nil; + } + + return self; +} + +- (void) dealloc +{ + if (searchText) + [searchText release]; + [super dealloc]; +} + +/* accessors */ + +- (void) setCurrentContact: (NSDictionary *) _contact +{ + currentContact = _contact; +} + +- (NSDictionary *) currentContact +{ + return currentContact; +} + +- (void) setSearchText: (NSString *) _txt +{ + ASSIGNCOPY (searchText, _txt); +} + +- (id) searchText +{ + if (!searchText) + [self setSearchText: [self queryParameterForKey:@"search"]]; + + return searchText; +} + +- (NSString *) selectorComponentClass +{ + return selectorComponentClass; +} + +- (id) schedulerContactsAction +{ + selectorComponentClass = @"UIxContactsSchedulerSelection"; + + return self; +} + +- (id) mailerContactsAction +{ + selectorComponentClass = @"UIxContactsMailerSelection"; + + return self; +} + +- (NSString *) defaultSortKey +{ + return @"fn"; +} + +- (NSString *) displayName +{ + NSString *displayName; + + displayName = [currentContact objectForKey: @"displayName"]; + if (!(displayName && [displayName length] > 0)) + displayName = [currentContact objectForKey: @"cn"]; + + return displayName; +} + +- (NSString *) sortKey +{ + NSString *s; + + s = [self queryParameterForKey: @"sort"]; + if ([s length] == 0) + s = [self defaultSortKey]; + + return s; +} + +- (NSComparisonResult) sortOrdering +{ + return ([[self queryParameterForKey:@"desc"] boolValue] + ? NSOrderedDescending + : NSOrderedAscending); +} + +- (NSArray *) contactInfos +{ + id folder; + + folder = [self clientObject]; + + return [folder lookupContactsWithFilter: [self searchText] + sortBy: [self sortKey] + ordering: [self sortOrdering]]; +} + +/* notifications */ + +- (void) sleep +{ + if (searchText) + { + [searchText release]; + searchText = nil; + } + currentContact = nil; +// [allRecords release]; +// allRecords = nil; +// [filteredRecords release]; +// filteredRecords = nil; + [super sleep]; +} + +/* actions */ + +- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq + inContext: (WOContext*) _c +{ + return YES; +} + +- (BOOL) isPopup +{ + return [[self queryParameterForKey: @"popup"] boolValue]; +} + @end /* UIxContactsListView */ diff --git a/UI/Contacts/UIxContactsListViewBase.m b/UI/Contacts/UIxContactsListViewBase.m deleted file mode 100644 index 2f26aa090..000000000 --- a/UI/Contacts/UIxContactsListViewBase.m +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2004-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. -*/ - -#import -#import -#import - -#import "common.h" - -#import "UIxContactsListViewBase.h" - -@implementation UIxContactsListViewBase - -- (void) dealloc -{ - if (searchText) - [searchText release]; - [super dealloc]; -} - -/* accessors */ - -- (void) setCurrentContact: (NSDictionary *) _contact -{ - currentContact = _contact; -} - -- (NSDictionary *) currentContact -{ - return currentContact; -} - -- (void) setSearchText: (NSString *) _txt -{ - ASSIGNCOPY (searchText, _txt); -} - -- (id) searchText -{ - if (!searchText) - [self setSearchText: [self queryParameterForKey:@"search"]]; - - return searchText; -} - -- (NSString *) defaultSortKey -{ - return @"fn"; -} - -- (NSString *) displayName -{ - NSString *displayName; - - displayName = [currentContact objectForKey: @"displayName"]; - if (!(displayName && [displayName length] > 0)) - displayName = [currentContact objectForKey: @"cn"]; - - return displayName; -} - -- (NSString *) sortKey -{ - NSString *s; - - s = [self queryParameterForKey: @"sort"]; - if ([s length] == 0) - s = [self defaultSortKey]; - - return s; -} - -- (NSComparisonResult) sortOrdering -{ - return ([[self queryParameterForKey:@"desc"] boolValue] - ? NSOrderedDescending - : NSOrderedAscending); -} - -- (NSArray *) contactInfos -{ - id folder; - - folder = [self clientObject]; - - return [folder lookupContactsWithFilter: [self searchText] - sortBy: [self sortKey] - ordering: [self sortOrdering]]; -} - -/* notifications */ - -- (void) sleep -{ - if (searchText) - { - [searchText release]; - searchText = nil; - } - currentContact = nil; -// [allRecords release]; -// allRecords = nil; -// [filteredRecords release]; -// filteredRecords = nil; - [super sleep]; -} - -/* actions */ - -- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq - inContext: (WOContext*) _c -{ - return YES; -} - -- (BOOL) isPopup -{ - return [[self queryParameterForKey: @"popup"] boolValue]; -} - -@end /* UIxContactsListViewBase */ diff --git a/UI/Contacts/UIxContactsListViewContainer.h b/UI/Contacts/UIxContactsListViewContainer.h index ea3371a2f..71bb1df27 100644 --- a/UI/Contacts/UIxContactsListViewContainer.h +++ b/UI/Contacts/UIxContactsListViewContainer.h @@ -20,13 +20,31 @@ * Boston, MA 02111-1307, USA. */ -#ifndef UIXCONTACTSLISTVIEWCONTAINER_H -#define UIXCONTACTSLISTVIEWCONTAINER_H +#ifndef UIXCONTACTSLISTVIEWCONTAINERBASE_H +#define UIXCONTACTSLISTVIEWCONTAINERBASE_H -#import "UIxContactsListViewContainerBase.h" +#import -@interface UIxContactsListViewContainer : UIxContactsListViewContainerBase +@class NSArray; +@class SOGoContactFolder; + +@interface UIxContactsListViewContainer : UIxComponent +{ + NSString *foldersPrefix; + NSString *selectorComponentClass; + id currentFolder; +} + +- (void) setCurrentFolder: (id) folder; + +- (NSString *) foldersPrefix; + +- (NSArray *) contactFolders; + +- (NSString *) contactFolderId; +- (NSString *) currentContactFolderId; +- (NSString *) currentContactFolderName; @end -#endif /* UIXCONTACTSLISTVIEWCONTAINER_H */ +#endif /* UIXCONTACTSLISTVIEWCONTAINERBASE_H */ diff --git a/UI/Contacts/UIxContactsListViewContainerBase.h b/UI/Contacts/UIxContactsListViewContainerBase.h deleted file mode 100644 index bfc0e844d..000000000 --- a/UI/Contacts/UIxContactsListViewContainerBase.h +++ /dev/null @@ -1,49 +0,0 @@ -/* UIxContactsListViewContainerBase.h - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This file 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef UIXCONTACTSLISTVIEWCONTAINERBASE_H -#define UIXCONTACTSLISTVIEWCONTAINERBASE_H - -#import - -@class NSArray; -@class SOGoContactFolder; - -@interface UIxContactsListViewContainerBase : UIxComponent -{ - NSString *foldersPrefix; - id currentFolder; -} - -- (void) setCurrentFolder: (id) folder; - -- (NSString *) foldersPrefix; - -- (NSArray *) contactFolders; - -- (NSString *) contactFolderId; -- (NSString *) currentContactFolderId; -- (NSString *) currentContactFolderName; - -@end - -#endif /* UIXCONTACTSLISTVIEWCONTAINERBASE_H */ diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index 532dc360b..1108f5ca0 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -51,11 +51,13 @@ }; scheduler-contacts = { protectedBy = "View"; - pageName = "UIxContactsSchedulerSelection"; + pageName = "UIxContactsListView"; + actionName = "schedulerContacts"; }; mailer-contacts = { protectedBy = "View"; - pageName = "UIxContactsMailerSelection"; + pageName = "UIxContactsListView"; + actionName = "mailerContacts"; }; }; }; @@ -77,6 +79,16 @@ pageName = "UIxContactEditor"; actionName = "new"; }; + scheduler-contacts = { + protectedBy = "View"; + pageName = "UIxContactsListView"; + actionName = "schedulerContacts"; + }; + mailer-contacts = { + protectedBy = "View"; + pageName = "UIxContactsListView"; + actionName = "mailerContacts"; + }; }; };