Monotone-Parent: 2ae53e4d24cdb745c3a8c8e246d99d096538c2e3

Monotone-Revision: 72200746a9f7ee37d797519783476d88536f267d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-12-17T14:33:14
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-12-17 14:33:14 +00:00
parent 40360f9dc0
commit 8327699982
3 changed files with 24 additions and 5 deletions

View File

@@ -1,5 +1,10 @@
2008-12-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder
-lookupName:nameinContext:lookupContextacquire:acquire]): we avoid
getting subscribed sources if not needed, which reduces the amount
of requests to the database.
* UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor
-dealloc]): we release componentCalendar here to avoid a leak
(since if set, it was through a call to ASSIGN()).

View File

@@ -34,6 +34,7 @@
NSMutableDictionary *subFolders;
NSString *OCSPath;
Class subFolderClass;
BOOL hasSubscribedSources;
}
+ (NSString *) gcsFolderType;

View File

@@ -107,6 +107,7 @@ static SoSecurityManager *sm = nil;
subFolders = nil;
OCSPath = nil;
subFolderClass = Nil;
hasSubscribedSources = NO;
}
return self;
@@ -317,19 +318,24 @@ static SoSecurityManager *sm = nil;
- (void) initSubFolders
{
NSString *login;
if (!subFolders)
{
subFolders = [NSMutableDictionary new];
[self appendPersonalSources];
[self appendSystemSources];
login = [[context activeUser] login];
if ([login isEqualToString: owner])
[self appendSubscribedSources];
}
}
- (void) _appendSubscribedSourcesIfNeeded
{
NSString *login;
login = [[context activeUser] login];
if ([login isEqualToString: owner])
[self appendSubscribedSources];
hasSubscribedSources = YES;
}
- (id) lookupName: (NSString *) name
inContext: (WOContext *) lookupContext
acquire: (BOOL) acquire
@@ -344,6 +350,11 @@ static SoSecurityManager *sm = nil;
[self initSubFolders];
obj = [subFolders objectForKey: name];
if (!obj && !hasSubscribedSources)
{
[self _appendSubscribedSourcesIfNeeded];
obj = [subFolders objectForKey: name];
}
}
return obj;
@@ -353,6 +364,8 @@ static SoSecurityManager *sm = nil;
{
if (!subFolders)
[self initSubFolders];
if (!!hasSubscribedSources)
[self _appendSubscribedSourcesIfNeeded];
return [[subFolders allValues]
sortedArrayUsingSelector: @selector (compare:)];