* Source/GSXibLoader.m: Handle changed keys for XIB 4.6 format.

Based on patch by Marcian Lytwyn <marcian.lytwyn@advcsi.com>.
* Source/GSXibLoader.m (-parser:...): Warn about unsupported XIB 5 format.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37463 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2013-12-13 20:34:52 +00:00
parent 9600bd7614
commit 52d1488ad6
2 changed files with 39 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2013-12-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXibLoader.m: Handle changed keys for XIB 4.6 format.
Based on patch by Marcian Lytwyn <marcian.lytwyn@advcsi.com>.
* Source/GSXibLoader.m (-parser:...): Warn about unsupported XIB 5 format.
2013-12-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTableView.m (-numberOfRows): Return the current number

View file

@ -405,6 +405,13 @@
{
connectionID = [coder decodeIntForKey: @"connectionID"];
}
else if ([coder containsValueForKey: @"id"])
{
// 4.6+ XIBs....
NSString *string = [coder decodeObjectForKey: @"id"];
connectionID = [string intValue];
}
}
else
{
@ -530,6 +537,13 @@
{
objectID = [coder decodeIntForKey: @"objectID"];
}
else if ([coder containsValueForKey: @"id"])
{
// 4.6+ XIBs....
NSString *string = [coder decodeObjectForKey: @"id"];
objectID = [string intValue];
}
if ([coder containsValueForKey: @"object"])
{
ASSIGN(object, [coder decodeObjectForKey: @"object"]);
@ -1122,14 +1136,24 @@
while ((key = [en nextObject]) != nil)
{
NSString *keyValue = [key stringByReplacingOccurrencesOfString:@".CustomClassName" withString:@""];
NSString *className = [customClassDict objectForKey:key];
NSString *className = [customClassDict objectForKey: key];
NSString *objectRecordXpath = nil;
objectRecordXpath = [NSString stringWithFormat:@"//object[@class=\"IBObjectRecord\"]/"
objectRecordXpath = [NSString stringWithFormat: @"//object[@class=\"IBObjectRecord\"]/"
@"int[@key=\"objectID\"][text()=\"%@\"]/../reference",
keyValue];
objectRecords = [document nodesForXPath:objectRecordXpath error:NULL];
objectRecords = [document nodesForXPath: objectRecordXpath error: NULL];
if (objectRecords == nil)
{
// If that didn't work then it could be a 4.6+ XIB...
objectRecordXpath = [NSString stringWithFormat: @"//object[@class=\"IBObjectRecord\"]/"
@"string[@key=\"id\"][text()=\"%@\"]/../reference",
keyValue];
objectRecords = [document nodesForXPath: objectRecordXpath error: NULL];
}
NSString *refId = nil;
if ([objectRecords count] > 0)
{
@ -1257,6 +1281,12 @@ didStartElement: (NSString*)elementName
// FIXME: We should use proper memory management here
AUTORELEASE(element);
if ([@"document" isEqualToString: elementName])
{
[NSException raise: NSInvalidArgumentException
format: @"Cannot decode XIB 5 format."];
}
if (key != nil)
{
[currentElement setElement: element forKey: key];