mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-10 19:05:09 +00:00
See ChangeLog.
Monotone-Parent: 0de048fc2845b8e712e21700f4604fa0cd9eeea4 Monotone-Revision: 7c436d762d93b096889be8f7c7eede7e227b0efd Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-05-28T19:18:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -321,12 +321,12 @@
|
||||
return keys;
|
||||
}
|
||||
|
||||
- (NSString *) defaultSortKey
|
||||
- (NSString *) defaultSortKey
|
||||
{
|
||||
return @"ARRIVAL";
|
||||
}
|
||||
|
||||
- (NSString *) imap4SortKey
|
||||
- (NSString *) imap4SortKey
|
||||
{
|
||||
NSString *sort;
|
||||
|
||||
@@ -341,11 +341,37 @@
|
||||
- (NSString *) imap4SortOrdering
|
||||
{
|
||||
NSString *sort, *ascending;
|
||||
NSString *module; //*login
|
||||
NSMutableDictionary *moduleSettings;
|
||||
BOOL asc;
|
||||
SOGoUser *activeUser;
|
||||
SOGoUserSettings *us;
|
||||
SOGoMailAccounts *clientObject;
|
||||
|
||||
sort = [self imap4SortKey];
|
||||
|
||||
ascending = [[context request] formValueForKey: @"asc"];
|
||||
if (![ascending boolValue])
|
||||
asc = [ascending boolValue];
|
||||
|
||||
if (![sort isEqualToString: [self defaultSortKey]])
|
||||
{
|
||||
// Save the sorting state in the user settings
|
||||
activeUser = [context activeUser];
|
||||
clientObject = [self clientObject];
|
||||
module = [[[clientObject container] container] nameInContainer];
|
||||
us = [activeUser userSettings];
|
||||
moduleSettings = [us objectForKey: module];
|
||||
if (!moduleSettings)
|
||||
{
|
||||
moduleSettings = [NSMutableDictionary dictionary];
|
||||
[us setObject: moduleSettings forKey: module];
|
||||
}
|
||||
[moduleSettings setObject: [NSArray arrayWithObjects: [sort lowercaseString], [NSString stringWithFormat: @"%d", (asc?1:0)], nil]
|
||||
forKey: @"SortingState"];
|
||||
[us synchronize];
|
||||
}
|
||||
|
||||
// Construct and return the final IMAP ordering constraint
|
||||
if (!asc)
|
||||
sort = [@"REVERSE " stringByAppendingString: sort];
|
||||
|
||||
return sort;
|
||||
|
||||
@@ -65,14 +65,23 @@
|
||||
|
||||
@implementation UIxMailMainFrame
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
folderType = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) _setupContext
|
||||
{
|
||||
SOGoUser *activeUser;
|
||||
NSString *login, *module;
|
||||
NSString *module;
|
||||
SOGoMailAccounts *clientObject;
|
||||
|
||||
activeUser = [context activeUser];
|
||||
login = [activeUser login];
|
||||
clientObject = [self clientObject];
|
||||
|
||||
module = [clientObject nameInContainer];
|
||||
@@ -386,6 +395,42 @@
|
||||
return [self responseWithStatus: 204];
|
||||
}
|
||||
|
||||
- (NSString *) columnsState
|
||||
{
|
||||
NSDictionary *columns;
|
||||
|
||||
[self _setupContext];
|
||||
columns = [moduleSettings objectForKey: @"ColumnsState"];
|
||||
|
||||
return [columns jsonRepresentation];
|
||||
}
|
||||
|
||||
- (WOResponse *) saveColumnsStateAction
|
||||
{
|
||||
WORequest *request;
|
||||
NSDictionary *columns;
|
||||
NSArray *columnsIds, *widths;
|
||||
|
||||
[self _setupContext];
|
||||
request = [context request];
|
||||
|
||||
columnsIds = [[request formValueForKey: @"columns"] componentsSeparatedByString: @","];
|
||||
widths = [[request formValueForKey: @"widths"] componentsSeparatedByString: @","];
|
||||
if (columnsIds != nil && widths != nil && [columnsIds count] == [widths count])
|
||||
{
|
||||
columns = [NSDictionary dictionaryWithObjects: widths
|
||||
forKeys: columnsIds];
|
||||
[moduleSettings setObject: columns
|
||||
forKey: @"ColumnsState"];
|
||||
}
|
||||
else
|
||||
return [self responseWithStatus: 400];
|
||||
|
||||
[us synchronize];
|
||||
|
||||
return [self responseWithStatus: 204];
|
||||
}
|
||||
|
||||
- (id) defaultAction
|
||||
{
|
||||
SOGoUserDefaults *ud;
|
||||
@@ -400,20 +445,6 @@
|
||||
return [super defaultAction];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* methods from UIxMailListView
|
||||
*/
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
folderType = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
- (BOOL) showToAddress
|
||||
{
|
||||
SOGoMailFolder *co;
|
||||
|
||||
@@ -352,6 +352,11 @@
|
||||
pageName = "UIxMailMainFrame";
|
||||
actionName = "saveFoldersState";
|
||||
};
|
||||
saveColumnsState = {
|
||||
protectedBy = "View";
|
||||
pageName = "UIxMailMainFrame";
|
||||
actionName = "saveColumnsState";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user