diff --git a/ChangeLog b/ChangeLog index c038a6eec..47df8e9b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 2007-08-15 Wolfgang Sourdeau + * UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame + -mailAccounts]): rewrote method to return the name of the mail + accounts now available with the -[SOGoUser mailAccounts] method. + ([UIxMailMainFrame -showLinkBanner]): removed method. + ([UIxMailMainFrame -bannerToolbarStyle]): removed method. + ([UIxMailMainFrame -bannerConsumeStyle]): removed method. + ([UIxMailMainFrame -rootURL]): removed method. + ([UIxMailMainFrame -userRootURL]): removed method. + ([UIxMailMainFrame -calendarRootURL]): removed method. + ([UIxMailMainFrame -contactsRootURL]): removed method. + ([UIxMailMainFrame -hasErrorText]) + ([UIxMailMainFrame -errorText]) + ([UIxMailMainFrame -errorAlertJavaScript]): removed methods. + ([-composeAction]): removed method. Now provided by + UIxMailAccountActions. + ([UIxMailMainFrame -setHideFolderTree:_flag]): removed method. + ([UIxMailMainFrame -hideFolderTree]): removed method. + ([UIxMailMainFrame -treeRootClassName]): removed method. + ([UIxMailMainFrame +initialize]): removed method. + SOGoMailTreeRootClass userdefaults will no longer have any effect. + * UI/Common/WODirectAction+SOGo.m ([WODirectAction -redirectToLocation:newLocation]): new method that implements the same functionality as WOComponent. diff --git a/UI/MailerUI/UIxMailMainFrame.h b/UI/MailerUI/UIxMailMainFrame.h index 2de756099..9e5ddd282 100644 --- a/UI/MailerUI/UIxMailMainFrame.h +++ b/UI/MailerUI/UIxMailMainFrame.h @@ -1,4 +1,4 @@ -/* UIxMailMainFrame.h - this file is part of $PROJECT_NAME_HERE$ +/* UIxMailMainFrame.h - this file is part of SOGo * * Copyright (C) 2006 Inverse groupe conseil * @@ -23,21 +23,9 @@ #ifndef UIXMAILMAINFRAME_H #define UIXMAILMAINFRAME_H -#import "../Common/UIxPageFrame.h" +#import "../Common/UIxComponent.h" -@interface UIxMailMainFrame : UIxPageFrame -{ - NSString *rootURL; - NSString *userRootURL; - struct { - int hideFolderTree:1; - int reserved:31; - } mmfFlags; -} - -- (NSString *)rootURL; -- (NSString *)userRootURL; -- (NSString *)calendarRootURL; +@interface UIxMailMainFrame : UIxComponent @end diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 95c64ca83..9ad78fb1e 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -26,54 +26,27 @@ #import #import -#import -#import +#import +#import #import #import "UIxMailMainFrame.h" @implementation UIxMailMainFrame -static NSString *treeRootClassName = nil; - -+ (void)initialize { - NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; - - treeRootClassName = [[ud stringForKey:@"SOGoMailTreeRootClass"] copy]; - if (treeRootClassName) - NSLog(@"Note: use class '%@' as root for mail tree.", treeRootClassName); - else - treeRootClassName = @"SOGoMailAccounts"; -} - -- (void)dealloc { - [self->rootURL release]; - [self->userRootURL release]; - [super dealloc]; -} - /* accessors */ - (NSString *) mailAccounts { - SOGoMailAccounts *co; + NSArray *accounts, *accountNames; - co = [self clientObject]; + accounts = [[context activeUser] mailAccounts]; + accountNames = [accounts objectsForKey: @"name"]; - return [[co fetchAllIdentities] jsonRepresentation]; + return [accountNames jsonRepresentation]; } -- (NSString *)treeRootClassName { - return treeRootClassName; -} - -- (void)setHideFolderTree:(BOOL)_flag { - self->mmfFlags.hideFolderTree = _flag ? 1 : 0; -} -- (BOOL)hideFolderTree { - return self->mmfFlags.hideFolderTree ? YES : NO; -} - -- (NSString *) pageFormURL { +- (NSString *) pageFormURL +{ NSString *u; NSRange r; @@ -117,136 +90,4 @@ static NSString *treeRootClassName = nil; return [u hasSuffix:@"/"] ? @"view" : @"#"; } -- (BOOL)showLinkBanner { - return YES; -} - -- (NSString *)bannerToolbarStyle { - return nil; -} - -- (NSString *)bannerConsumeStyle { - return nil; -} - -/* URL generation */ -// TODO: I think all this should be done by the clientObject?! -// TODO: is the stuff below necessary at all in the mailer frame? - -- (NSString *)rootURL { - WOContext *ctx; - NSArray *traversalObjects; - - if (self->rootURL != nil) - return self->rootURL; - - ctx = [self context]; - traversalObjects = [ctx objectTraversalStack]; - self->rootURL = [[[traversalObjects objectAtIndex:0] - rootURLInContext:ctx] - copy]; - return self->rootURL; -} - -- (NSString *)userRootURL { - WOContext *ctx; - NSArray *traversalObjects; - - if (self->userRootURL) - return self->userRootURL; - - ctx = [self context]; - traversalObjects = [ctx objectTraversalStack]; - self->userRootURL = [[[[traversalObjects objectAtIndex:1] - baseURLInContext:ctx] - stringByAppendingString:@"/"] - retain]; - return self->userRootURL; -} - -- (NSString *)calendarRootURL { - return [[self userRootURL] stringByAppendingString:@"Calendar/"]; -} - -- (NSString *)contactsRootURL { - return [[self userRootURL] stringByAppendingString:@"Contacts/"]; -} - -/* error handling */ - -- (BOOL)hasErrorText { - return [[[[self context] request] formValueForKey:@"error"] length] > 0 - ? YES : NO; -} -- (NSString *)errorText { - return [[[self context] request] formValueForKey:@"error"]; -} - -- (NSString *)errorAlertJavaScript { - NSString *errorText; - - if ([(errorText = [self errorText]) length] == 0) - return nil; - - // TODO: proper JavaScript escaping - errorText = [errorText stringByEscapingHTMLString]; - errorText = [errorText stringByReplacingString:@"\"" withString:@"'"]; - - return [NSString stringWithFormat: - @"", errorText]; -} - -/* FIXME: migrated methods which might not work yet... */ -// #warning check this -// - (NSString *) mailFolderName -// { -// NSMutableArray *mailboxes; -// SOGoMailObject *currentObject; - -// mailboxes = [NSMutableArray new]; -// [mailboxes autorelease]; - -// currentObject = [self clientObject]; -// while (![currentObject isKindOfClass: [SOGoMailAccounts class]]) -// { -// [mailboxes insertObject: [currentObject nameInContainer] atIndex: 0]; -// currentObject = [currentObject container]; -// } - -// return [NSString stringWithFormat: @"/%@", -// [mailboxes componentsJoinedByString: @"/"]]; -// } - -- (id) composeAction -{ - NSArray *c; - NSString *inbox, *url, *parameter; - NSMutableDictionary *urlParams; - id actionResult; - - c = [[self clientObject] toManyRelationshipKeys]; - if ([c count] > 0) - { - urlParams = [NSMutableDictionary new]; - [urlParams autorelease]; - - parameter = [self queryParameterForKey: @"mailto"]; - if (parameter) - [urlParams setObject: parameter - forKey: @"mailto"]; - inbox = [NSString stringWithFormat: @"%@/folderINBOX", - [c objectAtIndex: 0]]; - url = [inbox composeURLWithAction: @"compose" - parameters: urlParams - andHash: NO]; - actionResult = [self redirectToLocation: url]; - } - else - actionResult = self; - - return actionResult; -} - @end /* UIxMailMainFrame */