(fix) b0rk3n sort saving regarding the asc/desc state
parent
8f75bdce2d
commit
ffa4079fa8
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2006-2014 Inverse inc.
|
||||
Copyright (C) 2006-2015 Inverse inc.
|
||||
|
||||
This file is part of SOGo.
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
|||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
|
@ -83,32 +84,33 @@
|
|||
s = [rq formValueForKey: @"sort"];
|
||||
if (![s length])
|
||||
s = [self defaultSortKey];
|
||||
else
|
||||
[self saveSortValue: s];
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
- (void) saveSortValue: (NSString *) sort
|
||||
{
|
||||
NSString *ascending;
|
||||
SOGoUserSettings *us;
|
||||
- (void) saveSortValue
|
||||
{
|
||||
NSMutableDictionary *contactSettings;
|
||||
|
||||
NSString *ascending, *sort;
|
||||
SOGoUserSettings *us;
|
||||
|
||||
sort = [[context request] formValueForKey: @"sort"];
|
||||
ascending = [[context request] formValueForKey: @"asc"];
|
||||
|
||||
if ([sort length])
|
||||
{
|
||||
us = [[context activeUser] userSettings];
|
||||
contactSettings = [us objectForKey: @"Contact"];
|
||||
// Must create if it doesn't exist
|
||||
if (!contactSettings)
|
||||
{
|
||||
contactSettings = [NSMutableDictionary dictionary];
|
||||
[us setObject: contactSettings forKey: @"Contact"];
|
||||
us = [[context activeUser] userSettings];
|
||||
contactSettings = [us objectForKey: @"Contact"];
|
||||
// Must create if it doesn't exist
|
||||
if (!contactSettings)
|
||||
{
|
||||
contactSettings = [NSMutableDictionary dictionary];
|
||||
[us setObject: contactSettings forKey: @"Contact"];
|
||||
}
|
||||
[contactSettings setObject: [NSArray arrayWithObjects: [sort lowercaseString], [NSString stringWithFormat: @"%d", [ascending intValue]], nil]
|
||||
forKey: @"SortingState"];
|
||||
[us synchronize];
|
||||
}
|
||||
[contactSettings setObject: [NSArray arrayWithObjects: [sort lowercaseString], [NSString stringWithFormat: @"%d", (ascending?1:0)], nil] forKey: @"SortingState"];
|
||||
[us synchronize];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *) contactInfos
|
||||
|
@ -123,6 +125,8 @@
|
|||
WORequest *rq;
|
||||
unsigned int i;
|
||||
|
||||
[self saveSortValue];
|
||||
|
||||
if (!contactInfos)
|
||||
{
|
||||
folder = [self clientObject];
|
||||
|
|
|
@ -695,7 +695,8 @@ static NSArray *tasksFields = nil;
|
|||
calendarSettings = [NSMutableDictionary dictionary];
|
||||
[us setObject: calendarSettings forKey: @"Calendar"];
|
||||
}
|
||||
[calendarSettings setObject: [NSArray arrayWithObjects: [sort lowercaseString], [NSString stringWithFormat: @"%d", (ascending?1:0)], nil] forKey: submodule];
|
||||
[calendarSettings setObject: [NSArray arrayWithObjects: [sort lowercaseString], [NSString stringWithFormat: @"%d", [ascending intValue]], nil]
|
||||
forKey: submodule];
|
||||
[us synchronize];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue