Hi,

That sounds good and works also on my setup. But what if the resource 
changes? We have the button for saving a file that is generated on the 
fly and the user might download multiple versions of that file. Doesn't 
the WResource change it's url when setChanged function is called? I 
guess this is an issue.

The setResource member function would sound a good solution if that 
resource change issue can be resolved.
I think that you could create some intermediate JavaScript function that 
calls these functions defined by the connect and then you could clear 
(all) of the connected JavaScript functions. Or even better if that 
would also return some kind of connection object that can be used for 
disconnecting the JavaScript function.


To get the issue visible check your IE settings: Tools -> Internet 
Options -> Security tab -> Custom level...
And in the Downloads section the  "Automatic prompting for file 
downloads" should be disabled. With these settings (the default) I'm 
getting issues with the JSlot solution.
With window.open I get the IE to open the new window and it prompts for 
the file download and immediately closes the window. If I put 
window.location=url then the prompt opens and when I accept the download 
IE reloads the page causing the Wt's session to restart (I know that 
this can be changed from the Wt's configuration but we'd like to keep 
that setting as it is). So with either solution I can not download the 
file with IE.
And our client is getting the same behaviour with IE as I am.

BR,
Janne

On 26.10.2010 17:01, Koen Deforche wrote:
> Hey Janne,
>
> 2010/10/26 Janne Rönkkö<[email protected]>:
>> Hi,
>>
>> Any thoughts on this issue?
>> Could this kind of button be included into Wt?
> I think we need somehow make sure that you can do what you want to do
> without duplicating WPushButton. It's a common scenario since we also
> hit the very same problem in one of our projects.
>
> I just tried now to implement my suggestion, i.e. using a JSlot (or
> even better, with latest git, by connecting directly a JavaScript
> function):
>
>    Wt::WPushButton* btn = new Wt::WPushButton( "Download" );
>    root()->addWidget( btn );
>    btn->clicked().connect("function() { window.location='" + res->url()
> + "'; }");
>
> In this way, unless I am missing something, I get the same behaviour
> as with your anchor button implementation ?
>
> If this is functionally correct, then perhaps we should add a method
> WPushButton::setResource() which does something along these lines ?
>
> Regards,
> koen
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps&  games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to