Proper system defaults fallback for preferences
(Bug #145) Monotone-Parent: 86d5fda1266a9ae6071c1b0c48daa229594679fb Monotone-Revision: 33a4befb91778f46b962f6c895f7697b0d1df722 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-10-06T18:12:07 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
a9f4d77c2c
commit
725878ebdb
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
2009-10-06 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m (_timeValue): improved parsing to
|
||||
support single integers (not only the XY:00 form).
|
||||
(-timeFormat): returns the user's time format or system
|
||||
(SOGoTimeFormat) default if not defined.
|
||||
(-replyPlacement): honor the system defaults (SOGoMailReplyPlacement).
|
||||
(-signaturePlacement): honor the system defaults
|
||||
(SOGoMailSignaturePlacement).
|
||||
(-messageForwarding): honor the system defaults (SOGoMailMessageForwarding).
|
||||
|
||||
* SoObjects/Mailer/SOGoMailObject+Draft.m (-contentForReply):
|
||||
reply and signature placement properly honors system defaults
|
||||
(SOGoMailReplyPlacement and SOGoMailSignaturePlacement).
|
||||
|
||||
* UI/PreferencesUI/UIxPreferences.m (-userTimeFormat): honor the
|
||||
system defaults through the SOGoUser class.
|
||||
(-userDayStartTime): idem.
|
||||
(-userDayEndTime): idem.
|
||||
(-userMessageForwarding): idem.
|
||||
(-repyPlacement): idem.
|
||||
(-signaturePlacement): idem.
|
||||
|
||||
* UI/Scheduler/UIxCalDayTable.m (-hoursToDisplay): honor the
|
||||
system defaults through the SOGoUser class.
|
||||
|
||||
* UI/WebServerResources/UIxPreferences.js (-initPreferences): fix
|
||||
to properly set the initial status of the signature placement
|
||||
select field.
|
||||
|
||||
2009-10-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* Tests/test-maildav.py (DAVMailCollectionTest._testFilter): fixed
|
||||
|
|
|
@ -175,8 +175,8 @@
|
|||
inContext: context];
|
||||
[page setSourceMail: self];
|
||||
[page setOutlookMode: [self useOutlookStyleReplies]];
|
||||
[page setReplyPlacement: [[currentUser userDefaults] stringForKey: @"ReplyPlacement"]];
|
||||
[page setSignaturePlacement: [[currentUser userDefaults] stringForKey: @"SignaturePlacement"]];
|
||||
[page setReplyPlacement: [currentUser replyPlacement]];
|
||||
[page setSignaturePlacement: [currentUser signaturePlacement]];
|
||||
|
||||
return [[page generateResponse] contentAsString];
|
||||
}
|
||||
|
|
|
@ -117,6 +117,8 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
|||
- (unsigned int) dayStartHour;
|
||||
- (unsigned int) dayEndHour;
|
||||
|
||||
- (NSString *) timeFormat;
|
||||
|
||||
- (NSCalendarDate *) firstWeekOfYearForDate: (NSCalendarDate *) date;
|
||||
- (unsigned int) weekNumberForDate: (NSCalendarDate *) date;
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ static NSString *defaultReplyPlacement = nil;
|
|||
static NSString *defaultSignaturePlacement = nil;
|
||||
static NSString *defaultMessageForwarding = nil;
|
||||
static NSString *defaultMessageCheck = nil;
|
||||
static NSString *defaultTimeFormat = nil;
|
||||
static NSArray *superUsernames = nil;
|
||||
static NSURL *SOGoProfileURL = nil;
|
||||
// static BOOL acceptAnyUser = NO;
|
||||
|
@ -89,13 +90,19 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
|||
static int
|
||||
_timeValue (NSString *key)
|
||||
{
|
||||
int time;
|
||||
int i, time;
|
||||
|
||||
if (key && [key length] > 1)
|
||||
time = [[key substringToIndex: 2] intValue];
|
||||
if (key && [key length] > 0)
|
||||
{
|
||||
i = [key rangeOfString: @":"].location;
|
||||
if (i != NSNotFound)
|
||||
time = [[key substringToIndex: i] intValue];
|
||||
else
|
||||
time = [key intValue];
|
||||
}
|
||||
else
|
||||
time = -1;
|
||||
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
|
@ -191,6 +198,12 @@ _timeValue (NSString *key)
|
|||
if (!defaultMessageCheck)
|
||||
ASSIGN (defaultMessageCheck, @"manually");
|
||||
}
|
||||
if (!defaultTimeFormat)
|
||||
{
|
||||
ASSIGN (defaultTimeFormat, [ud stringForKey: @"SOGoTimeFormat"]);
|
||||
if (!defaultTimeFormat)
|
||||
ASSIGN (defaultTimeFormat, @"%H:00");
|
||||
}
|
||||
|
||||
if (!superUsernames)
|
||||
ASSIGN (superUsernames, [ud arrayForKey: @"SOGoSuperUsernames"]);
|
||||
|
@ -662,6 +675,17 @@ _timeValue (NSString *key)
|
|||
return limit;
|
||||
}
|
||||
|
||||
- (NSString *) timeFormat
|
||||
{
|
||||
NSString *timeFormat;
|
||||
|
||||
timeFormat = [[self userDefaults] stringForKey: @"TimeFormat"];
|
||||
if (!timeFormat)
|
||||
timeFormat = defaultTimeFormat;
|
||||
|
||||
return timeFormat;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) firstWeekOfYearForDate: (NSCalendarDate *) date
|
||||
{
|
||||
NSString *firstWeekRule;
|
||||
|
@ -891,17 +915,39 @@ _timeValue (NSString *key)
|
|||
|
||||
- (NSString *) replyPlacement
|
||||
{
|
||||
return [[self userDefaults] stringForKey: @"ReplyPlacement"];
|
||||
NSString *replyPlacement = [[self userDefaults] stringForKey: @"ReplyPlacement"];
|
||||
|
||||
if (!replyPlacement)
|
||||
replyPlacement = defaultReplyPlacement;
|
||||
|
||||
return replyPlacement;
|
||||
}
|
||||
|
||||
- (NSString *) signaturePlacement
|
||||
{
|
||||
return [[self userDefaults] stringForKey: @"SignaturePlacement"];
|
||||
NSString *signaturePlacement;
|
||||
|
||||
if ([[self replyPlacement] isEqualToString: @"below"])
|
||||
// When replying to an email, if the reply is below the quoted text,
|
||||
// the signature must also be below the quoted text.
|
||||
signaturePlacement = @"below";
|
||||
else
|
||||
{
|
||||
signaturePlacement = [[self userDefaults] stringForKey: @"SignaturePlacement"];
|
||||
if (!signaturePlacement)
|
||||
signaturePlacement = defaultSignaturePlacement;
|
||||
}
|
||||
|
||||
return signaturePlacement;
|
||||
}
|
||||
|
||||
- (NSString *) messageForwarding
|
||||
{
|
||||
return [[self userDefaults] stringForKey: @"MessageForwarding"];
|
||||
NSString *messageForwarding = [[self userDefaults] stringForKey: @"MessageForwarding"];
|
||||
if (!messageForwarding)
|
||||
messageForwarding = defaultMessageForwarding;
|
||||
|
||||
return messageForwarding;
|
||||
}
|
||||
|
||||
/* folders */
|
||||
|
|
|
@ -290,7 +290,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userTimeFormat
|
||||
{
|
||||
return [userDefaults objectForKey: @"TimeFormat"];
|
||||
return [user timeFormat];
|
||||
}
|
||||
|
||||
- (void) setUserTimeFormat: (NSString *) newFormat
|
||||
|
@ -318,7 +318,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userWeekStartDay
|
||||
{
|
||||
return [NSString stringWithFormat: @"%d", [user firstDayOfWeek]];;
|
||||
return [NSString stringWithFormat: @"%d", [user firstDayOfWeek]];
|
||||
}
|
||||
|
||||
- (void) setUserWeekStartDay: (NSString *) newDay
|
||||
|
@ -343,13 +343,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userDayStartTime
|
||||
{
|
||||
NSString *time;
|
||||
|
||||
time = [userDefaults objectForKey: @"DayStartTime"];
|
||||
if (!time)
|
||||
time = @"08:00";
|
||||
|
||||
return time;
|
||||
return [NSString stringWithFormat: @"%02d:00", [user dayStartHour]];
|
||||
}
|
||||
|
||||
- (void) setUserDayStartTime: (NSString *) newTime
|
||||
|
@ -359,13 +353,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userDayEndTime
|
||||
{
|
||||
NSString *time;
|
||||
|
||||
time = [userDefaults objectForKey: @"DayEndTime"];
|
||||
if (!time)
|
||||
time = @"18:00";
|
||||
|
||||
return time;
|
||||
return [NSString stringWithFormat: @"%02d:00", [user dayEndHour]];
|
||||
}
|
||||
|
||||
- (void) setUserDayEndTime: (NSString *) newTime
|
||||
|
@ -375,7 +363,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSArray *) firstWeekList
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
return [NSArray arrayWithObjects:
|
||||
SOGoWeekStartJanuary1,
|
||||
SOGoWeekStartFirst4DayWeek,
|
||||
SOGoWeekStartFirstFullWeek,
|
||||
|
@ -541,7 +529,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userMessageForwarding
|
||||
{
|
||||
return [userDefaults stringForKey: @"MessageForwarding"];
|
||||
return [user messageForwarding];
|
||||
}
|
||||
|
||||
- (void) setUserMessageForwarding: (NSString *) newMessageForwarding
|
||||
|
@ -591,7 +579,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userReplyPlacement
|
||||
{
|
||||
return [userDefaults stringForKey: @"ReplyPlacement"];
|
||||
return [user replyPlacement];
|
||||
}
|
||||
|
||||
- (void) setUserReplyPlacement: (NSString *) newReplyPlacement
|
||||
|
@ -612,7 +600,7 @@ static BOOL defaultShowSubscribedFoldersOnly = NO;
|
|||
|
||||
- (NSString *) userSignaturePlacement
|
||||
{
|
||||
return [userDefaults stringForKey: @"SignaturePlacement"];
|
||||
return [user signaturePlacement];
|
||||
}
|
||||
|
||||
- (NSArray *) composeMessagesType
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
NSArray *weekDays;
|
||||
SOGoDateFormatter *dateFormatter;
|
||||
NSUserDefaults *ud;
|
||||
NSMutableString *timeFormat;
|
||||
NSString *timeFormat;
|
||||
}
|
||||
|
||||
- (void) setNumberOfDays: (NSNumber *) aNumber;
|
||||
|
|
|
@ -120,11 +120,8 @@
|
|||
{
|
||||
unsigned int currentHour, lastHour;
|
||||
|
||||
// For later
|
||||
ud = [[context activeUser] userDefaults];
|
||||
timeFormat = [NSMutableString stringWithString: [ud stringForKey: @"TimeFormat"]];
|
||||
if (!timeFormat || [timeFormat length] == 0)
|
||||
timeFormat = [NSMutableString stringWithString: @"%H:00"];
|
||||
// For later in method currentTableHour
|
||||
timeFormat = [[context activeUser] timeFormat];
|
||||
|
||||
if (!hoursToDisplay)
|
||||
{
|
||||
|
|
|
@ -81,8 +81,8 @@ function initPreferences() {
|
|||
if ($("composeMessagesType").value == 1) {
|
||||
$("replyPlacementList").selectedIndex = 0;
|
||||
$("replyPlacementList").disabled = 1;
|
||||
onReplyPlacementListChange ();
|
||||
}
|
||||
onReplyPlacementListChange ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue