Merge branch 'desktop' into jake

Conflicts:
	AppKit/CPSavePanel.j
This commit is contained in:
Francisco Ryan Tolmasky I committed 2009-10-17 10:07:10 -07:00
commit 810f82cc60
3 files changed
+25 -73

No files matched your search

+6 -6
View File
@@ -223,15 +223,15 @@ var CPSharedDocumentController = nil;
-(void)openDocument:(id)aSender
{
var openPanel = [CPOpenPanel openPanel];
[openPanel runModalForTypes:nil];//[@"nib", @"xib", @"cib"]];
var filenames = [openPanel filenames],
[openPanel runModal];
var URLs = [openPanel URLs],
index = 0,
count = [filenames count];
count = [URLs count];
for (; index < count; ++index)
[self openDocumentWithContentsOfURL:[CPURL URLWithString:filenames[index]] display:YES error:nil];
[self openDocumentWithContentsOfURL:[CPURL URLWithString:URLs[index]] display:YES error:nil];
}
// Managing Documents
+18 -61
View File
@@ -5,7 +5,11 @@
@implementation CPOpenPanel : CPPanel
{
JSObject _openPanel;
BOOL _canChooseFiles @accessors(property=canChooseFiles);
BOOL _canChooseDirectories @accessors(property=canChooseDirectories);
BOOL _allowsMultipleSelection @accessors(property=allowsMultipleSelection);
CPURL _directoryURL @accessors(property=directoryURL);
CPArray _URLs;
}
+ (id)openPanel
@@ -13,73 +17,26 @@
return [[CPOpenPanel alloc] init];
}
- (id)init
{
if (self = [super init])
_openPanel = window.application.createOpenPanel();
return self;
}
- (BOOL)canChooseFiles
{
return _openPanel.canChooseFiles;
}
- (void)setCanChooseFiles:(BOOL)shouldChooseFiles
{
_openPanel.canChooseFiles = shouldChooseFiles;
}
- (BOOL)canChooseDirectories
{
return _openPanel.canChooseDirectories;
}
- (void)setCanChooseDirectories:(BOOL)shouldChooseDirectories
{
_openPanel.canChooseDirectories = shouldChooseDirectories;
}
- (BOOL)resolvesAliases
{
return _openPanel.resolvesAliases;
}
- (BOOL)setResolvesAliases:(BOOL)shouldResolveAliases
{
return _openPanel.resolvesAliases = shouldResolveAliases;
}
- (BOOL)allowsMultipleSelections
{
return _openPanel.resolvesAliases;
}
- (BOOL)setAllowsMultipleSelections:(BOOL)shouldAllowMultipleSelection
{
return _openPanel.allowsMultipleSelection = shouldAllowMultipleSelection;
}
- (void)filenames
{
return _openPanel.filenames;
}
- (CPInteger)runModalForDirectory:(CPString)anAbsoluteDirectoryPath file:(CPString)aFilename types:(CPArray)fileTypes
- (CPInteger)runModal
{
// FIXME: Is this correct???
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
return _openPanel.runModal(anAbsoluteDirectoryPath, aFilename, fileTypes);
var options = { directoryURL: [self directoryURL],
canChooseFiles: [self canChooseFiles],
canChooseDirectories: [self canChooseDirectories],
allowsMultipleSelection: [self allowsMultipleSelection] };
var result = window.cpOpenPanel(options);
_URLs = result.URLs;
return result.button;
}
- (CPInteger)runModalForTypes:(CPArray)fileTypes
- (CPArray)URLs
{
// FIXME: Is this correct???
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
return _openPanel.runModal(fileTypes);
return _URLs;
}
@end
+1 -6
View File
@@ -13,16 +13,11 @@
}
- (CPInteger)runModal
{
return [self runModalForDirectory:nil];
}
- (CPInteger)runModalForDirectory:(CPString)anAbsoluteDirectoryPath
{
// FIXME: Is this correct???
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var result = window.cpSavePanel(anAbsoluteDirectoryPath);
result = window.cpSavePanel();
return result.button;
}