From 70768d420e9a5243e93b3c2b6d041f9058fd2c47 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 19 Jun 2007 17:58:21 +0000 Subject: [PATCH] Monotone-Parent: 759f56bb9faa71b79a075866ec2f0a77d1f08bd8 Monotone-Revision: 40a3a3e82a6e149008b93190dcfd86a7e7f4d2b7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-19T17:58:21 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 + .../English.lproj/Localizable.strings | 73 +++ .../French.lproj/Localizable.strings | 70 +++ UI/PreferencesUI/GNUmakefile | 32 ++ UI/PreferencesUI/PreferencesUIProduct.m | 33 ++ .../Toolbars/UIxPreferences.toolbar | 12 + UI/PreferencesUI/UIxJSONPreferences.h | 32 ++ UI/PreferencesUI/UIxJSONPreferences.m | 52 +++ UI/PreferencesUI/UIxPreferences.h | 45 ++ UI/PreferencesUI/UIxPreferences.m | 429 ++++++++++++++++++ UI/PreferencesUI/Version | 1 + UI/PreferencesUI/product.plist | 36 ++ UI/Templates/PreferencesUI/UIxPreferences.wox | 104 +++++ 13 files changed, 922 insertions(+) create mode 100644 UI/PreferencesUI/English.lproj/Localizable.strings create mode 100644 UI/PreferencesUI/French.lproj/Localizable.strings create mode 100644 UI/PreferencesUI/GNUmakefile create mode 100644 UI/PreferencesUI/PreferencesUIProduct.m create mode 100644 UI/PreferencesUI/Toolbars/UIxPreferences.toolbar create mode 100644 UI/PreferencesUI/UIxJSONPreferences.h create mode 100644 UI/PreferencesUI/UIxJSONPreferences.m create mode 100644 UI/PreferencesUI/UIxPreferences.h create mode 100644 UI/PreferencesUI/UIxPreferences.m create mode 100644 UI/PreferencesUI/Version create mode 100644 UI/PreferencesUI/product.plist create mode 100644 UI/Templates/PreferencesUI/UIxPreferences.wox diff --git a/ChangeLog b/ChangeLog index 3130278d5..c38c54d5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-06-19 Wolfgang Sourdeau + * UI/PreferencesUI/product.plist: new bundle that provides a web + ui for handling user defaults. + * UI/Scheduler/UIxTaskView.[hm]: removed unused module. * UI/Scheduler/UIxAppointmentView.[hm]: removed unused module. diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings new file mode 100644 index 000000000..28a5e7530 --- /dev/null +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -0,0 +1,73 @@ +/* toolbar */ +"Save and Close" = "Save and Close"; +"Close" = "Close"; + +/* tabs */ +"Out of Office" = "Out of Office"; +"Date and Time" = "Date and Time"; +"Calendar Options" = "Calendar Options"; +"Password" = "Password"; + +/* ooo */ +"I'm currently in the office" = "I'm currently in the office"; +"I'm currently out of the office" = "I'm currently out of the office"; +"AutoReply only once to each sender with the following text :" += "AutoReply only once to each sender with the following text :"; + +/* d & t */ +"Current Time Zone :" = "Current Time Zone :"; +"Short Date Format :" = "Short Date Format :"; +"Long Date Format :" = "Long Date Format :"; +"Time Format :" = "Time Format :"; + +"shortDateFmt_0" = "%m/%e/%Y"; +"shortDateFmt_1" = "%m/%e/%y"; +"shortDateFmt_2" = "%m/%d/%Y"; +"shortDateFmt_3" = "%m/%d/%y"; +"shortDateFmt_4" = "%y/%m/%d"; +"shortDateFmt_5" = "%Y-%m-%d"; +"shortDateFmt_6" = "%d-%b-%y"; +"shortDateFmt_7" = ""; + +"longDateFmt_0" = "%A, %B %d, %Y"; +"longDateFmt_1" = "%B %d, %Y"; +"longDateFmt_2" = "%A, %d %B, %Y"; +"longDateFmt_3" = "%d %B, %Y"; +"longDateFmt_4" = ""; + +"timeFmt_0" = "%I:%M %p"; +"timeFmt_1" = "%H:%M"; +"timeFmt_2" = ""; + +/* calendar */ +"Week begins on :" = "Week begins on :"; +"Day start time :" = "Day start time :"; +"Day end time :" = "Day end time :"; +"First week of year :" = "First week of year :"; +"Enable reminders for Calendar items" = "Enable reminders for Calendar items"; +"Play a sound when a reminder comes due" += "Play a sound when a reminder comes due"; +"Default reminder :" = "Default reminder :"; + +"firstWeekOfYear_HideWeekNumbers" = "Do not display week numbers"; +"firstWeekOfYear_January1" = "Starts on january 1"; +"firstWeekOfYear_First4DayWeek" = "First 4-day week"; +"firstWeekOfYear_FirstFullWeek" = "First full week"; + +"reminderTime_0000" = "0 minutes"; +"reminderTime_0005" = "5 minutes"; +"reminderTime_0010" = "10 minutes"; +"reminderTime_0015" = "15 minutes"; +"reminderTime_0030" = "30 minutes"; +"reminderTime_0100" = "1 hour"; +"reminderTime_0200" = "2 hours"; +"reminderTime_0400" = "2 hours"; +"reminderTime_0800" = "2 hours"; +"reminderTime_1200" = "1/2 day"; +"reminderTime_2400" = "1 day"; +"reminderTime_4800" = "2 days"; + +/* password */ +"New password:" = "New password:"; +"Confirmation:" = "Confirmation:"; +"Change" = "Change"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings new file mode 100644 index 000000000..74b46dd5f --- /dev/null +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -0,0 +1,70 @@ +/* toolbar */ +"Save and Close" = "Enregistrer et fermer"; +"Close" = "Fermer"; + +/* tabs */ +"Out of Office" = "Absence du bureau"; +"Date and Time" = "Date et heure"; +"Calendar Options" = "Calendrier"; +"Password" = "Mot de passe"; + +/* ooo */ +"I'm currently in the office" = "Je suis présent"; +"I'm currently out of the office" = "Je suis absent"; +"AutoReply only once to each sender with the following text :" += "Répondre automatiquement avec le texte suivant, une seule fois par expéditeur :"; + +/* d & t */ +"Current Time Zone :" = "Fuseau horaire en cours :"; +"Short Date Format :" = "Style de date courte :"; +"Long Date Format :" = "Style de date longue :"; +"Time Format :" = "Style de l'heure :"; + +"shortDateFmt_0" = "%d/%m/%Y"; +"shortDateFmt_1" = "%d/%m/%y"; +"shortDateFmt_2" = "%d.%m.%y"; +"shortDateFmt_3" = "%d-%m-%y"; +"shortDateFmt_4" = "%Y-%m-%d"; +"shortDateFmt_5" = ""; + +"longDateFmt_0" = "%A %e %B %Y"; +"longDateFmt_1" = "%e %b. %Y"; +"longDateFmt_2" = "%e %B %Y"; +"longDateFmt_3" = ""; + +"timeFmt_0" = "%H:%M"; +"timeFmt_1" = "%H.%M"; +"timeFmt_2" = "%H h. %M"; +"timeFmt_3" = ""; + +/* calendar */ +"Week begins on :" = "Premier jour de la semaine :"; +"Day start time :" = "Début de la journée :"; +"Day end time :" = "Fin de la journée :"; +"First week of year :" = "Première semaine de l'année :"; +"Enable reminders for Calendar items" = "Activer les rappels pour les éléments du calendrier"; +"Play a sound when a reminder comes due" = "Émettre un signal sonore à l'échéance du rappel"; +"Default reminder :" = "Rappel par défaut :"; + +"firstWeekOfYear_HideWeekNumbers" = "Ne pas afficher le numéro des semaines"; +"firstWeekOfYear_January1" = "Commence le 1er janvier"; +"firstWeekOfYear_First4DayWeek" = "Première semaine de 4 jours"; +"firstWeekOfYear_FirstFullWeek" = "Première semaine entière"; + +"reminderTime_0000" = "0 minutes"; +"reminderTime_0005" = "5 minutes"; +"reminderTime_0010" = "10 minutes"; +"reminderTime_0015" = "15 minutes"; +"reminderTime_0030" = "30 minutes"; +"reminderTime_0100" = "1 heure"; +"reminderTime_0200" = "2 heures"; +"reminderTime_0400" = "2 heures"; +"reminderTime_0800" = "2 heures"; +"reminderTime_1200" = "1/2 journée"; +"reminderTime_2400" = "1 journée"; +"reminderTime_4800" = "2 journées"; + +/* password */ +"New password:" = "Nouveau mot de passe :"; +"Confirmation:" = "Confirmation :"; +"Change" = "Changer"; diff --git a/UI/PreferencesUI/GNUmakefile b/UI/PreferencesUI/GNUmakefile new file mode 100644 index 000000000..86fe28270 --- /dev/null +++ b/UI/PreferencesUI/GNUmakefile @@ -0,0 +1,32 @@ +# GNUstep makefile + +include ../common.make + +BUNDLE_NAME = PreferencesUI + +PreferencesUI_PRINCIPAL_CLASS = PreferencesUIProduct + +PreferencesUI_LANGUAGES = English French + +PreferencesUI_OBJC_FILES = \ + PreferencesUIProduct.m \ + \ + UIxJSONPreferences.m \ + UIxPreferences.m + +PreferencesUI_RESOURCE_FILES += \ + Version \ + product.plist + +PreferencesUI_RESOURCE_FILES += \ + Toolbars/UIxPreferences.toolbar + +PreferencesUI_LOCALIZED_RESOURCE_FILES += \ + Localizable.strings \ + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/bundle.make +-include GNUmakefile.postamble +include ../../fhsbundle.make + + diff --git a/UI/PreferencesUI/PreferencesUIProduct.m b/UI/PreferencesUI/PreferencesUIProduct.m new file mode 100644 index 000000000..9f569d1a4 --- /dev/null +++ b/UI/PreferencesUI/PreferencesUIProduct.m @@ -0,0 +1,33 @@ +/* PreferencesUIProduct.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +@interface PreferencesUIProduct : NSObject +{ +} + +@end + +@implementation PreferencesUIProduct + +@end diff --git a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar new file mode 100644 index 000000000..b30200e85 --- /dev/null +++ b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar @@ -0,0 +1,12 @@ +( /* the toolbar groups -*-cperl-*- */ + ( { link = "#"; + label = "Save and Close"; + onclick = "return savePreferences();"; + image = "tb-compose-save-flat-24x24.png"; }, + { link = "#"; + isSafe = NO; + label = "Close"; + onclick = "window.close(); return false;"; + image = "tb-mail-stop-flat-24x24.png"; } + ) +) diff --git a/UI/PreferencesUI/UIxJSONPreferences.h b/UI/PreferencesUI/UIxJSONPreferences.h new file mode 100644 index 000000000..df3982057 --- /dev/null +++ b/UI/PreferencesUI/UIxJSONPreferences.h @@ -0,0 +1,32 @@ +/* UIxJSONPreferences.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXJSONPREFERENCES_H +#define UIXJSONPREFERENCES_H + +#import + +@interface UIxJSONPreferences : WODirectAction + +@end + +#endif /* UIXJSONSETTINGS_H */ diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m new file mode 100644 index 000000000..96f1d35f9 --- /dev/null +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -0,0 +1,52 @@ +/* UIxJSONPreferences.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +#import +#import + +#import + +#import "UIxJSONPreferences.h" + +@implementation UIxJSONPreferences + +- (WOResponse *) jsonDefaultsAction +{ + NSUserDefaults *defaults; + + defaults = [[context activeUser] userDefaults]; + + return [defaults jsonRepresentation]; +} + +- (WOResponse *) jsonSettingsAction +{ + NSUserDefaults *settings; + + settings = [[context activeUser] userSettings]; + + return [settings jsonRepresentation]; +} + +@end diff --git a/UI/PreferencesUI/UIxPreferences.h b/UI/PreferencesUI/UIxPreferences.h new file mode 100644 index 000000000..5570fbc7e --- /dev/null +++ b/UI/PreferencesUI/UIxPreferences.h @@ -0,0 +1,45 @@ +/* UIxPreferences.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXPREFERENCES_H +#define UIXPREFERENCES_H + +#import + +@class NSString; +@class NSUserDefaults; + +@class SOGoUser; + +@interface UIxPreferences : UIxComponent +{ + NSString *item; + SOGoUser *user; + NSUserDefaults *userDefaults; + NSCalendarDate *today; + NSMutableArray *hours; + NSArray *daysOfWeek; +} + +@end + +#endif /* UIXPREFERENCES_H */ diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m new file mode 100644 index 000000000..2c8c486b8 --- /dev/null +++ b/UI/PreferencesUI/UIxPreferences.m @@ -0,0 +1,429 @@ +/* UIxPreferences.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import +#import + +#import +#import + +#import + +#import "UIxPreferences.h" + +#warning this class is not finished +/* remaining: + default event length + default snooze length + refresh calendar every X minutes + workweek = from -> to + identities */ + +@implementation UIxPreferences + +- (id) init +{ + NSDictionary *locale; + + if ((self = [super init])) + { + item = nil; + hours = nil; + ASSIGN (user, [context activeUser]); + ASSIGN (userDefaults, [user userDefaults]); + ASSIGN (today, [NSCalendarDate date]); + locale = [context valueForKey: @"locale"]; + ASSIGN (daysOfWeek, + [locale objectForKey: NSWeekDayNameArray]); + } + + return self; +} + +- (void) dealloc +{ + [today release]; + [item release]; + [user release]; + [userDefaults release]; + [hours release]; + [daysOfWeek release]; + [super dealloc]; +} + +- (void) setItem: (NSString *) newItem +{ + ASSIGN (item, newItem); +} + +- (NSString *) item +{ + return item; +} + +- (NSString *) inTheOffice +{ + NSString *inTheOffice; + + inTheOffice = [userDefaults objectForKey: @"InTheOffice"]; + + return ((!inTheOffice || [inTheOffice boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setInTheOffice: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"InTheOffice"]; +} + +- (void) setAutoReplyText: (NSString *) newAutoReplyText +{ + [userDefaults setObject: newAutoReplyText forKey: @"AutoReplyText"]; +} + +- (NSString *) autoReplyText +{ + return [userDefaults objectForKey: @"AutoReplyText"]; +} + +- (NSArray *) timeZonesList +{ + return [NSTimeZone knownTimeZoneNames]; +} + +- (NSString *) userTimeZone +{ + return [[user timeZone] timeZoneName]; +} + +- (void) setUserTimeZone: (NSString *) newUserTimeZone +{ + [userDefaults setObject: newUserTimeZone forKey: @"TimeZone"]; +} + +- (NSArray *) shortDateFormatsList +{ + NSMutableArray *shortDateFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + shortDateFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"shortDateFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [shortDateFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return shortDateFormatsList; +} + +- (NSString *) itemShortDateFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userShortDateFormat +{ + return [userDefaults objectForKey: @"ShortDateFormat"]; +} + +- (void) setUserShortDateFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"ShortDateFormat"]; +} + +- (NSArray *) longDateFormatsList +{ + NSMutableArray *longDateFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + longDateFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"longDateFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [longDateFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return longDateFormatsList; +} + +- (NSString *) itemLongDateFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userLongDateFormat +{ + return [userDefaults objectForKey: @"LongDateFormat"]; +} + +- (void) setUserLongDateFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"LongDateFormat"]; +} + +- (NSArray *) timeFormatsList +{ + NSMutableArray *timeFormatsList = nil; + NSString *key, *currentFormat; + unsigned int nbr; + BOOL done; + + timeFormatsList = [NSMutableArray array]; + + nbr = 0; + done = NO; + while (!done) + { + key = [NSString stringWithFormat: @"timeFmt_%d", nbr]; + currentFormat = [self labelForKey: key]; + if ([currentFormat length] > 0) + { + [timeFormatsList addObject: currentFormat]; + nbr++; + } + else + done = YES; + } + + return timeFormatsList; +} + +- (NSString *) itemTimeFormatText +{ + return [today descriptionWithCalendarFormat: item + locale: [context valueForKey: @"locale"]]; +} + +- (NSString *) userTimeFormat +{ + return [userDefaults objectForKey: @"TimeFormat"]; +} + +- (void) setUserTimeFormat: (NSString *) newFormat +{ + [userDefaults setObject: newFormat forKey: @"TimeFormat"]; +} + +- (NSArray *) daysList +{ + NSMutableArray *daysList; + unsigned int currentDay; + + daysList = [NSMutableArray new]; + [daysList autorelease]; + for (currentDay = 0; currentDay < 7; currentDay++) + [daysList addObject: [NSString stringWithFormat: @"%d", currentDay]]; + + return daysList; +} + +- (NSString *) itemWeekStartDay +{ + return [daysOfWeek objectAtIndex: [item intValue]]; +} + +- (NSString *) userWeekStartDay +{ + return [userDefaults objectForKey: @"WeekStartDay"]; +} + +- (void) setUserWeekStartDay: (NSString *) newDay +{ + [userDefaults setObject: newDay forKey: @"WeekStartDay"]; +} + +- (NSArray *) hoursList +{ + unsigned int currentHour; + + if (!hours) + { + hours = [[NSMutableArray alloc] initWithCapacity: 24]; + for (currentHour = 0; currentHour < 24; currentHour++) + [hours addObject: [NSString stringWithFormat: @"%.2d:00", + currentHour]]; + } + + return hours; +} + +- (NSString *) userDayStartTime +{ + NSString *time; + + time = [userDefaults objectForKey: @"DayStartTime"]; + if (!time) + time = @"08:00"; + + return time; +} + +- (void) setUserDayStartTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"DayStartTime"]; +} + +- (NSString *) userDayEndTime +{ + NSString *time; + + time = [userDefaults objectForKey: @"DayEndTime"]; + if (!time) + time = @"18:00"; + + return time; +} + +- (void) setUserDayEndTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"DayEndTime"]; +} + +- (NSArray *) firstWeekList +{ + return [NSArray arrayWithObjects: SOGoWeekStartHideWeekNumbers, + SOGoWeekStartJanuary1, + SOGoWeekStartFirst4DayWeek, + SOGoWeekStartFirstFullWeek, nil]; +} + +- (NSString *) itemFirstWeekText +{ + return [self labelForKey: [NSString stringWithFormat: @"firstWeekOfYear_%@", + item]]; +} + +- (NSString *) userFirstWeek +{ + return [userDefaults objectForKey: @"FirstWeek"]; +} + +- (void) setUserFirstWeek: (NSString *) newFirstWeek +{ + [userDefaults setObject: newFirstWeek forKey: @"FirstWeek"]; +} + +- (NSString *) reminderEnabled +{ + NSString *reminderEnabled; + + reminderEnabled = [userDefaults objectForKey: @"ReminderEnabled"]; + + return ((!reminderEnabled || [reminderEnabled boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setReminderEnabled: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"ReminderEnabled"]; +} + +- (NSString *) remindWithASound +{ + NSString *remindWithASound; + + remindWithASound = [userDefaults objectForKey: @"RemindWithASound"]; + + return ((!remindWithASound || [remindWithASound boolValue]) + ? @"YES" : @"NO"); +} + +- (void) setRemindWithASound: (NSString *) newValue +{ + [userDefaults setObject: newValue forKey: @"RemindWithASound"]; +} + +- (NSArray *) reminderTimesList +{ + return [NSArray arrayWithObjects: @"0000", @"0005", @"0010", @"0015", + @"0030", @"0100", @"0200", @"0400", @"0800", @"1200", + @"2400", @"4800", nil]; +} + +- (NSString *) itemReminderTimeText +{ + return [self labelForKey: + [NSString stringWithFormat: @"reminderTime_%@", item]]; +} + +- (NSString *) userReminderTime +{ + return [userDefaults objectForKey: @"ReminderTime"]; +} + +- (void) setReminderTime: (NSString *) newTime +{ + [userDefaults setObject: newTime forKey: @"ReminderTime"]; +} + +- (id ) defaultAction +{ + id results; + WORequest *request; + + request = [context request]; + if ([[request method] isEqualToString: @"POST"]) + { + [userDefaults synchronize]; + results = [self jsCloseWithRefreshMethod: nil]; + } + else + results = self; + + return results; +} + +- (BOOL) shouldTakeValuesFromRequest: (WORequest *) request + inContext: (WOContext*) context +{ + return [[request method] isEqualToString: @"POST"]; +} + +@end diff --git a/UI/PreferencesUI/Version b/UI/PreferencesUI/Version new file mode 100644 index 000000000..b2a4ba591 --- /dev/null +++ b/UI/PreferencesUI/Version @@ -0,0 +1 @@ +# nothing here diff --git a/UI/PreferencesUI/product.plist b/UI/PreferencesUI/product.plist new file mode 100644 index 000000000..de4a1d90d --- /dev/null +++ b/UI/PreferencesUI/product.plist @@ -0,0 +1,36 @@ +{ /* -*-javascript-*- */ + requires = ( MAIN, MainUI, CommonUI ); + + publicResources = ( + ); + + factories = { + }; + + categories = { + SOGoUserFolder = { + slots = { + toolbar = { + protectedBy = "View"; + value = "UIxPreferences.toolbar"; + }; + }; + methods = { + preferences = { + protectedBy = "View"; + pageName = "UIxPreferences"; + }; + jsonDefaults = { + protectedBy = "View"; + actionClass = "UIxJSONPreferences"; + actionName = "jsonDefaults"; + }; + jsonSettings = { + protectedBy = "View"; + actionClass = "UIxJSONPreferences"; + actionName = "jsonSettings"; + }; + }; + }; + }; +} diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox new file mode 100644 index 000000000..223c86b7f --- /dev/null +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -0,0 +1,104 @@ + + + +
+
+
    +
  • +
  • +
  • +
  • +
+
+
+
+
+
+