From 33e49bcba1e1e17082c38ed7518e7093b8cd9de4 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Fri, 27 Jul 2007 17:31:39 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1122 d1b88da0-ebda-0310-925b-ed51d893ca5b --- UI/MailerUI/GNUmakefile | 5 +- UI/MailerUI/UIxMailEditorAttach.m | 251 ------------------------------ UI/MailerUI/UIxMailFilterPanel.m | 8 +- UI/MailerUI/UIxMailMainFrame.m | 9 +- UI/MailerUI/UIxMailView.m | 23 +-- UI/MailerUI/UIxMailWindowCloser.m | 8 +- UI/MailerUI/UIxSubjectFormatter.m | 7 +- UI/MailerUI/WOContext+UIxMailer.h | 2 +- UI/MailerUI/WOContext+UIxMailer.m | 2 +- UI/MailerUI/common.h | 34 ---- UI/MailerUI/product.plist | 1 - 11 files changed, 34 insertions(+), 316 deletions(-) delete mode 100644 UI/MailerUI/UIxMailEditorAttach.m delete mode 100644 UI/MailerUI/common.h diff --git a/UI/MailerUI/GNUmakefile b/UI/MailerUI/GNUmakefile index 38ee9ab7..0fb3d52a 100644 --- a/UI/MailerUI/GNUmakefile +++ b/UI/MailerUI/GNUmakefile @@ -28,15 +28,14 @@ MailerUI_OBJC_FILES += \ UIxMailAccountActions.m \ UIxMailFolderActions.m \ UIxMailEditor.m \ - UIxMailEditorAttach.m \ UIxMailEditorAction.m \ UIxMailReplyAction.m \ UIxMailForwardAction.m \ UIxMailToSelection.m \ UIxMailWindowCloser.m \ \ - UIxFilterList.m \ - \ +# UIxFilterList.m \ +# \ UIxMailUserRightsEditor.m # UIxSieveEditor.m diff --git a/UI/MailerUI/UIxMailEditorAttach.m b/UI/MailerUI/UIxMailEditorAttach.m deleted file mode 100644 index 3be38fe0..00000000 --- a/UI/MailerUI/UIxMailEditorAttach.m +++ /dev/null @@ -1,251 +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. -*/ - -#include - -/* - UIxMailEditorAction - - An mail editor component which works on SOGoDraftObject's. This component - manages the attachments of a draft object. -*/ - -@class NSArray, NSString, NSData; - -@interface UIxMailEditorAttach : UIxComponent -{ - NSString *filePath1; - NSString *filePath2; - NSString *filePath3; - NSData *fileData1; - NSData *fileData2; - NSData *fileData3; - NSString *attachmentName; - - NSArray *attachmentNames; -} - -@end - -#include -#include "common.h" - -@implementation UIxMailEditorAttach - -- (void)dealloc { - [self->attachmentNames release]; - [self->attachmentName release]; - [self->filePath1 release]; - [self->filePath2 release]; - [self->filePath3 release]; - [self->fileData1 release]; - [self->fileData2 release]; - [self->fileData3 release]; - [super dealloc]; -} - -/* accessors */ - -- (void)setAttachmentName:(NSString *)_value { - ASSIGNCOPY(self->attachmentName, _value); -} -- (NSString *)attachmentName { - return self->attachmentName; -} - -- (void)setFilePath1:(NSString *)_value { - ASSIGNCOPY(self->filePath1, _value); -} -- (NSString *)filePath1 { - return self->filePath1; -} - -- (void)setFilePath2:(NSString *)_value { - ASSIGNCOPY(self->filePath2, _value); -} -- (NSString *)filePath2 { - return self->filePath2; -} - -- (void)setFilePath3:(NSString *)_value { - ASSIGNCOPY(self->filePath3, _value); -} -- (NSString *)filePath3 { - return self->filePath3; -} - -- (void)setFileData1:(NSData *)_data { - ASSIGN(self->fileData1, _data); -} -- (NSData *)fileData1 { - return self->fileData1; -} - -- (void)setFileData2:(NSData *)_data { - ASSIGN(self->fileData2, _data); -} -- (NSData *)fileData2 { - return self->fileData2; -} - -- (void)setFileData3:(NSData *)_data { - ASSIGN(self->fileData3, _data); -} -- (NSData *)fileData3 { - return self->fileData3; -} - -- (NSArray *)attachmentNames { - NSArray *a; - - if (self->attachmentNames != nil) - return self->attachmentNames; - - a = [[self clientObject] fetchAttachmentNames]; - a = [a sortedArrayUsingSelector:@selector(compare:)]; - self->attachmentNames = [a copy]; - return self->attachmentNames; -} -- (BOOL)hasAttachments { - return [[self attachmentNames] count] > 0 ? YES : NO; -} - -/* requests */ - -- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{ - return YES; -} - -/* operations */ - -- (NSString *)defaultPathExtension { - return @"txt"; -} - -- (NSString *)newAttachmentName { - NSArray *usedNames; - unsigned i; - - usedNames = [[self clientObject] fetchAttachmentNames]; - for (i = [usedNames count]; i < 100; i++) { - NSString *name; - - name = [NSString stringWithFormat:@"attachment%d", i]; - if (![usedNames containsObject:name]) - return name; - } - [self errorWithFormat:@"too many attachments?!"]; - return nil; -} - -- (NSString *)fixupAttachmentName:(NSString *)_name { - NSString *pe; - NSRange r; - - if (_name == nil) - return nil; - - pe = [_name pathExtension]; - if ([pe length] == 0) - /* would be better to check the content-type, but well */ - pe = [self defaultPathExtension]; - - r = [_name rangeOfString:@"/"]; - if (r.length > 0) _name = [_name lastPathComponent]; - - r = [_name rangeOfString:@" "]; - if (r.length > 0) - _name = [_name stringByReplacingString:@" " withString:@"_"]; - - if ([_name hasPrefix:@"."]) { - _name = [@"dotfile-" stringByAppendingString: - [_name substringFromIndex:1]]; - } - - // TODO: should we need to check for umlauts? - - if ([_name length] == 0) - return [[self newAttachmentName] stringByAppendingPathExtension:pe]; - - return _name; -} - -- (BOOL)saveFileData:(NSData *)_data name:(NSString *)_name { - NSException *error; - - if (_data == nil) - return NO; - if ([_name length] == 0) { - _name = [self newAttachmentName]; - _name = [_name stringByAppendingPathExtension:[self defaultPathExtension]]; - } - - if ((_name = [self fixupAttachmentName:_name]) == nil) - return NO; - - // TODO: add size limit? - error = [[self clientObject] saveAttachment:_data withName:_name]; - if (error != nil) { - [self logWithFormat:@"ERROR: could not save: %@", error]; - return NO; - } - return YES; -} - -/* actions */ - -- (id)viewAttachmentsAction { - [self debugWithFormat:@"view attachments ..."]; - return self; -} - -- (id)attachAction { - BOOL ok; - - ok = YES; - if ([self->fileData1 length] > 0) - ok = [self saveFileData:self->fileData1 name:[self filePath1]]; - if (ok && [self->fileData2 length] > 0) - ok = [self saveFileData:self->fileData2 name:[self filePath2]]; - if (ok && [self->fileData3 length] > 0) - [self saveFileData:self->fileData3 name:[self filePath3]]; - - if (!ok) { - // TODO: improve error handling - return [NSException exceptionWithHTTPStatus:500 /* server error */ - reason:@"failed to save attachment ..."]; - } - - return [self redirectToLocation:@"viewAttachments"]; -} - -- (id)deleteAttachmentAction { - NSException *error; - - error = [[self clientObject] deleteAttachmentWithName:[self attachmentName]]; - - if (error != nil) - return error; - - return [self redirectToLocation:@"viewAttachments"]; -} - -@end /* UIxMailEditorAttach */ diff --git a/UI/MailerUI/UIxMailFilterPanel.m b/UI/MailerUI/UIxMailFilterPanel.m index a28dd800..ea38b7ed 100644 --- a/UI/MailerUI/UIxMailFilterPanel.m +++ b/UI/MailerUI/UIxMailFilterPanel.m @@ -19,7 +19,10 @@ 02111-1307, USA. */ -#include +#import +#import +#import +#import @interface UIxMailFilterPanel : WOComponent { @@ -29,9 +32,6 @@ @end -#include -#include "common.h" - @implementation UIxMailFilterPanel static NSArray *filters = nil; diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 43997a08..4c3e3bf2 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -19,15 +19,18 @@ 02111-1307, USA. */ +#import +#import +#import +#import + #import #import #import #import #import -#import "UIxMailMainFrame.h" -#import "common.h" -#import +#import "UIxMailMainFrame.h" @implementation UIxMailMainFrame diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index de312aa8..ecd299db 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -20,9 +20,21 @@ */ #import +#import +#import +#import +#import #import +#import +#import +#import +#import +#import +#import +#import +#import // cyclic -#include +#import "WOContext+UIxMailer.h" @interface UIxMailView : UIxComponent { @@ -33,15 +45,6 @@ @end -#include // cyclic -#include "WOContext+UIxMailer.h" -#include -#include -#include -#include -#include -#include "common.h" - @implementation UIxMailView static NSString *mailETag = nil; diff --git a/UI/MailerUI/UIxMailWindowCloser.m b/UI/MailerUI/UIxMailWindowCloser.m index cb80f477..b079dbf8 100644 --- a/UI/MailerUI/UIxMailWindowCloser.m +++ b/UI/MailerUI/UIxMailWindowCloser.m @@ -19,7 +19,7 @@ 02111-1307, USA. */ -#include +#import @interface UIxMailWindowCloser : WOComponent { @@ -28,15 +28,13 @@ @end -#include "common.h" - @implementation UIxMailWindowCloser - (void)setRefreshOpener:(BOOL)_flag { - self->refreshOpener = _flag; + refreshOpener = _flag; } - (BOOL)refreshOpener { - return self->refreshOpener; + return refreshOpener; } - (NSString *)refreshOpenerScript { diff --git a/UI/MailerUI/UIxSubjectFormatter.m b/UI/MailerUI/UIxSubjectFormatter.m index 683fd3ad..784c3a93 100644 --- a/UI/MailerUI/UIxSubjectFormatter.m +++ b/UI/MailerUI/UIxSubjectFormatter.m @@ -19,10 +19,11 @@ 02111-1307, USA. */ -#include "UIxMailFormatter.h" -#include "common.h" +#import +#import +#import -#include +#import "UIxMailFormatter.h" @implementation UIxSubjectFormatter diff --git a/UI/MailerUI/WOContext+UIxMailer.h b/UI/MailerUI/WOContext+UIxMailer.h index 483db2a4..05e94d29 100644 --- a/UI/MailerUI/WOContext+UIxMailer.h +++ b/UI/MailerUI/WOContext+UIxMailer.h @@ -22,7 +22,7 @@ #ifndef __Mailer_WOContext_UIxMailer_H__ #define __Mailer_WOContext_UIxMailer_H__ -#include +#import /* WOContext(UIxMailer) diff --git a/UI/MailerUI/WOContext+UIxMailer.m b/UI/MailerUI/WOContext+UIxMailer.m index 504e9be9..fbe50299 100644 --- a/UI/MailerUI/WOContext+UIxMailer.m +++ b/UI/MailerUI/WOContext+UIxMailer.m @@ -20,11 +20,11 @@ */ +#import #import #import #import "UIxMailFormatter.h" -#import "common.h" #import "WOContext+UIxMailer.h" diff --git a/UI/MailerUI/common.h b/UI/MailerUI/common.h deleted file mode 100644 index ca5c2267..00000000 --- a/UI/MailerUI/common.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2004 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. -*/ - -#warning importing common is baaaad -#import - -#if LIB_FOUNDATION_LIBRARY -# include -#elif NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY -# include -# include -#endif - -#include -#include -#include diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 44a84862..d8418c3a 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -354,7 +354,6 @@ categories = { edit = { protectedBy = "View"; pageName = "UIxMailEditor"; - actionName = "edit"; }; save = { protectedBy = "View"; -- 2.39.5