Monotone-Parent: c6b25920d896b2d19d0ef40a4cadee46c87bba2d
Monotone-Revision: 1c3bb3511167199e0dc7bafa4db7fc5540648666 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-07-10T15:49:05 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
918affb638
commit
934e15d2d0
|
@ -1,3 +1,12 @@
|
|||
2012-07-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoObject.m (-davBooleanForResult:): new method
|
||||
that returns a valid DAV boolean from a BOOL.
|
||||
(-isValidDAVBoolean:): new method that validates the value as a
|
||||
DAV boolean.
|
||||
(-resultForDAVBoolean:): new method that returns a BOOL from a DAV
|
||||
boolean.
|
||||
|
||||
2012-07-09 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||
|
||||
* Dropped old templates (SOGoAptMailDeletionReceipt.wox
|
||||
|
|
|
@ -2250,28 +2250,18 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
|
||||
- (NSString *) davCalendarShowAlarms
|
||||
{
|
||||
NSString *boolean;
|
||||
|
||||
if ([self showCalendarAlarms])
|
||||
boolean = @"true";
|
||||
else
|
||||
boolean = @"false";
|
||||
|
||||
return boolean;
|
||||
return [self davBooleanForResult: [self showCalendarAlarms]];
|
||||
}
|
||||
|
||||
- (NSException *) setDavCalendarShowAlarms: (id) newBoolean
|
||||
{
|
||||
NSException *error;
|
||||
|
||||
error = nil;
|
||||
|
||||
if ([newBoolean isEqualToString: @"true"]
|
||||
|| [newBoolean isEqualToString: @"1"])
|
||||
[self setShowCalendarAlarms: YES];
|
||||
else if ([newBoolean isEqualToString: @"false"]
|
||||
|| [newBoolean isEqualToString: @"0"])
|
||||
[self setShowCalendarAlarms: NO];
|
||||
if ([self isValidDAVBoolean: newBoolean])
|
||||
{
|
||||
[self setShowCalendarAlarms: [self resultForDAVBoolean: newBoolean]];
|
||||
error = nil;
|
||||
}
|
||||
else
|
||||
error = [NSException exceptionWithHTTPStatus: 400
|
||||
reason: @"Bad boolean value."];
|
||||
|
|
|
@ -166,6 +166,10 @@
|
|||
parameters: (NSArray *) params;
|
||||
|
||||
/* utilities */
|
||||
- (NSString *) davBooleanForResult: (BOOL) result;
|
||||
- (BOOL) isValidDAVBoolean: (NSString *) davBoolean;
|
||||
- (BOOL) resultForDAVBoolean: (NSString *) davBoolean;
|
||||
|
||||
- (NSString *) labelForKey: (NSString *) key;
|
||||
|
||||
/* description */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#import <Foundation/NSClassDescription.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSPathUtilities.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
@ -1585,6 +1586,35 @@
|
|||
return exception;
|
||||
}
|
||||
|
||||
- (NSString *) davBooleanForResult: (BOOL) result
|
||||
{
|
||||
return (result ? @"true" : @"false");
|
||||
}
|
||||
|
||||
- (BOOL) isValidDAVBoolean: (NSString *) davBoolean
|
||||
{
|
||||
static NSSet *validBooleans = nil;
|
||||
|
||||
if (!validBooleans)
|
||||
{
|
||||
validBooleans = [NSSet setWithObjects: @"true", @"false", @"1", @"0",
|
||||
nil];
|
||||
[validBooleans retain];
|
||||
}
|
||||
|
||||
return [validBooleans containsObject: davBoolean];
|
||||
}
|
||||
|
||||
- (BOOL) resultForDAVBoolean: (NSString *) davBoolean
|
||||
{
|
||||
BOOL result;
|
||||
|
||||
result = ([davBoolean isEqualToString: @"true"]
|
||||
|| [davBoolean isEqualToString: @"1"]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *) labelForKey: (NSString *) key
|
||||
{
|
||||
return [self labelForKey: key inContext: context];
|
||||
|
|
Loading…
Reference in a new issue