add Open... panel in the Browser menu

This commit is contained in:
Marco Cawthorne 2022-09-17 15:14:54 -07:00
parent 4b4bf6efc3
commit 73e4ae3ea6
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
4 changed files with 37 additions and 12 deletions

View File

@ -298,14 +298,32 @@ static NSMenuItem *menuItemForItem(id item) {
}
}
-(void) openFileWindow: (id)sender
{
Website *website;
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection: YES];
if ([openPanel runModal] == NSOKButton) {
for (int i = 0; i < [[openPanel URLs] count]; i++) {
Website *website;
NSURL *url = [[openPanel URLs] objectAtIndex: i];
website = [[Website alloc] initWithName: @"" url: [NSString
stringWithFormat: @"file://%@", [url absoluteString]]];
[website autorelease];
[self openWebsite: website];
}
}
}
- (BOOL) application: (NSApplication *)application
openFile: (NSString *)fileName
{
NSArray *args;
NSString *path;
NSTask *task;
[self openDeveloperFileAtPath: fileName];
Website *website;
website = [[Website alloc] initWithName: @"" url: [NSString
stringWithFormat: @"file://%@", fileName]];
[website autorelease];
[self openWebsite: website];
return YES;
}
@ -314,31 +332,36 @@ static NSMenuItem *menuItemForItem(id item) {
userData: (NSString*)ud
error: (NSString**)err
{
NSString *url;
NSString *webURL;
NSArray *types;
NSArray *args;
NSString *path;
NSTask *task;
NSString *pboardString;
Website *website;
*err = nil;
types = [pb types];
if (![types containsObject:NSStringPboardType] || !(pboardString = [pb stringForType:NSStringPboardType]))
if (![types containsObject:NSStringPboardType] ||
!(pboardString = [pb stringForType:NSStringPboardType]))
{
*err = NSLocalizedString(@"Error: Pasteboard doesn't contain a string.",
@"Pasteboard couldn't give string.");
return;
}
url = [pb stringForType: NSStringPboardType];
if (url == nil)
webURL = [pb stringForType: NSStringPboardType];
if (webURL == nil)
{
*err = @"No string value supplied on pasteboard";
return;
}
[self openDeveloperFileAtPath: url];
website = [[Website alloc] initWithName: @"" url: webURL];
[website autorelease];
[self openWebsite: website];
return;
}

View File

@ -664,7 +664,7 @@ static id newTabTarget;
-(void)sharePage: (id)sender
{
NSRunAlertPanel(@"Hey!", @"This feature is coming soon.", @"OK", NULL, NULL);
[[[NSApplication sharedApplication] delegate] showHistoryWindow: sender];
}

View File

@ -7,7 +7,8 @@
"showFindPanel:",
"showHistoryWindow:",
"showBookmarksWindow:",
"showPreferencesWindow:"
"showPreferencesWindow:",
"openFileWindow:"
);
Outlets = (
);
@ -19,6 +20,7 @@
"didTapNewWindow:",
"findNext:",
"findPrevious:",
"openFileWindow:",
"newFolder:",
"newTab:",
"reload:",