From 99944b67f51cd30a4f07dda6fc4636653e633755 Mon Sep 17 00:00:00 2001 From: C Robert Date: Wed, 19 Aug 2009 17:19:32 +0000 Subject: [PATCH] =?UTF-8?q?Mantis=201268:=20SOGo=20Web:=20Module=20au=20d?= =?UTF-8?q?=C3=A9marrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Monotone-Parent: c21bac350b493f251e4917c5ae6b5e88a532b0a0 Monotone-Revision: ca6dc2412eb31b0b8d9918590d81e48f8a2088b4 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-19T17:19:32 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 13 ++ UI/Contacts/UIxContactFoldersView.m | 197 ++++++++++-------- UI/MailerUI/UIxMailListView.m | 17 ++ UI/MainUI/SOGoUserHomePage.m | 12 ++ .../Localizable.strings | 6 + .../Czech.lproj/Localizable.strings | 6 + .../Dutch.lproj/Localizable.strings | 6 + .../English.lproj/Localizable.strings | 6 + .../French.lproj/Localizable.strings | 6 + .../German.lproj/Localizable.strings | 7 + .../Hungarian.lproj/Localizable.strings | 7 + .../Italian.lproj/Localizable.strings | 7 + .../Russian.lproj/Localizable.strings | 8 + .../Spanish.lproj/Localizable.strings | 8 + UI/PreferencesUI/UIxPreferences.m | 37 +++- .../Welsh.lproj/Localizable.strings | 7 + UI/Scheduler/UIxCalMainView.m | 17 ++ UI/Templates/PreferencesUI/UIxPreferences.wox | 7 +- 18 files changed, 283 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80c035bf6..03f0bf211 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-08-19 Cyril Robert + + * UI/MainUI/SOGoUserHomePage.m (defaultAction): Added support for SOGoUIxDefaultModule + * UI/PreferencesUI/UIxPreferences.m: Added: availableModules, + itemModuleText, userDefaultModule, setUserDefaultModule to support + SOGoUIxDefaultModule in the preferences UI. + * UI/Contacts/UIxContactFoldersView.m (checkDefaultModulePreference): Added + to support "Last" SOGoUIxDefaultModule value. + * UI/MailerUI/UIxMailListView.m (checkDefaultModulePreference): Added to + support "Last" SOGoUIxDefaultModule value. + * UI/Scheduler/UIxCalMainView.m (checkDefaultModulePreference): Added to + support "Last" SOGoUIxDefaultModule value. + 2009-08-19 Wolfgang Sourdeau * SoObjects/SOGo/SOGoObject.m (-parseETagList:): greatly diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 36d474623..5c498f2a1 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -195,69 +195,69 @@ NSMutableDictionary *uniqueContacts; unsigned int i, j; NSSortDescriptor *commonNameDescriptor; - + searchText = [self queryParameterForKey: @"search"]; if ([searchText length] > 0) { - //NSLog(@"Search all contacts: %@", searchText); + NSLog(@"Search all contacts: %@", searchText); NS_DURING - folders = [[self clientObject] subFolders]; + folders = [[self clientObject] subFolders]; NS_HANDLER - /* We need to specifically test for @"SOGoDBException", which is - raised explicitly in SOGoParentFolder. Any other exception should - be re-raised. */ - if ([[localException name] isEqualToString: @"SOGoDBException"]) - folders = nil; - else - [localException raise]; + /* We need to specifically test for @"SOGoDBException", which is + raised explicitly in SOGoParentFolder. Any other exception should + be re-raised. */ + if ([[localException name] isEqualToString: @"SOGoDBException"]) + folders = nil; + else + [localException raise]; NS_ENDHANDLER - sortedFolders = [NSMutableArray arrayWithCapacity: [folders count]]; + sortedFolders = [NSMutableArray arrayWithCapacity: [folders count]]; uniqueContacts = [NSMutableDictionary dictionary]; /* We first search in LDAP folders (in case of duplicated entries in GCS folders) */ for (i = 0; i < [folders count]; i++) - { - folder = [folders objectAtIndex: i]; - if ([folder isKindOfClass: [SOGoContactLDAPFolder class]]) - [sortedFolders insertObject: folder atIndex: 0]; - else - [sortedFolders addObject: folder]; - } + { + folder = [folders objectAtIndex: i]; + if ([folder isKindOfClass: [SOGoContactLDAPFolder class]]) + [sortedFolders insertObject: folder atIndex: 0]; + else + [sortedFolders addObject: folder]; + } for (i = 0; i < [sortedFolders count]; i++) - { - folder = [sortedFolders objectAtIndex: i]; - //NSLog(@" Address book: %@ (%@)", [folder displayName], [folder class]); - contacts = [folder lookupContactsWithFilter: searchText - sortBy: @"c_cn" - ordering: NSOrderedAscending]; - for (j = 0; j < [contacts count]; j++) - { - contact = [contacts objectAtIndex: j]; - mail = [contact objectForKey: @"c_mail"]; - //NSLog(@" found %@ (%@)", [contact objectForKey: @"displayName"], mail); - if ([mail isNotNull] && [uniqueContacts objectForKey: mail] == nil) - [uniqueContacts setObject: contact forKey: mail]; - } - } + { + folder = [sortedFolders objectAtIndex: i]; + //NSLog(@" Address book: %@ (%@)", [folder displayName], [folder class]); + contacts = [folder lookupContactsWithFilter: searchText + sortBy: @"c_cn" + ordering: NSOrderedAscending]; + for (j = 0; j < [contacts count]; j++) + { + contact = [contacts objectAtIndex: j]; + mail = [contact objectForKey: @"c_mail"]; + //NSLog(@" found %@ (%@)", [contact objectForKey: @"displayName"], mail); + if ([mail isNotNull] && [uniqueContacts objectForKey: mail] == nil) + [uniqueContacts setObject: contact forKey: mail]; + } + } if ([uniqueContacts count] > 0) - { - // Sort the contacts by display name - commonNameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"c_cn" - ascending:YES] autorelease]; - descriptors = [NSArray arrayWithObjects: commonNameDescriptor, nil]; - sortedContacts = [[uniqueContacts allValues] sortedArrayUsingDescriptors: descriptors]; - } + { + // Sort the contacts by display name + commonNameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"c_cn" + ascending:YES] autorelease]; + descriptors = [NSArray arrayWithObjects: commonNameDescriptor, nil]; + sortedContacts = [[uniqueContacts allValues] sortedArrayUsingDescriptors: descriptors]; + } else - sortedContacts = [NSArray array]; + sortedContacts = [NSArray array]; data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText", - sortedContacts, @"contacts", - nil]; + sortedContacts, @"contacts", + nil]; result = [self responseWithStatus: 200]; [(WOResponse*)result appendContentString: [data jsonRepresentation]]; } else result = [NSException exceptionWithHTTPStatus: 400 - reason: @"missing 'search' parameter"]; - + reason: @"missing 'search' parameter"]; + return result; } @@ -268,23 +268,23 @@ NSString *searchText; id result; LDAPUserManager *um; - + searchText = [self queryParameterForKey: @"search"]; if ([searchText length] > 0) { um = [LDAPUserManager sharedUserManager]; contacts - = [self _responseForResults: [um fetchContactsMatching: searchText]]; + = [self _responseForResults: [um fetchContactsMatching: searchText]]; data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText", - contacts, @"contacts", - nil]; + contacts, @"contacts", + nil]; result = [self responseWithStatus: 200]; [(WOResponse*)result appendContentString: [data jsonRepresentation]]; } else result = [NSException exceptionWithHTTPStatus: 400 - reason: @"missing 'search' parameter"]; - + reason: @"missing 'search' parameter"]; + return result; } @@ -300,8 +300,8 @@ securityManager = [SoSecurityManager sharedSecurityManager]; // return (([securityManager validatePermission: SoPerm_AccessContentsInformation - // onObject: contactFolder - // inContext: context] == nil) + // onObject: contactFolder + // inContext: context] == nil) folders = [NSMutableArray new]; [folders autorelease]; @@ -310,20 +310,20 @@ while ((subfolder = [subfolders nextObject])) { if (![securityManager validatePermission: SOGoPerm_AccessObject - onObject: subfolder inContext: context]) - { - folderName = [NSString stringWithFormat: @"/%@/%@", - [parentFolder nameInContainer], - [subfolder nameInContainer]]; - currentDictionary - = [NSMutableDictionary dictionaryWithCapacity: 3]; - [currentDictionary setObject: [subfolder displayName] - forKey: @"displayName"]; - [currentDictionary setObject: folderName forKey: @"name"]; - [currentDictionary setObject: [subfolder folderType] - forKey: @"type"]; - [folders addObject: currentDictionary]; - } + onObject: subfolder inContext: context]) + { + folderName = [NSString stringWithFormat: @"/%@/%@", + [parentFolder nameInContainer], + [subfolder nameInContainer]]; + currentDictionary + = [NSMutableDictionary dictionaryWithCapacity: 3]; + [currentDictionary setObject: [subfolder displayName] + forKey: @"displayName"]; + [currentDictionary setObject: folderName forKey: @"name"]; + [currentDictionary setObject: [subfolder folderType] + forKey: @"type"]; + [folders addObject: currentDictionary]; + } } return folders; @@ -339,21 +339,39 @@ // upperContainer = [[[self clientObject] container] container]; // userFolder = [SOGoUserFolder objectWithName: uid -// inContainer: upperContainer]; -// contactFolders = [SOGoUserFolder lookupName: @"Contacts" -// inContext: context -// acquire: NO]; -// contactFolder = [contactFolders lookupName: @"personal" -// inContext: context -// acquire: NO]; + // inContainer: upperContainer]; + // contactFolders = [SOGoUserFolder lookupName: @"Contacts" + // inContext: context + // acquire: NO]; + // contactFolder = [contactFolders lookupName: @"personal" + // inContext: context + // acquire: NO]; -// securityManager = [SoSecurityManager sharedSecurityManager]; + // securityManager = [SoSecurityManager sharedSecurityManager]; -// return (([securityManager validatePermission: SoPerm_AccessContentsInformation -// onObject: contactFolder -// inContext: context] == nil) -// ? contactFolder : nil); -// } + // return (([securityManager validatePermission: SoPerm_AccessContentsInformation + // onObject: contactFolder + // inContext: context] == nil) + // ? contactFolder : nil); + // } + +- (void) checkDefaultModulePreference +{ + NSUserDefaults *ud; + NSString *pref; + + if (![self isPopup]) + { + ud = [[context activeUser] userDefaults]; + pref = [ud stringForKey: @"SOGoUIxDefaultModule"]; + + if (pref && [pref isEqualToString: @"Last"]) + { + [ud setObject: @"Contacts" forKey: @"SOGoUIxLastModule"]; + [ud synchronize]; + } + } +} - (BOOL) isPopup { @@ -364,6 +382,7 @@ { SOGoContactFolders *folderContainer; + [self checkDefaultModulePreference]; folderContainer = [self clientObject]; return [folderContainer subFolders]; @@ -372,7 +391,7 @@ - (NSString *) currentContactFolderId { return [NSString stringWithFormat: @"/%@", - [currentFolder nameInContainer]]; + [currentFolder nameInContainer]]; } - (NSString *) currentContactFolderName @@ -387,26 +406,26 @@ - (NSString *) currentContactFolderClass { - return ([currentFolder isKindOfClass: [SOGoContactLDAPFolder class]]? @"remote" : @"local"); + return ([currentFolder isKindOfClass: [SOGoContactLDAPFolder class]]? @"remote" : @"local"); } - (WOResponse *) saveDragHandleStateAction { WORequest *request; NSString *dragHandle; - + [self _setupContext]; request = [context request]; - + if ((dragHandle = [request formValueForKey: @"vertical"]) != nil) - [moduleSettings setObject: dragHandle - forKey: @"DragHandleVertical"]; + [moduleSettings setObject: dragHandle + forKey: @"DragHandleVertical"]; else if ((dragHandle = [request formValueForKey: @"horizontal"]) != nil) - [moduleSettings setObject: dragHandle - forKey: @"DragHandleHorizontal"]; + [moduleSettings setObject: dragHandle + forKey: @"DragHandleHorizontal"]; else return [self responseWithStatus: 400]; - + [ud synchronize]; return [self responseWithStatus: 204]; diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index e5f475603..f9cb83500 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -470,6 +470,21 @@ return 1; } +- (void) checkDefaultModulePreference +{ + NSUserDefaults *ud; + NSString *pref; + + ud = [[context activeUser] userDefaults]; + pref = [ud stringForKey: @"SOGoUIxDefaultModule"]; + + if (pref && [pref isEqualToString: @"Last"]) + { + [ud setObject: @"Mail" forKey: @"SOGoUIxLastModule"]; + [ud synchronize]; + } +} + - (NSArray *) messages { NSMutableArray *unsortedMsgs; @@ -479,6 +494,8 @@ unsigned len, i, count; NSRange r; + + [self checkDefaultModulePreference]; if (!messages) { diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index e8ccf5b79..8eeee8fe3 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -88,8 +88,20 @@ static NSString *LDAPContactInfoAttribute = nil; - (id ) defaultAction { SOGoUserFolder *co; + NSUserDefaults *ud; + NSString *userDefinedModule; NSURL *moduleURL; + ud = [[context activeUser] userDefaults]; + userDefinedModule = [ud stringForKey: @"SOGoUIxDefaultModule"]; + if (userDefinedModule) + { + if ([userDefinedModule isEqualToString: @"Last"]) + userDefinedModule = [ud stringForKey: @"SOGoUIxLastModule"]; + + defaultModule = userDefinedModule; + } + co = [self clientObject]; moduleURL = [NSURL URLWithString: defaultModule relativeToURL: [co soURL]]; diff --git a/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings b/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings index ba8f347c9..1158875a8 100644 --- a/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/PreferencesUI/BrazilianPortuguese.lproj/Localizable.strings @@ -115,3 +115,9 @@ "category_none" = "Nenhum"; "category_labels" = "Aniversário,Negócios,Ligações,Concorrência,Cliente,Favoritos,Acompanhamento,Presentes,Feriados,Idéias,Problemas,Miscelânea,Pessoal,Projetos,Feriado público,Posição,Fornecedores,Viagem,Férias"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; diff --git a/UI/PreferencesUI/Czech.lproj/Localizable.strings b/UI/PreferencesUI/Czech.lproj/Localizable.strings index 6b6d2c85e..0f24ae757 100644 --- a/UI/PreferencesUI/Czech.lproj/Localizable.strings +++ b/UI/PreferencesUI/Czech.lproj/Localizable.strings @@ -115,3 +115,9 @@ "category_none" = "Žádný"; "category_labels" = "Výročí,Narozeniny,Obchod,Hovory,Klienti,Soutěže,Zákazník,Oblíbené,Sledování,Dárky,Volno,Nápady,Problémy,Různé,Osobní,Projekty,Veřejné prázdniny,Stav,Dodavatelé,Cesta,Dovolená"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; diff --git a/UI/PreferencesUI/Dutch.lproj/Localizable.strings b/UI/PreferencesUI/Dutch.lproj/Localizable.strings index 63c2930f0..18b3bed94 100644 --- a/UI/PreferencesUI/Dutch.lproj/Localizable.strings +++ b/UI/PreferencesUI/Dutch.lproj/Localizable.strings @@ -110,3 +110,9 @@ "category_none" = "Geen categorie"; "category_labels" = "Cliënten,Concurrentie,Diversen,Favorieten,Giften,Ideeën,Klant,Kwesties,Leveranciers,Nationale feestdag,Persoonlijk,Projecten,Reizen,Status,Telefoongesprekken,Trouwdag,Vakantie,Verjaardag,Vervolggesprek,Vrije dagen,Zaken"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index c249357c2..f9bb5a4ba 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -115,3 +115,9 @@ "category_none" = "None"; "category_labels" = "Anniversary,Birthday,Business,Calls,Clients,Competition,Customer,Favorites,Follow up,Gifts,Holidays,Ideas,Issues,Miscellaneous,Personal,Projects,Public Holiday,Status,Suppliers,Travel,Vacation"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index 8268ec12b..af0ad4b82 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -111,3 +111,9 @@ "category_none" = "Aucune"; "category_labels" = "Anniversaire,Affaire,Appels,Clients,Compétitions,Congrès,Consommation,Préférés,Suivis,Cadeaux,Congés,Idées,Problèmes,Divers,Personnel,Projets,Jour férié,Réunion,Fournisseurs,Voyages,Professionnel"; +/* Default module */ +"Calendar" = "Agenda"; +"Contacts" = "Carnet d'adresses"; +"Mail" = "Courrier"; +"Last" = "Dernier utilisé"; +"Default module :" = "Module par défaut :"; diff --git a/UI/PreferencesUI/German.lproj/Localizable.strings b/UI/PreferencesUI/German.lproj/Localizable.strings index c7f0a2575..69432e4da 100644 --- a/UI/PreferencesUI/German.lproj/Localizable.strings +++ b/UI/PreferencesUI/German.lproj/Localizable.strings @@ -111,3 +111,10 @@ "category_none" = "Keine"; "category_labels" = "Jubiläum,Geburtstag,Geschäft,Anrufe,Klienten,Konkurrenz,Kunde,Favoriten,Nachgehen,Geschenke,Ferien,Ideen,Fragen,Verschiedenes,Persönlich,Projekte,Feiertag,Status,Lieferanten,Reise,Urlaub"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/PreferencesUI/Hungarian.lproj/Localizable.strings b/UI/PreferencesUI/Hungarian.lproj/Localizable.strings index 5b4b54334..e8ae55f77 100644 --- a/UI/PreferencesUI/Hungarian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Hungarian.lproj/Localizable.strings @@ -115,3 +115,10 @@ "category_none" = "Nincs"; "category_labels" = "Évforduló,Születésnap,Üzleti,Meghívás,Ügyfelek,Versenytársak,Vevő,Kedvencek,Nyomonkövetés,Ajándékozás,Szabadság,Ötletek,Ügyek,Egyéb,Személyes,Projektek,Állami ünnep,Állapot,Szállítók,Utazás,Szünidő"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/PreferencesUI/Italian.lproj/Localizable.strings b/UI/PreferencesUI/Italian.lproj/Localizable.strings index f5a7c1b7f..0320f355e 100644 --- a/UI/PreferencesUI/Italian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Italian.lproj/Localizable.strings @@ -115,3 +115,10 @@ "category_none" = "Nessuna"; "category_labels" = "Anniversari,Compleanni,Lavoro,Chiamate,Clienti,Competizioni,Compratori,Preferiti,Incontri,Regali,Vacanze,Idee,Problemi,Varie,Personale,Progetti,Giorno festivo,Stato,Fornitori,Viaggio,Chiusura"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/PreferencesUI/Russian.lproj/Localizable.strings b/UI/PreferencesUI/Russian.lproj/Localizable.strings index 38e7b4337..d76058711 100644 --- a/UI/PreferencesUI/Russian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Russian.lproj/Localizable.strings @@ -115,3 +115,11 @@ "category_none" = "None"; "category_labels" = "Anniversary,Birthday,Business,Calls,Clients,Competition,Customer,Favorites,Follow up,Gifts,Holidays,Ideas,Issues,Miscellaneous,Personal,Projects,Public Holiday,Status,Suppliers,Travel,Vacation"; + +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/PreferencesUI/Spanish.lproj/Localizable.strings b/UI/PreferencesUI/Spanish.lproj/Localizable.strings index 2470d62b6..d05198d90 100644 --- a/UI/PreferencesUI/Spanish.lproj/Localizable.strings +++ b/UI/PreferencesUI/Spanish.lproj/Localizable.strings @@ -121,3 +121,11 @@ "category_none" = "Ninguna"; "category_labels" = "Aniversario,Cumpleaños,Negocios,Llamadas,Clientes,Competición,Trabajo,Favoritos,Seguimiento,Regalos,Fiestas,Ideas,Asuntos,Varios,Personal,Proyectos,Vacaciones públicas,Estado,Proveedores,Viajes,Vacaciones"; + +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 704dec599..dade581c6 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -486,7 +486,6 @@ static BOOL defaultShowSubscribedFoldersOnly = NO; arrayForKey: @"SOGoMailPollingIntervals"]]; if ([defaultList count] > 0) { - NSLog (@"defaultsValue: %@", defaultList); rc = [NSMutableArray arrayWithObjects: @"manually", nil]; count = [defaultList count]; for (i = 0; i < count; i++) @@ -647,6 +646,42 @@ static BOOL defaultShowSubscribedFoldersOnly = NO; [userDefaults setObject: newSignaturePlacement forKey: @"SignaturePlacement"]; } +- (NSArray *) availableModules +{ + NSMutableArray *rc, *modules; + int i, count; + + modules = [NSMutableArray arrayWithObjects: @"Calendar", @"Mail", nil]; + rc = [NSMutableArray arrayWithObjects: @"Last", @"Contacts", nil]; + count = [modules count]; + + for (i = 0; i < count; i++) + if ([user canAccessModule: [modules objectAtIndex: i]]) + [rc addObject: [modules objectAtIndex: i]]; + + return rc; +} + +- (NSString *) itemModuleText +{ + return [self labelForKey: item]; +} + +- (NSString *) userDefaultModule +{ + NSUserDefaults *ud; + ud = [user userDefaults]; + + return [ud stringForKey: @"SOGoUIxDefaultModule"]; +} + +- (void) setUserDefaultModule: (NSString *) newValue +{ + NSUserDefaults *ud; + ud = [user userDefaults]; + [ud setObject: newValue forKey: @"SOGoUIxDefaultModule"]; +} + - (id ) defaultAction { id results; diff --git a/UI/PreferencesUI/Welsh.lproj/Localizable.strings b/UI/PreferencesUI/Welsh.lproj/Localizable.strings index 043333ee8..c4063a80f 100644 --- a/UI/PreferencesUI/Welsh.lproj/Localizable.strings +++ b/UI/PreferencesUI/Welsh.lproj/Localizable.strings @@ -115,3 +115,10 @@ "category_none" = "Dim"; "category_labels" = "Amrywiol,Anrhegion,Busnes,Canlyniadau,Clientau,Cwsmer,Cyflenwyr,Cystadleuaeth,Dilyn lan,Ffefrynnau,Galwadau,Gwyliau,Gwyliau Cyhoeddus,Penblwydd,Personol,Projectau,Statws,Syniadau,Teithio"; +/* Default module */ +"Calendar" = "Calendar"; +"Contacts" = "Address Book"; +"Mail" = "Mail"; +"Last" = "Last used"; +"Default module :" = "Default module :"; + diff --git a/UI/Scheduler/UIxCalMainView.m b/UI/Scheduler/UIxCalMainView.m index 2c1cfb47f..b1f5ea96b 100644 --- a/UI/Scheduler/UIxCalMainView.m +++ b/UI/Scheduler/UIxCalMainView.m @@ -43,12 +43,29 @@ @implementation UIxCalMainView +- (void) checkDefaultModulePreference +{ + NSUserDefaults *userd; + NSString *pref; + + userd = [[context activeUser] userDefaults]; + pref = [userd stringForKey: @"SOGoUIxDefaultModule"]; + + if (pref && [pref isEqualToString: @"Last"]) + { + [userd setObject: @"Calendar" forKey: @"SOGoUIxLastModule"]; + [userd synchronize]; + } +} + - (void) _setupContext { SOGoUser *activeUser; NSString *module; SOGoAppointmentFolders *clientObject; + [self checkDefaultModulePreference]; + activeUser = [context activeUser]; clientObject = [self clientObject]; diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 01bba48f6..7e32aae3b 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -55,7 +55,12 @@ + />
+