From fe8b465ddc30520db0cdff9ecf9531327f6153e7 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 8 Feb 2010 17:17:28 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 0a4b114d2f6d275bb25991bd16c7f776c00ee233 Monotone-Revision: c8a36e926bc75ffc1d4206737365b76d6621e3ab Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-02-08T17:17:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++ UI/Contacts/UIxContactFoldersView.h | 1 + UI/Contacts/UIxContactFoldersView.m | 62 ++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d7fe7e46..d002a86b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-02-08 Francis Lachapelle + * UI/Contacts/UIxContactFoldersView.m (-verticalDragHandleStyle): + new method (was missing), borrowed from UIxCalMainView.m. + (-horizontalDragHandleStyle): idem. + (contactsListContentStyle): idem. + * UI/WebServerResources/ContactsUI.js (-onAddressBookRemove): avoid selecting the personal addressbook prior to obtaining the user's answer. diff --git a/UI/Contacts/UIxContactFoldersView.h b/UI/Contacts/UIxContactFoldersView.h index 945300d7b..d385c1adf 100644 --- a/UI/Contacts/UIxContactFoldersView.h +++ b/UI/Contacts/UIxContactFoldersView.h @@ -32,6 +32,7 @@ NSString *selectorComponentClass; NSMutableDictionary *moduleSettings; id currentFolder; + BOOL contextIsSetup; } - (NSArray *) contactFolders; diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 2939b431a..8696e96b4 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -53,22 +53,34 @@ @implementation UIxContactFoldersView +- (id) init +{ + if ((self = [super init])) + contextIsSetup = NO; + + return self; +} + - (void) _setupContext { SOGoUser *activeUser; NSString *module; SOGoContactFolders *clientObject; - activeUser = [context activeUser]; - clientObject = [self clientObject]; - - module = [clientObject nameInContainer]; - - us = [activeUser userSettings]; - moduleSettings = [us objectForKey: module]; - if (!moduleSettings) - moduleSettings = [NSMutableDictionary dictionary]; - [us setObject: moduleSettings forKey: module]; + if (!contextIsSetup) + { + activeUser = [context activeUser]; + clientObject = [self clientObject]; + + module = [clientObject nameInContainer]; + + us = [activeUser userSettings]; + moduleSettings = [us objectForKey: module]; + if (!moduleSettings) + moduleSettings = [NSMutableDictionary dictionary]; + [us setObject: moduleSettings forKey: module]; + contextIsSetup = YES; + } } - (id ) mailerContactsAction @@ -411,6 +423,36 @@ return ([currentFolder isKindOfClass: [SOGoContactSourceFolder class]]? @"remote" : @"local"); } +- (NSString *) verticalDragHandleStyle +{ + NSString *vertical; + + [self _setupContext]; + vertical = [moduleSettings objectForKey: @"DragHandleVertical"]; + + return ((vertical && [vertical intValue] > 0) ? (id)[vertical stringByAppendingFormat: @"px"] : nil); +} + +- (NSString *) horizontalDragHandleStyle +{ + NSString *horizontal; + + [self _setupContext]; + horizontal = [moduleSettings objectForKey: @"DragHandleHorizontal"]; + + return ((horizontal && [horizontal intValue] > 0) ? (id)[horizontal stringByAppendingFormat: @"px"] : nil); +} + +- (NSString *) contactsListContentStyle +{ + NSString *height; + + [self _setupContext]; + height = [moduleSettings objectForKey: @"DragHandleVertical"]; + + return ((height && [height intValue] > 0) ? [NSString stringWithFormat: @"%ipx", ([height intValue] - 27)] : nil); +} + - (WOResponse *) saveDragHandleStateAction { WORequest *request;