Merge branch 'master' into fix-some-warnings

Conflicts:
	SoObjects/Appointments/SOGoAppointmentObject.m
This commit is contained in:
Patrice Levesque
2016-02-15 11:23:27 -05:00
66 changed files with 676 additions and 343 deletions
@@ -187,6 +187,13 @@
"Save As..." = "Save As...";
"Print Preview" = "Print Preview";
"View Message Source" = "View Message Source";
/* Message view "more" menu: create an event from message */
"Convert To Event" = "Convert To Event";
/* Message view "more" menu: create a task from message */
"Convert To Task" = "Convert To Task";
"Print..." = "Print...";
"Delete Message" = "Delete Message";
"Delete Selected Messages" = "Delete Selected Messages";
+59 -1
View File
@@ -1,6 +1,6 @@
/* UIxMailActions.m - this file is part of SOGo
*
* Copyright (C) 2007-2014 Inverse inc.
* Copyright (C) 2007-2016 Inverse inc.
*
* 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
@@ -24,10 +24,13 @@
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <SoObjects/Mailer/NSString+Mail.h>
#import <SoObjects/Mailer/SOGoDraftObject.h>
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/Mailer/SOGoMailObject+Draft.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
@@ -116,6 +119,61 @@
andString: [data jsonRepresentation]];
}
- (WOResponse *) viewPlainAction
{
BOOL htmlContent;
NSArray *acceptedTypes, *types;
NSDictionary *parts;
NSMutableArray *keys;
NSMutableDictionary *data;
NSString *rawPart, *contentKey, *subject, *content;
NSUInteger index;
SOGoMailObject *co;
co = [self clientObject];
subject = [co decodedSubject];
htmlContent = NO;
data = [NSMutableDictionary dictionary];
if (subject)
[data setObject: subject
forKey: @"subject"];
// Fetch the text parts of the message body structure
acceptedTypes = [NSArray arrayWithObjects: @"text/plain", @"text/html", nil];
keys = [NSMutableArray array];
[co addRequiredKeysOfStructure: [co bodyStructure]
path: @"" toArray: keys acceptedTypes: acceptedTypes
withPeek: NO];
// Use plain part if available, otherwise use the HTML part
types = [keys objectsForKey: @"mimeType" notFoundMarker: @""];
index = [types indexOfObject: @"text/plain"];
if (index == NSNotFound)
{
index = [types indexOfObject: @"text/html"];
htmlContent = YES;
}
// Fetch part and convert HTML if necessary
contentKey = [keys objectAtIndex: index];
parts = [co fetchPlainTextStrings: [NSArray arrayWithObject: contentKey]];
if ([parts count] > 0)
{
rawPart = [[parts allValues] objectAtIndex: 0];
if (htmlContent)
content = [rawPart htmlToText];
else
content = rawPart;
if (content)
[data setObject: [content stringByTrimmingSpaces]
forKey: @"content"];
}
return [self responseWithStatus: 201
andString: [data jsonRepresentation]];
}
/* active message */
- (id) markMessageUnflaggedAction
+18 -1
View File
@@ -612,9 +612,11 @@ static NSArray *infoKeys = nil;
{
NSDictionary *info;
NSException *error;
NSString *fontSize, *content;
NGMimeType *mimeType;
WORequest *request;
SOGoDraftObject *co;
SOGoUserDefaults *ud;
error = nil;
request = [context request];
@@ -632,7 +634,22 @@ static NSArray *infoKeys = nil;
info = [self infoFromRequest];
[co setHeaders: info];
[co setIsHTML: isHTML];
[co setText: (isHTML ? [NSString stringWithFormat: @"<html>%@</html>", text] : text)];;
if (isHTML)
{
// Set a base font size if mail is HTML and user has set a default font-size
ud = [[context activeUser] userDefaults];
fontSize = [ud mailComposeFontSize];
if ([fontSize intValue] > 0)
content = [NSString stringWithFormat: @"<html><span style=\"font-size: %@px;\">%@</span></html>",
fontSize, text];
else
content = [NSString stringWithFormat: @"<html>%@</html>", text];
}
else
{
content = text;
}
[co setText: content];
error = [co storeInfo];
}
+5
View File
@@ -278,6 +278,11 @@
actionClass = "UIxMailActions";
actionName = "forward";
};
viewplain = {
protectedBy = "View";
actionClass = "UIxMailActions";
actionName = "viewPlain";
};
markMessageUncollapse = {
protectedBy = "View";
actionClass = "UIxMailActions";