From 7a99dbe7d82f7eb41cac92871aaa15eaf7e032a3 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sun, 22 Jul 2007 20:14:47 +0000 Subject: [PATCH] Monotone-Parent: 03806ed8d8567d1f59013f435593e7994f0111e1 Monotone-Revision: c61109eb28c9671d365c0b308b3db5532b7b6d96 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-22T20:14:47 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 +++++++ NEWS | 5 +++++ UI/MainUI/SOGoUserHomePage.m | 42 ++++++++++++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0c5f04e1..42b4adec6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-07-22 Wolfgang Sourdeau + + * UI/MainUI/SOGoUserHomePage.m ([SOGoUserHomePage +initialize]): + scan the value of SOGoUIxDefaultModule. If not set, the default + module defaults to "Calendar". + ([SOGoUserHomePage -defaultAction]): redirect the user to the + value of "SOGoUIxDefaultModule". + 2007-07-20 Wolfgang Sourdeau * UI/Contacts/UIxContactsListView.m ([UIxContactsListView diff --git a/NEWS b/NEWS index 9352e9177..a66b84408 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +0.9.0-20070xxx +-------------- +- added the ability to choose the default module from the + application settings: "Calendars", "Contacts" or "Mail"; + 0.9.0-20070713 -------------- - added the ability to specify a super user through the SOGoSuperUsername user diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 3b54ade19..678698256 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -23,30 +23,64 @@ #import #import #import +#import +#import #import #import #import #import +#import #import #import #import #import +static NSString *defaultModule; + @interface SOGoUserHomePage : UIxComponent @end @implementation SOGoUserHomePage ++ (void) initialize +{ + NSUserDefaults *ud; + + ud = [NSUserDefaults standardUserDefaults]; + defaultModule = [ud stringForKey: @"SOGoUIxDefaultModule"]; + if (defaultModule) + { + if (defaultModule) + { + if (!([defaultModule isEqualToString: @"Calendar"] + || [defaultModule isEqualToString: @"Contacts"] + || [defaultModule isEqualToString: @"Mail"])) + { + [self logWithFormat: @"default module '%@' not accepted (must be" + @"'Calendar', 'Contacts' or Mail)", defaultModule]; + defaultModule = @"Calendar"; + } + } + else + defaultModule = @"Calendar"; + + [self logWithFormat: @"default module set to '%@'", defaultModule]; + [defaultModule retain]; + } +} + - (id ) defaultAction { - NSString *baseURL, *url; + SOGoUserFolder *co; + NSURL *moduleURL; - baseURL = [[context request] uri]; - url = [baseURL stringByAppendingString:@"/../Calendar"]; + co = [self clientObject]; + moduleURL = [NSURL URLWithString: defaultModule + relativeToURL: [co soURL]]; - return [self redirectToLocation: url]; + return [self redirectToLocation: [moduleURL absoluteString]]; } - (void) _fillFreeBusyItems: (NSMutableArray *) items