(fix) many OCS (non-standard) fixes
parent
ba9960b97a
commit
3d9fe30373
15
Main/SOGo.m
15
Main/SOGo.m
|
@ -172,10 +172,9 @@ static BOOL debugLeaks;
|
||||||
bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"];
|
bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"];
|
||||||
length = [tableType length] - 3;
|
length = [tableType length] - 3;
|
||||||
tableFile = [tableType substringToIndex: length];
|
tableFile = [tableType substringToIndex: length];
|
||||||
descFile
|
descFile = [bundle pathForResource: [NSString stringWithFormat: @"%@-%@",
|
||||||
= [bundle pathForResource: [NSString stringWithFormat: @"%@-%@",
|
tableFile, fileSuffix]
|
||||||
tableFile, fileSuffix]
|
ofType: @"sql"];
|
||||||
ofType: @"sql"];
|
|
||||||
if (!descFile)
|
if (!descFile)
|
||||||
descFile = [bundle pathForResource: tableFile ofType: @"sql"];
|
descFile = [bundle pathForResource: tableFile ofType: @"sql"];
|
||||||
|
|
||||||
|
@ -224,24 +223,22 @@ static BOOL debugLeaks;
|
||||||
withCm: (GCSChannelManager *) cm
|
withCm: (GCSChannelManager *) cm
|
||||||
tableURL: (NSString *) url
|
tableURL: (NSString *) url
|
||||||
{
|
{
|
||||||
|
NSString *tableName, *sql, *driver;
|
||||||
EOAdaptorChannel *channel;
|
EOAdaptorChannel *channel;
|
||||||
NSString *tableName, *sql;
|
|
||||||
GCSFolderType *type;
|
GCSFolderType *type;
|
||||||
NSException *ex;
|
NSException *ex;
|
||||||
|
|
||||||
channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]];
|
channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]];
|
||||||
|
|
||||||
tableName = [NSString stringWithFormat: @"sogo_quick_%@", typeName];
|
tableName = [NSString stringWithFormat: @"sogo_quick_%@", typeName];
|
||||||
|
driver = [url substringToIndex: [url rangeOfString: @":"].location];
|
||||||
sql = [NSString stringWithFormat: @"SELECT count(*) FROM %@",
|
sql = [NSString stringWithFormat: @"SELECT count(*) FROM %@",
|
||||||
tableName];
|
tableName];
|
||||||
if ([channel evaluateExpressionX: sql])
|
if ([channel evaluateExpressionX: sql])
|
||||||
{
|
{
|
||||||
type = [GCSFolderType folderTypeWithName: typeName];
|
type = [GCSFolderType folderTypeWithName: typeName driver: driver];
|
||||||
if (type)
|
if (type)
|
||||||
{
|
{
|
||||||
// We re-acquire the channel in case it was abruptly closed between statements
|
|
||||||
if (![channel isOpen])
|
|
||||||
channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]];
|
|
||||||
sql = [type sqlQuickCreateWithTableName: tableName];
|
sql = [type sqlQuickCreateWithTableName: tableName];
|
||||||
if (!(ex = [channel evaluateExpressionX: sql]))
|
if (!(ex = [channel evaluateExpressionX: sql]))
|
||||||
[self logWithFormat: @"sogo quick table '%@' successfully created!",
|
[self logWithFormat: @"sogo quick table '%@' successfully created!",
|
||||||
|
|
|
@ -190,7 +190,7 @@ static BOOL _singleStoreMode = NO;
|
||||||
return fm;
|
return fm;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *) loadDefaultFolderTypes
|
- (NSDictionary *) loadDefaultFolderTypes: (NSString *) driver
|
||||||
{
|
{
|
||||||
NSMutableDictionary *typeMap;
|
NSMutableDictionary *typeMap;
|
||||||
NSArray *types;
|
NSArray *types;
|
||||||
|
@ -212,7 +212,15 @@ static BOOL _singleStoreMode = NO;
|
||||||
GCSFolderType *typeObject;
|
GCSFolderType *typeObject;
|
||||||
|
|
||||||
type = [[types objectAtIndex:i] stringByDeletingPathExtension];
|
type = [[types objectAtIndex:i] stringByDeletingPathExtension];
|
||||||
typeObject = [GCSFolderType folderTypeWithName: type];
|
|
||||||
|
// We skip type files associated to drivers directly, since
|
||||||
|
// [GCSFolderType folderTypeWithName:driver] will handle the
|
||||||
|
// mojo directly
|
||||||
|
if ([type rangeOfString: [NSString stringWithFormat: @"-%@", driver]].length)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
typeObject = [GCSFolderType folderTypeWithName: type
|
||||||
|
driver: driver];
|
||||||
|
|
||||||
[self debugWithFormat:@" %@: %s",
|
[self debugWithFormat:@" %@: %s",
|
||||||
type, [typeObject isNotNull] ? "OK" : "FAIL"];
|
type, [typeObject isNotNull] ? "OK" : "FAIL"];
|
||||||
|
@ -302,7 +310,7 @@ static BOOL _singleStoreMode = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register default folder types */
|
/* register default folder types */
|
||||||
nameToType = [[self loadDefaultFolderTypes] copy];
|
nameToType = [[self loadDefaultFolderTypes: [_infoUrl scheme]] copy];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id)folderTypeWithName:(NSString *)_type;
|
+ (id)folderTypeWithName:(NSString *)_type;
|
||||||
|
+ (id)folderTypeWithName:(NSString *)_type driver:(NSString *)_driver;
|
||||||
|
|
||||||
- (id)initWithPropertyList:(id)_plist;
|
- (id)initWithPropertyList:(id)_plist;
|
||||||
- (id)initWithContentsOfFile:(NSString *)_path;
|
- (id)initWithContentsOfFile:(NSString *)_path;
|
||||||
|
|
|
@ -38,14 +38,26 @@
|
||||||
|
|
||||||
@implementation GCSFolderType
|
@implementation GCSFolderType
|
||||||
|
|
||||||
+ (id) folderTypeWithName: (NSString *) _typeName
|
+ (id)folderTypeWithName:(NSString *)_typeName driver:(NSString *)_driver
|
||||||
{
|
{
|
||||||
NSString *filename, *path;
|
NSString *filename, *path;
|
||||||
GCSFolderType *folderType;
|
GCSFolderType *folderType;
|
||||||
|
|
||||||
|
filename = nil;
|
||||||
|
|
||||||
// TODO: fix me, GCS instead of OCS
|
// TODO: fix me, GCS instead of OCS
|
||||||
filename = [_typeName stringByAppendingPathExtension:@"ocs"];
|
if (_driver)
|
||||||
path = [[self resourceLocator] lookupFileWithName: filename];
|
{
|
||||||
|
filename = [NSString stringWithFormat: @"%@-%@.ocs", _typeName, _driver];
|
||||||
|
if (!(path = [[self resourceLocator] lookupFileWithName: filename]))
|
||||||
|
filename = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filename)
|
||||||
|
{
|
||||||
|
filename = [_typeName stringByAppendingPathExtension:@"ocs"];
|
||||||
|
path = [[self resourceLocator] lookupFileWithName: filename];
|
||||||
|
}
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
|
@ -62,6 +74,12 @@
|
||||||
return folderType;
|
return folderType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (id) folderTypeWithName: (NSString *) _typeName
|
||||||
|
{
|
||||||
|
return [self folderTypeWithName: _typeName driver: nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithPropertyList: (id) _plist
|
- (id) initWithPropertyList: (id) _plist
|
||||||
{
|
{
|
||||||
NSDictionary *plist = _plist;
|
NSDictionary *plist = _plist;
|
||||||
|
|
Loading…
Reference in New Issue