From cf0e0691f6edab754e911f7b5f50bf0c5e1180f1 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2012 21:46:23 -0400 Subject: [PATCH 001/105] Accelerated basic page loading by caching the user language --- SoObjects/SOGo/SOGoUserDefaults.h | 3 ++ SoObjects/SOGo/SOGoUserDefaults.m | 47 ++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index 287d0a0ca..d8b56ef0a 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -35,6 +35,9 @@ extern NSString *SOGoWeekStartFirst4DayWeek; extern NSString *SOGoWeekStartFirstFullWeek; @interface SOGoUserDefaults : SOGoDefaultsSource +{ + NSString *userLanguage; +} + (SOGoUserDefaults *) defaultsForUser: (NSString *) userId inDomain: (NSString *) domainId; diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index 3d728d398..6d05afbba 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -22,6 +22,7 @@ #import #import +#import #import #import @@ -91,6 +92,22 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return ud; } +- (id) init +{ + if ((self = [super init])) + { + userLanguage = nil; + } + + return self; +} + +- (void) dealloc +{ + [userLanguage release]; + [super dealloc]; +} + - (BOOL) _migrateLastModule { BOOL rc; @@ -355,21 +372,25 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; - (NSString *) language { - NSString *language; NSArray *supportedLanguages; - - /* see SOGoDomainDefaults for the meaning of this */ - language = [source objectForKey: @"SOGoLanguage"]; - if (!(language && [language isKindOfClass: [NSString class]])) - language = [(SOGoDomainDefaults *) parentSource language]; - - /* make sure the language is part of the supported languages */ - supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults] - supportedLanguages]; - if (![supportedLanguages containsObject: language]) - language = [parentSource stringForKey: @"SOGoLanguage"]; - return language; + if (!userLanguage) + { + /* see SOGoDomainDefaults for the meaning of this */ + userLanguage = [source objectForKey: @"SOGoLanguage"]; + if (!(userLanguage && [userLanguage isKindOfClass: [NSString class]])) + userLanguage = [(SOGoDomainDefaults *) parentSource language]; + + supportedLanguages = [[SOGoSystemDefaults sharedSystemDefaults] + supportedLanguages]; + + /* make sure the language is part of the supported languages */ + if (![supportedLanguages containsObject: userLanguage]) + userLanguage = [parentSource stringForKey: @"SOGoLanguage"]; + [userLanguage retain]; + } + + return userLanguage; } - (void) setMailShowSubscribedFoldersOnly: (BOOL) newValue From 99296231194d352db4f9536035826b640a9f1a25 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 25 Oct 2012 21:58:34 -0400 Subject: [PATCH 002/105] Accelerated basic page loading by caching the list of supported languages --- SoObjects/SOGo/SOGoSystemDefaults.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m index 9818f70b7..df1ed413f 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.m +++ b/SoObjects/SOGo/SOGoSystemDefaults.m @@ -379,7 +379,15 @@ _injectConfigurationFromFile (NSUserDefaults *ud, - (NSArray *) supportedLanguages { - return [self stringArrayForKey: @"SOGoSupportedLanguages"]; + static NSArray *supportedLanguages = nil; + + if (!supportedLanguages) + { + supportedLanguages = [self stringArrayForKey: @"SOGoSupportedLanguages"]; + [supportedLanguages retain]; + } + + return supportedLanguages; } - (BOOL) userCanChangePassword From 2fdf4f55355377dffc8e696562fffaf1626be305 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 26 Oct 2012 22:31:14 -0400 Subject: [PATCH 003/105] Fix typos in Spanish (Spain) translation --- SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings b/SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings index 08dd4d3a6..c855a96bf 100644 --- a/SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings +++ b/SoObjects/Appointments/SpanishSpain.lproj/Localizable.strings @@ -25,13 +25,13 @@ vtodo_class2 = "(Tarea confidencial)"; "comment_label" = "Comentario:"; /* Invitation */ -"Event Invitation: \"%{Summary}\"" = "Invitación al evento: \"% {Summary}\""; +"Event Invitation: \"%{Summary}\"" = "Invitación al evento: \"%{Summary}\""; "(sent by %{SentBy}) " = "(enviado por %{SentBy}) "; "%{Organizer} %{SentByText}has invited you to %{Summary}.\n\nStart: %{StartDate}\nEnd: %{EndDate}\nDescription: %{Description}" = "%{Organizer} %{SentByText}le ha invitado a %{Summary}.\n\nInicio: %{StartDate}\nFin: %{EndDate}\nDescripción: %{Description}"; "%{Organizer} %{SentByText}has invited you to %{Summary}.\n\nStart: %{StartDate} at %{StartTime}\nEnd: %{EndDate} at %{EndTime}\nDescription: %{Description}" = "%{Organizer} %{SentByText}le ha invitado a %{Summary}.\n\nInicio: %{StartDate} a las %{StartTime}\nFin: %{EndDate} a las %{EndTime}\nDescripción: %{Description}"; /* Deletion */ -"Event Cancelled: \"%{Summary}\"" = "Evento Cancelado: \"% {Summary}\""; +"Event Cancelled: \"%{Summary}\"" = "Evento Cancelado: \"%{Summary}\""; "%{Organizer} %{SentByText}has cancelled this event: %{Summary}.\n\nStart: %{StartDate}\nEnd: %{EndDate}\nDescription: %{Description}" = "%{Organizer} %{SentByText}ha cancelado este evento: %{Summary}.\n\nInicio: %{StartDate}\nFin: %{EndDate}\nDescripción: %{Description}"; "%{Organizer} %{SentByText}has cancelled this event: %{Summary}.\n\nStart: %{StartDate} at %{StartTime}\nEnd: %{EndDate} at %{EndTime}\nDescription: %{Description}" From 20cb769db1af72f878f0e19b13848e0c5630a32d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 26 Oct 2012 22:38:41 -0400 Subject: [PATCH 004/105] style --- SoObjects/SOGo/LDAPSource.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 86381d3a2..81024a270 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -110,7 +110,7 @@ static Class NSStringK; bindFields = nil; _scope = @"sub"; _filter = nil; - _userPasswordAlgorithm = nil; + _userPasswordAlgorithm = nil; listRequiresDot = YES; searchAttributes = nil; From 40a1a51845d1476b0bd0bd4c8d0e4eaa56bba6b0 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Oct 2012 08:49:02 -0400 Subject: [PATCH 005/105] cache the "startDate" --- SOPE/NGCards/iCalTimeZonePeriod.h | 3 +++ SOPE/NGCards/iCalTimeZonePeriod.m | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/SOPE/NGCards/iCalTimeZonePeriod.h b/SOPE/NGCards/iCalTimeZonePeriod.h index ad56ab50a..f4d9af6ce 100644 --- a/SOPE/NGCards/iCalTimeZonePeriod.h +++ b/SOPE/NGCards/iCalTimeZonePeriod.h @@ -30,6 +30,9 @@ @class iCalRecurrenceRule; @interface iCalTimeZonePeriod : CardGroup +{ + NSCalendarDate *startDate; +} - (NSCalendarDate *) startDate; - (iCalRecurrenceRule *) recurrenceRule; diff --git a/SOPE/NGCards/iCalTimeZonePeriod.m b/SOPE/NGCards/iCalTimeZonePeriod.m index ac436f96d..a7e21879a 100644 --- a/SOPE/NGCards/iCalTimeZonePeriod.m +++ b/SOPE/NGCards/iCalTimeZonePeriod.m @@ -103,10 +103,21 @@ // return dayOfWeek; // } +- (void) dealloc +{ + [startDate release]; + [super dealloc]; +} + - (NSCalendarDate *) startDate { - return [(iCalDateTime *) [self uniqueChildWithTag: @"dtstart"] - dateTime]; + if (!startDate) + { + startDate = [(iCalDateTime *) [self uniqueChildWithTag: @"dtstart"] + dateTime]; + [startDate retain]; + } + return startDate; } - (iCalRecurrenceRule *) recurrenceRule From 806ea9fd13a307bf71762da938a49db0b1acd33f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Oct 2012 08:49:51 -0400 Subject: [PATCH 006/105] do not duplicate the result of method calls into a NSMutableString --- SOPE/GDLContentStore/GCSFolder.m | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/SOPE/GDLContentStore/GCSFolder.m b/SOPE/GDLContentStore/GCSFolder.m index ec9c0283a..af49f91ce 100644 --- a/SOPE/GDLContentStore/GCSFolder.m +++ b/SOPE/GDLContentStore/GCSFolder.m @@ -351,15 +351,12 @@ static GCSStringFormatter *stringFormatter = nil; - (NSString *) _selectedFields: (NSArray *) fields requirement: (GCSTableRequirement) requirement { - NSMutableString *selectedFields; - - selectedFields = [NSMutableString string]; + NSString *selectedFields; - if (requirement == bothTableRequired - && [fields containsObject: @"c_name"]) - [selectedFields appendString: [self _dottedFields: fields]]; + if (requirement == bothTableRequired && [fields containsObject: @"c_name"]) + selectedFields = [self _dottedFields: fields]; else - [selectedFields appendString: [fields componentsJoinedByString: @", "]]; + selectedFields = [fields componentsJoinedByString: @", "]; return selectedFields; } From 1223a6c0ee91d3dc9a3189384424219034eaefbc Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Oct 2012 09:41:20 -0400 Subject: [PATCH 007/105] make use of -[WOComponent componentBundle] --- UI/Scheduler/UIxComponentEditor.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index d53929de0..cb9ac882f 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -1462,14 +1462,12 @@ RANGE(2); ////////////////////////////////// JUNK //////////////////////////////////////// - (NSArray *) cycles { - NSBundle *bundle; NSString *path; static NSArray *cycles = nil; if (!cycles) { - bundle = [NSBundle bundleForClass:[self class]]; - path = [bundle pathForResource: @"cycles" ofType: @"plist"]; + path = [[self componentBundle] pathForResource: @"cycles" ofType: @"plist"]; NSAssert(path != nil, @"Cannot find cycles.plist!"); cycles = [[NSArray arrayWithContentsOfFile:path] retain]; NSAssert(cycles != nil, @"Cannot instantiate cycles from cycles.plist!"); From 21ee23e7dfb10510d83a7ac081050215d215dcf2 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 30 Oct 2012 16:59:22 -0400 Subject: [PATCH 008/105] avoid comparisons that extend past the string length --- SoObjects/SOGo/NSString+Utilities.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index da5a69993..5a37812b3 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -134,15 +134,16 @@ static int cssEscapingCount; start--; start++; + length = [self length]; // In [UIxMailPartTextViewer flatContentAsString], we first escape HTML entities and then // add URLs. Therefore, the brackets (inequality signs <>) have been encoded at this point. - if ([[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame) + if (length > (start + 4) + && [[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame) start += 4; - length = [self length] - start; - workRange = NSMakeRange (start, length); + length -= start; workRange = [self rangeOfCharacterFromSet: urlAfterEndingChars - options: NSLiteralSearch range: workRange]; + options: NSLiteralSearch range: NSMakeRange (start, length)]; if (workRange.location != NSNotFound) length = workRange.location - start; while From a916ac892703c45fc1c4d720e7baf73c747d45d7 Mon Sep 17 00:00:00 2001 From: Luc Charland Date: Fri, 26 Oct 2012 13:39:28 -0400 Subject: [PATCH 009/105] Fixed bug #1105 Remote images display There now is a configurable default in mail preferences where you can set remote images to display either Never or Always. --- SoObjects/SOGo/SOGoUserDefaults.h | 3 +++ SoObjects/SOGo/SOGoUserDefaults.m | 10 +++++++++ .../English.lproj/Localizable.strings | 2 ++ UI/PreferencesUI/UIxPreferences.m | 22 +++++++++++++++++++ UI/Templates/MailerUI/UIxMailMainFrame.wox | 2 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 6 +++++ UI/WebServerResources/MailerUI.js | 14 +++++++++--- 7 files changed, 55 insertions(+), 4 deletions(-) diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index d8b56ef0a..0a6cdb818 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -118,6 +118,9 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (void) setMailComposeMessageType: (NSString *) newValue; - (NSString *) mailComposeMessageType; +- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue; +- (NSString *) mailDisplayRemoteInlineImages; + - (void) setMailMessageForwarding: (NSString *) newValue; - (NSString *) mailMessageForwarding; diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index 6d05afbba..81f6cada8 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -493,6 +493,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringForKey: @"SOGoMailComposeMessageType"]; } +- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue; +{ + [self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"]; +} + +- (NSString *) mailDisplayRemoteInlineImages; +{ + return [self stringForKey: @"SOGoMailDisplayRemoteInlineImages"]; +} + - (void) setMailMessageForwarding: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoMailMessageForwarding"]; diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index b807a9129..04cbd629c 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -149,6 +149,8 @@ "Compose messages in" = "Compose messages in"; "composemessagestype_html" = "HTML"; "composemessagestype_text" = "Plain text"; +"displayremoteinlineimages_never" = "Never"; +"displayremoteinlineimages_always" = "Always"; /* IMAP Accounts */ "New Mail Account" = "New Mail Account"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index d3473ae71..8d6bcb227 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -759,6 +759,28 @@ [userDefaults setMailComposeMessageType: newType]; } +/* Display remote inline images */ +- (NSArray *) displayRemoteInlineImages +{ + return [NSArray arrayWithObjects: @"never", @"always", nil]; +} + +- (NSString *) itemDisplayRemoteInlineImagesText +{ + return [self labelForKey: [NSString stringWithFormat: + @"displayremoteinlineimages_%@", item]]; +} + +- (NSString *) userDisplayRemoteInlineImages +{ + return [userDefaults mailDisplayRemoteInlineImages]; +} + +- (void) setUserDisplayRemoteInlineImages: (NSString *) newType +{ + [userDefaults setMailDisplayRemoteInlineImages: newType]; +} + /* mail autoreply (vacation) */ - (BOOL) isSieveScriptsEnabled diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index 30c93a901..c0438bb64 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -7,7 +7,7 @@ xmlns:label="OGo:label" className="UIxPageFrame" title="title" - const:userDefaultsKeys="SOGoMailMessageCheck,SOGoMailSortByThreads,SOGoMailListViewColumnsOrder" + const:userDefaultsKeys="SOGoMailMessageCheck,SOGoMailSortByThreads,SOGoMailListViewColumnsOrder,SOGoMailDisplayRemoteInlineImages" const:userSettingsKeys="Mail" const:jsFiles="dtree.js,MailerUIdTree.js,SOGoAutoCompletion.js,SOGoResizableTable.js,SOGoMailDataSource.js,SOGoDataTable.js,jquery-ui.js">