From 7319adaeaf76558ca01bbb74d50674c12c7da87e Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 21 Feb 2007 21:11:40 +0000 Subject: [PATCH] Monotone-Parent: dcf442c860232fa8f419eeb330aab1bebfdb596c Monotone-Revision: 29bd9d1c5051eac140806ad6a68c2587e599f1c8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-02-21T21:11:40 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoFolder.h | 2 ++ SoObjects/SOGo/SOGoFolder.m | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index 50c9f8e42..e768cd22d 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -55,6 +55,8 @@ - (GCSFolder *)ocsFolder; /* lower level fetches */ +- (BOOL) nameExistsInFolder: (NSString *) objectName; + - (NSArray *)fetchContentObjectNames; - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects; diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 27eabccae..d7fe67b6f 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -142,6 +142,23 @@ return [records valueForKey:@"c_name"]; } +- (BOOL) nameExistsInFolder: (NSString *) objectName +{ + NSArray *fields, *records; + EOQualifier *qualifier; + + qualifier + = [EOQualifier qualifierWithQualifierFormat: + [NSString stringWithFormat: @"c_name='%@'", objectName]]; + + fields = [NSArray arrayWithObject: @"c_name"]; + records = [[self ocsFolder] fetchFields: fields + matchingQualifier: qualifier]; + return (records + && ![records isKindOfClass:[NSException class]] + && [records count] > 0); +} + - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects { NSDictionary *files;