applied comments

This commit is contained in:
Alexandre Cloutier
2014-09-08 12:39:55 -04:00
parent 0c88edc61b
commit e6002c9b2a
3 changed files with 32 additions and 26 deletions
+5 -8
View File
@@ -34,6 +34,7 @@
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoUserSettings.h>
#import <SoObjects/SOGo/SOGoUserDefaults.h>
#import "../Common/WODirectAction+SOGo.h"
@@ -164,13 +165,11 @@
if (isCollapsing)
{
// Check if the module threadsCollapsed is created in the userSettings
if ([[moduleSettings objectForKey:@"threadsCollapsed"] boolValue])
if ((threadsCollapsed = [moduleSettings objectForKey:@"threadsCollapsed"]))
{
threadsCollapsed = [moduleSettings objectForKey:@"threadsCollapsed"];
// Check if the currentMailbox already have other threads saved and add the new collapsed thread
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ((mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs]))
{
mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs];
if (![mailboxThreadsCollapsed containsObject:msguid])
[mailboxThreadsCollapsed addObject:msguid];
}
@@ -191,13 +190,11 @@
else
{
// Check if the module threadsCollapsed is created in the userSettings
if ([[moduleSettings objectForKey:@"threadsCollapsed"] boolValue])
if ((threadsCollapsed = [moduleSettings objectForKey:@"threadsCollapsed"]))
{
threadsCollapsed = [moduleSettings objectForKey:@"threadsCollapsed"];
// Check if the currentMailbox already have other threads saved and remove the uncollapsed thread
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ((mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs]))
{
mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs];
[mailboxThreadsCollapsed removeObject:msguid];
if ([mailboxThreadsCollapsed count] == 0)
+9 -11
View File
@@ -92,7 +92,7 @@
SOGoUserSettings *us;
WOResponse *response;
NSException *error;
NSString *newFolderName, *oldFolderName, *currentMailbox, *currentAccount, *keyForMsgUIDs, *newKeyForMsgUIDs;
NSString *newFolderName, *currentMailbox, *currentAccount, *keyForMsgUIDs, *newKeyForMsgUIDs;
NSMutableDictionary *moduleSettings, *threadsCollapsed;
NSArray *values;
@@ -116,9 +116,9 @@
else
{
// Verify if the current folder have any collapsed threads save under it old name and adjust the folderName
if ([threadsCollapsed boolValue])
if (threadsCollapsed)
{
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ([threadsCollapsed objectForKey:keyForMsgUIDs])
{
values = [NSArray arrayWithArray:[threadsCollapsed objectForKey:keyForMsgUIDs]];
[threadsCollapsed setObject:values forKey:newKeyForMsgUIDs];
@@ -209,9 +209,9 @@
currentAccount = [[co container] nameInContainer];
keyForMsgUIDs = [NSString stringWithFormat:@"/%@/%@", currentAccount, currentMailbox];
if ([threadsCollapsed boolValue])
if (threadsCollapsed)
{
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ([threadsCollapsed objectForKey:keyForMsgUIDs])
{
[threadsCollapsed removeObjectForKey:keyForMsgUIDs];
[us synchronize];
@@ -273,11 +273,10 @@
currentAccount = [[co container] nameInContainer];
keyForMsgUIDs = [NSString stringWithFormat:@"/%@/%@", currentAccount, currentMailbox];
if ([threadsCollapsed boolValue])
if (threadsCollapsed)
{
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ((mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs]))
{
mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs];
for (i = 0; i < [uids count]; i++)
[mailboxThreadsCollapsed removeObject:[uids objectAtIndex:i]];
[us synchronize];
@@ -411,11 +410,10 @@
currentAccount = [[co container] nameInContainer];
keyForMsgUIDs = [NSString stringWithFormat:@"/%@/%@", currentAccount, currentMailbox];
if ([threadsCollapsed boolValue])
if (threadsCollapsed)
{
if ([[threadsCollapsed objectForKey:keyForMsgUIDs] boolValue])
if ((mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs]))
{
mailboxThreadsCollapsed = [threadsCollapsed objectForKey:keyForMsgUIDs];
for (i = 0; i < [uids count]; i++)
[mailboxThreadsCollapsed removeObject:[uids objectAtIndex:i]];
[us synchronize];
+18 -7
View File
@@ -33,6 +33,10 @@ var deleteMessageRequestCount = 0;
var messageCheckTimer;
// Variables for feature threadsCollapsing
var displayThreadElement = false;
var cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed;
/* We need to override this method since it is adapted to GCS-based folder
references, which we do not use here */
function URLForFolderID(folderID, application) {
@@ -958,8 +962,6 @@ function openMailbox(mailbox, reload) {
/*
* Called from SOGoDataTable.render()
*/
var show = false;
var cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed;
function messageListCallback(row, data, isNew) {
var currentMessage = Mailer.currentMessages[Mailer.currentMailbox];
@@ -978,7 +980,7 @@ function messageListCallback(row, data, isNew) {
var collapsedList = cachedThreadsCollapsed[mailbox];
if (collapsedList != undefined && collapsedList.indexOf(row.id.split("_")[1]) != -1) {
row.addClassName('closedThread');
show = true;
displayThreadElement = true;
}
else {
row.addClassName('openedThread');
@@ -991,12 +993,12 @@ function messageListCallback(row, data, isNew) {
row.addClassName('thread');
row.addClassName('thread' + data['ThreadLevel']);
if (show)
if (displayThreadElement)
row.hide();
}
else
show = false;
displayThreadElement = false;
var cells = row.childElements();
for (var j = 0; j < cells.length; j++) {
@@ -2604,10 +2606,19 @@ function onMenuToggleMessageFlag(event) {
mailListToggleMessagesFlagged();
}
function refreshUserSettingsCallback(http) {
var allUserSettings = http.response.evalJSON();
UserSettings.Mail = allUserSettings.Mail;
cachedThreadsCollapsed = UserSettings.Mail.threadsCollapsed;
refreshMailbox();
}
function folderOperationCallback(http) {
if (http.readyState == 4
&& isHttpStatus204(http.status))
if (http.readyState == 4 && isHttpStatus204(http.status)) {
initMailboxTree();
var url = ApplicationBaseURL.split("Mail")[0];
triggerAjaxRequest(url + "/jsonSettings", refreshUserSettingsCallback);
}
else
showAlertDialog(http.callbackData);
}