Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Download Delegate and Print Button



Rush,

I tried this but unfortunately it doesn't seem to be getting called. As
I said, my custom-rolled event loop is a little odd and I think it's
swallowing events somewhere. Here's what I'm seeing:

1.) I click on my download link.
2.) I get several calls to decidePolicyForNavigationAction:
4.) I get a call to decidePolicyForMIMEType:
5.) If webview can't display it, I tell it to ignore it and handle the
download manually.
5.) My WebView freezes. I no longer get any events. I can close the
window and move it around and that works fine...so it would seem my
event loop is still processing events. Is WebKit doing something strange
with the view when a download is encountered? Where should I be
intercepting the download so I can handle it myself?

Thanks for your help!

Josh

-----Original Message-----
From: Rush Manbert [mailto:email@hidden] 
Sent: Friday, December 09, 2005 12:11 PM
To: Josh Ferguson
Cc: email@hidden
Subject: Re: Download Delegate and Print Button

Josh Ferguson wrote:
> I have a WebView window that I need complete control over and I'm
having 
> difficulty figuring out delegate methods to handle two situations. 
> First, I need to intercept clicks for downloading files so that I can 
> display my own File Open dialog. Essentially what's happening right
now 
> is that I've rolled my own event loop in order to make my webview
window 
> modal. When I need to display another window, I simply add that window

> to my list of windows that can receive events (i.e. with links that
open 
> new windows). This must be causing the WebView to swallow the events 
> that cause it to open the File Open dialog for downloads, as I get a 
> Frame Load error when the download link is clicked. I have a feeling 
> I'll need to create this dialog manually but I can't find a place to 
> intercept this request. Any recommendations would be greatly
appreciated!
> 
Hi Josh,

I don't know about the second one, but I have dealt with file selection 
from within my WebView. You need to implement the WebUIDelegate method
- (void)webView:(WebView *)sender 
runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListen
er>)resultListener


Here's mine, for what it's worth:
- (void)webView:(WebView *)sender 
runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListen
er>)resultListener
{
   NSOpenPanel *panel = [NSOpenPanel openPanel];
   int i = [panel runModalForDirectory:NSHomeDirectory()
                                  file:nil
                                 types:nil];
	
   if (i == NSOKButton)
   {
     [resultListener chooseFilename:[[panel filenames]
objectAtIndex:0]];
   }
}

Remember to register as the delegate by sending
[myWebView setUIDelegate:self]
in your window controller.

- Rush
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.