Add links to download one or all attachments

Also removed the contextual menu over file attachments and changed the
label color when moving over the file attachments.
This commit is contained in:
Francis Lachapelle
2013-12-20 15:37:01 -05:00
parent dc21c723f6
commit 5f369f201d
11 changed files with 172 additions and 74 deletions
+46 -1
View File
@@ -47,11 +47,12 @@
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGoUI/UIxComponent.h>
#import <Mailer/SOGoMailObject.h>
#import <Mailer/SOGoMailAccount.h>
#import <Mailer/SOGoMailFolder.h>
#import <SOGoUI/UIxComponent.h>
#import <MailPartViewers/UIxMailRenderingContext.h> // cyclic
#import <MailPartViewers/UIxMailSizeFormatter.h>
#import "WOContext+UIxMailer.h"
@@ -60,6 +61,8 @@
id currentAddress;
NSString *shouldAskReceipt;
NSString *matchingIdentityEMail;
NSDictionary *attachment;
NSArray *attachmentAttrs;
}
@end
@@ -80,6 +83,8 @@ static NSString *mailETag = nil;
- (void) dealloc
{
[matchingIdentityEMail release];
[attachment release];
[attachmentAttrs release];
[super dealloc];
}
@@ -111,6 +116,16 @@ static NSString *mailETag = nil;
[self messageSubject]];
}
- (void) setAttachment: (NSDictionary *) newAttachment
{
ASSIGN (attachment, newAttachment);
}
- (NSDictionary *) attachment
{
return attachment;
}
/* links (DUP to UIxMailPartViewer!) */
- (NSString *) linkToEnvelopeAddress: (NGImap4EnvelopeAddress *) _address
@@ -146,6 +161,36 @@ static NSString *mailETag = nil;
return [[[self clientObject] replyToEnvelopeAddresses] count] > 0 ? YES : NO;
}
/* attachment helper */
- (NSArray *) attachmentAttrs
{
if (!attachmentAttrs)
{
ASSIGN (attachmentAttrs, [[self clientObject] fetchFileAttachmentKeys]);
}
return attachmentAttrs;
}
- (BOOL) hasAttachments
{
return [[self attachmentAttrs] count] > 0 ? YES : NO;
}
- (NSFormatter *) sizeFormatter
{
return [UIxMailSizeFormatter sharedMailSizeFormatter];
}
- (NSString *) attachmentsText
{
if ([[self attachmentAttrs] count] > 1)
return [self labelForKey: @"files"];
else
return [self labelForKey: @"file"];
}
/* viewers */
- (id) contentViewerComponent