From f7f55e931571e3c1433880de1bca43ddf1f01a27 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 9 Jun 2009 21:25:41 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: b577b5789ba850c92417e70690576edfd3a2793b Monotone-Revision: 931357c046b4c2c5bca20cfc7027809a3240f43a Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-06-09T21:25:41 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 +++++ UI/Scheduler/UIxCalDayView.m | 7 ++++++ UI/Scheduler/UIxCalMainView.h | 4 ++++ UI/Scheduler/UIxCalMainView.m | 10 ++++++++ UI/Scheduler/UIxCalMonthView.m | 7 ++++++ UI/Scheduler/UIxCalView.h | 2 ++ UI/Scheduler/UIxCalView.m | 26 +++++++++++++++++++++ UI/Scheduler/UIxCalWeekView.m | 7 ++++++ UI/Templates/SchedulerUI/UIxCalMainView.wox | 1 + UI/WebServerResources/SchedulerUI.js | 1 - 10 files changed, 70 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c4dd70eb7..7669b9008 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,12 @@ 2009-06-09 Francis Lachapelle + * UI/Scheduler/UIxCalView.m ([UIxCalView -setCurrentView:]): new + method to save the user's current view in her/his settings. + + * UI/Scheduler/UIxCalMainView.m ([UIxCalMainView -currentView]): + returns the active user's last calendar view. + * SoObjects/Appointments/SOGoAppointmentFolder.m ([SOGoAppointmentFolder -_sqlStringRangeFromto:]): dates are not necessarily defined in case of vTODOs; don't apply the range diff --git a/UI/Scheduler/UIxCalDayView.m b/UI/Scheduler/UIxCalDayView.m index 1386781a6..8dca83462 100644 --- a/UI/Scheduler/UIxCalDayView.m +++ b/UI/Scheduler/UIxCalDayView.m @@ -48,6 +48,13 @@ // [super dealloc]; // } +- (id ) defaultAction +{ + [super setCurrentView: @"dayview"]; + + return self; +} + // - (void) setCurrentDate: (NSCalendarDate *) _date // { // ASSIGN(self->currentDate, _date); diff --git a/UI/Scheduler/UIxCalMainView.h b/UI/Scheduler/UIxCalMainView.h index d139ce0fc..26ad9b1bb 100644 --- a/UI/Scheduler/UIxCalMainView.h +++ b/UI/Scheduler/UIxCalMainView.h @@ -53,6 +53,10 @@ - (WOResponse *) saveDragHandleStateAction; +- (unsigned int) firstDayOfWeek; +- (unsigned int) dayStartHour; +- (NSString *) currentView; + @end #endif /* UIXCALMAINVIEW_H */ diff --git a/UI/Scheduler/UIxCalMainView.m b/UI/Scheduler/UIxCalMainView.m index b3fb8aee1..2c1cfb47f 100644 --- a/UI/Scheduler/UIxCalMainView.m +++ b/UI/Scheduler/UIxCalMainView.m @@ -182,4 +182,14 @@ return [[context activeUser] dayStartHour]; } +- (NSString *) currentView +{ + NSString *view; + + [self _setupContext]; + view = [moduleSettings objectForKey: @"View"]; + + return (view ? view : @"weekview"); +} + @end diff --git a/UI/Scheduler/UIxCalMonthView.m b/UI/Scheduler/UIxCalMonthView.m index df50a6b6d..b802f2031 100644 --- a/UI/Scheduler/UIxCalMonthView.m +++ b/UI/Scheduler/UIxCalMonthView.m @@ -69,6 +69,13 @@ [super dealloc]; } +- (id ) defaultAction +{ + [super setCurrentView: @"monthview"]; + + return self; +} + - (NSArray *) headerDaysToDisplay { NSMutableArray *headerDaysToDisplay; diff --git a/UI/Scheduler/UIxCalView.h b/UI/Scheduler/UIxCalView.h index b5c9d7fa7..efb1640ed 100644 --- a/UI/Scheduler/UIxCalView.h +++ b/UI/Scheduler/UIxCalView.h @@ -94,6 +94,8 @@ - (NSCalendarDate *) thisMonth; - (NSCalendarDate *) nextMonth; +- (void) setCurrentView: (NSString *) theView; + /* fetching */ - (NSCalendarDate *) startDate; diff --git a/UI/Scheduler/UIxCalView.m b/UI/Scheduler/UIxCalView.m index 917bd5bb0..af82a6ebe 100644 --- a/UI/Scheduler/UIxCalView.m +++ b/UI/Scheduler/UIxCalView.m @@ -340,6 +340,32 @@ static BOOL shouldDisplayWeekend = NO; return [self dateStringForDate: [self nextMonth]]; } +- (void) setCurrentView: (NSString *) theView +{ + SOGoUser *activeUser; + NSString *module; + NSUserDefaults *ud; + NSMutableDictionary *moduleSettings; + SOGoAppointmentFolders *clientObject; + + activeUser = [context activeUser]; + clientObject = [self clientObject]; + + module = [clientObject nameInContainer]; + + ud = [activeUser userSettings]; + moduleSettings = [ud objectForKey: module]; + if (!moduleSettings) + { + moduleSettings = [NSMutableDictionary dictionary]; + [ud setObject: moduleSettings forKey: module]; + } + + [moduleSettings setObject: theView + forKey: @"View"]; + [ud synchronize]; +} + /* current day related */ - (void) setCurrentDay:(NSCalendarDate *) _day diff --git a/UI/Scheduler/UIxCalWeekView.m b/UI/Scheduler/UIxCalWeekView.m index d50e2c3eb..0a075929b 100644 --- a/UI/Scheduler/UIxCalWeekView.m +++ b/UI/Scheduler/UIxCalWeekView.m @@ -35,6 +35,13 @@ @implementation UIxCalWeekView +- (id ) defaultAction +{ + [super setCurrentView: @"weekview"]; + + return self; +} + - (NSCalendarDate *) startDate { NSCalendarDate *date; diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index b91e06d61..f51c09ace 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -11,6 +11,7 @@