http://wiki.webos-internals.org/api.php?action=feedcontributions&user=Fritos1406&feedformat=atomWebOS Internals - User contributions [en]2024-03-29T13:26:02ZUser contributionsMediaWiki 1.35.1http://wiki.webos-internals.org/index.php?title=Application:Precorder&diff=7930Application:Precorder2010-01-01T16:54:29Z<p>Fritos1406: </p>
<hr />
<div>{{application<br />
|name=Precorder<br />
|type=webOS<br />
|version=Version: Alpha 0.3.5 <br />(30 Dec 2009)<br />
|tag=Utilities<br />
|screenshot=Precorder_2009-01-12_141733.png<br />
|description=<br />
<br />
== Summary == <br />
<br />
Precorder has been developed to bridge the gap between the current revision of WebOS and a future release that will enable video recording. It is capable of recording in multiple combinations of audio and video and includes support for using the built-in LED for lumination while recording in dark areas. Video recorded with Precorder is viewable through Palms built in video application.<br />
<br />
== Status ==<br />
<br />
Precorder is ALPHA SOFTWARE developed primarily by ZSoc of WebOS Internals with assistance from a number of other developers (as listed in the Maintainers field in the package metadata).<br />
<br />
It does not have a viewfinder, cause we technically do not know how to do that (yet?).<br />
<br />
== Recent Changes ==<br />
<br />
Even though Precorder in alpha state is not available for download in Preware (it will be when it goes into beta), once you install Precorder it appears in the Installed Packages section and you can see the package changelogs there.<br />
<br />
== Donations ==<br />
<br />
Please see the official PreCentral thread first post at http://forums.precentral.net/2059462-post1.html for the donation link. Since this is a wiki that anyone can edit, we do not put the donation link here.<br />
<br />
==Installation==<br />
<br />
Note that you cannot install the packages using any other method than the methods below. Specifically, fileCoaster is not able to install these packages.<br />
<br />
=== Preware ===<br />
<br />
Precorder will be added to Preware once it reaches beta status. Until then, please use the Precorder bootstrap script.<br />
<br />
=== Bootstrap Script ===<br />
<br />
The easiest (and guaranteed to always be up to date) method of installing the latest packages via the precorder bootstrap script.<br />
<br />
Just run the following commands on your Pre. You can get a command line either via the Terminal application in Preware, or by an SSH connection, or by using the Linux commandline window in WebOS Quick Install. The precorder bootstrap can also be re-run at any time to safely update Precorder to the latest alpha testing version.<br />
<br />
<br><br />
mount -o remount,rw /<br><br />
rm -f precorder-bootstrap<br />
<br><br />
wget http://bit.ly/precorder-bootstrap<br />
<br><br />
sh precorder-bootstrap<br />
<br />
=== WebOS Quick Install ===<br />
<br />
If you can't use the precorder bootstrap script for some reason, you can also use the following links to download the individual packages and install them with WebOS Quick Install. Note that these links will quickly get out of date, so please use the precorder bootstrap to always get the latest alpha testing version.<br />
<br />
Note that to be able to use WebOS Quick Install to install Precorder, you must first have installed Preware on your device. See http://install.preware.org for instructions on how to do that. When Precorder reaches beta status, you will be able to install, update and remove the packages directly in Preware.<br />
<br />
You can install the GstService ([http://ipkg.preware.org/feeds/webos-internals/testing/armv7/org.webosinternals.gstservice_0.3.5_armv7.ipk Pre] or [http://ipkg.preware.org/feeds/webos-internals/testing/armv6/org.webosinternals.gstservice_0.3.5_armv6.ipk Pixi]) and [http://ipkg.preware.org/feeds/webos-internals/testing/all/org.webosinternals.precorder_0.3.5_all.ipk Precorder] ipkg files with [http://www.webos-internals.org/wiki/Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method WebOS Quick Install]. (Note that these links may be out of date if we forget to update them every time we release a new version)<br />
<br />
# Save the gstservice and and Precorder ipk's to your local computer.<br />
# Install [[Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method|WebOS Quick Install]]<br />
# Drag the gstservice IPK into the center of the WebOS Quick install window.<br />
# Click the Install button.<br />
# Drag the Precorder application ipk into the center of the WebOS Quick Install window.<br />
# Click the install button.<br />
<br />
== License ==<br />
<br />
The GStreamer Service package is MIT Open Source licensed. The Precorder application is GPLv2 Open Source licensed.<br />
<br />
== Operating notes ==<br />
<br />
When precorder is first launched you will see the main screen. Only one button is currently functional. Tapping the 'Record Now' button will begin recording video to the /media/internal location on the pre making these videos available to be copied via USB. They will be located in the root of the USB drive when connected to your computer.<br />
=== Viewfinder ===<br />
Note that you are not able to see the video as it is recording. There is no viewfinder. It is currently technically infeasible to create a viewfinder (but maybe someone will work out how to do it). (For a description of why it is technically infeasible, and to make suggestions, ask questions, please see [http://www.webos-internals.org/wiki/Application_talk:Precorder#Viewfinder_discussion this section in the discussion page].) <br />
=== Controls === <br />
When you tap the 'Record Now' button the screen will change to notify you that Precorder is currently capturing audio and video. There is a 'Stop recording' button located on the screen. Tapping this button stops the audio/video capture and returns you to the main view.<br />
=== Customization ===<br />
There are several features of Precorder that can be customized. All of these settings are available via the preferences option within the Precorder menu. The table below lists all possible preferences. Options in bold represent defaults.<br />
<br />
<Table><TR><TD><br />
{{{!}} border="1" cellpadding="4"<br />
{{!}}Option<br />
{{!}}Description<br />
{{!}}Possible Selections<br />
{{!}}-<br />
{{!}}Audio Format<br />
{{!}}Select what format you would like the audio stream to be saved in.<br />
{{!}}'''AAC''', AMRNB, MP3<br />
{{!}}-<br />
{{!}}Video Format<br />
{{!}}Select what format you would like the video stream to be saved in.<br />
{{!}}Mpeg-4, H.263, '''H.264/AVC'''<br />
{{!}}-<br />
{{!}}Container<br />
{{!}}Select what multimedia container the audio/video streams will be in.<br />
{{!}}'''mp4''', 3gp<br />
{{!}}-<br />
{{!}}Media Source<br />
{{!}}What would you like Precorder to capture?<br />
{{!}}Audio only, Video only, '''Both'''<br />
{{!}}-<br />
{{!}}Flash<br />
{{!}}Would you like to use the built in LED for illumination?<br />
{{!}}'''Off''', Low, Medium, High<br />
{{!}}}<br />
</TD></TR></Table><br />
<br />
=== Recent enhancements ===<br />
<br />
'''0.3.5'''<br />
*Fixed the gst-launch path for webOS 1.3.5<br />
<br />
'''0.3.3'''<br />
*Video player launch button now changes to "Play Last Recorded" after recording a video<br />
*Killswitch on card close should avoid most crashing issues<br />
*Minor bug fixes<br />
<br />
<br />
'''0.3.0'''<br />
*LED brightness now selectable<br />
*Launch button added to launch video player<br />
*Videos now are saved in /media/internal/video<br />
<br />
<br />
'''0.2.3'''<br />
*fixed css bug (correctly pushing the record button to the bottom of the screen)<br />
*added icon for launcher<br />
<br />
=== Known bugs ===<br />
<br />
Precorder is currently in Alpha stages and as such is in a constant state of flux with new features being added and old functionality being modified. Please use this software at your own risk. Due to the alpha nature of the software, please check the discussion page for a more accurate list of bugs and/or feature requests.<br />
<br />
*First run on any phone will cause a blank output.<br />
**Simply start recording, wait a moment, and stop recording, wait a moment. After that, it should be fine.<br />
<br />
*Getting the video light to work may cause 2 starts. Should be a 1-time-only process.<br />
*2 minute limitation of recording. Once the video hits 2 minutes, the video data is lost and outputs a blank file.<br />
<br />
== Source Code ==<br />
<br />
Source at git.webos-internals.org<br />
<br />
Packages in the webos-internals testing feed<br />
<br />
== Screenshots ==<br />
<br />
[[Image:Precorder 2009-01-12 141733.png|alt=Precorder Main View|This is the initial view upon launching Precorder]]<br />
[[Image:Precorder 2009-01-12 141738.png|alt=Precorder Recording View|This is the display during audio/video capture]]<br />
[[Image:Precorder_2009-01-12_141805.png|alt=Precorder Preferences View|This is the preferences selection screen]]<br />
[[Image:Precorder_2009-01-12_141742.png|alt=Precorder Finished Recording View|Button at top now allow opening the recorded file directly]]<br />
[[Image:Launcher_2009-24-11_164206.png|alt=Palm OEM video app|All videos are viewable on the device via the Palm OEM video application]]<br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Application:Precorder&diff=7929Application:Precorder2010-01-01T16:52:36Z<p>Fritos1406: </p>
<hr />
<div>{{application<br />
|name=Precorder<br />
|type=webOS<br />
|version=Version: Alpha 0.3.5 <br />(30 Dec 2009)<br />
|tag=Utilities<br />
|screenshot=Precorder_2009-01-12_141733.png<br />
|description=<br />
<br />
== Summary == <br />
<br />
Precorder has been developed to bridge the gap between the current revision of WebOS and a future release that will enable video recording. It is capable of recording in multiple combinations of audio and video and includes support for using the built-in LED for lumination while recording in dark areas. Video recorded with Precorder is viewable through Palms built in video application.<br />
<br />
== Status ==<br />
<br />
Precorder is ALPHA SOFTWARE developed primarily by ZSoc of WebOS Internals with assistance from a number of other developers (as listed in the Maintainers field in the package metadata).<br />
<br />
It does not have a viewfinder, cause we technically do not know how to do that (yet?).<br />
<br />
== Recent Changes ==<br />
<br />
Even though Precorder in alpha state is not available for download in Preware (it will be when it goes into beta), once you install Precorder it appears in the Installed Packages section and you can see the package changelogs there.<br />
<br />
== Donations ==<br />
<br />
Please see the official PreCentral thread first post at http://forums.precentral.net/2059462-post1.html for the donation link. Since this is a wiki that anyone can edit, we do not put the donation link here.<br />
<br />
==Installation==<br />
<br />
Note that you cannot install the packages using any other method than the methods below. Specifically, fileCoaster is not able to install these packages.<br />
<br />
=== Preware ===<br />
<br />
Precorder will be added to Preware once it reaches beta status. Until then, please use the Precorder bootstrap script.<br />
<br />
=== Bootstrap Script ===<br />
<br />
The easiest (and guaranteed to always be up to date) method of installing the latest packages via the precorder bootstrap script.<br />
<br />
Just run the following commands on your Pre. You can get a command line either via the Terminal application in Preware, or by an SSH connection, or by using the Linux commandline window in WebOS Quick Install. The precorder bootstrap can also be re-run at any time to safely update Precorder to the latest alpha testing version.<br />
<br />
<br><br />
mount -o remount,rw /<br><br />
rm -f precorder-bootstrap<br />
<br><br />
wget http://bit.ly/precorder-bootstrap<br />
<br><br />
sh precorder-bootstrap<br />
<br />
=== WebOS Quick Install ===<br />
<br />
If you can't use the precorder bootstrap script for some reason, you can also use the following links to download the individual packages and install them with WebOS Quick Install. Note that these links will quickly get out of date, so please use the precorder bootstrap to always get the latest alpha testing version.<br />
<br />
Note that to be able to use WebOS Quick Install to install Precorder, you must first have installed Preware on your device. See http://install.preware.org for instructions on how to do that. When Precorder reaches beta status, you will be able to install, update and remove the packages directly in Preware.<br />
<br />
You can install the GstService ([http://ipkg.preware.org/feeds/webos-internals/testing/armv7/org.webosinternals.gstservice_0.3.5_armv7.ipk Pre] or [http://ipkg.preware.org/feeds/webos-internals/testing/armv6/org.webosinternals.gstservice_0.3.0_armv6.ipk Pixi]) and [http://ipkg.preware.org/feeds/webos-internals/testing/all/org.webosinternals.precorder_0.3.3_all.ipk Precorder] ipkg files with [http://www.webos-internals.org/wiki/Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method WebOS Quick Install]. (Note that these links may be out of date if we forget to update them every time we release a new version)<br />
<br />
# Save the gstservice and and Precorder ipk's to your local computer.<br />
# Install [[Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method|WebOS Quick Install]]<br />
# Drag the gstservice IPK into the center of the WebOS Quick install window.<br />
# Click the Install button.<br />
# Drag the Precorder application ipk into the center of the WebOS Quick Install window.<br />
# Click the install button.<br />
<br />
== License ==<br />
<br />
The GStreamer Service package is MIT Open Source licensed. The Precorder application is GPLv2 Open Source licensed.<br />
<br />
== Operating notes ==<br />
<br />
When precorder is first launched you will see the main screen. Only one button is currently functional. Tapping the 'Record Now' button will begin recording video to the /media/internal location on the pre making these videos available to be copied via USB. They will be located in the root of the USB drive when connected to your computer.<br />
=== Viewfinder ===<br />
Note that you are not able to see the video as it is recording. There is no viewfinder. It is currently technically infeasible to create a viewfinder (but maybe someone will work out how to do it). (For a description of why it is technically infeasible, and to make suggestions, ask questions, please see [http://www.webos-internals.org/wiki/Application_talk:Precorder#Viewfinder_discussion this section in the discussion page].) <br />
=== Controls === <br />
When you tap the 'Record Now' button the screen will change to notify you that Precorder is currently capturing audio and video. There is a 'Stop recording' button located on the screen. Tapping this button stops the audio/video capture and returns you to the main view.<br />
=== Customization ===<br />
There are several features of Precorder that can be customized. All of these settings are available via the preferences option within the Precorder menu. The table below lists all possible preferences. Options in bold represent defaults.<br />
<br />
<Table><TR><TD><br />
{{{!}} border="1" cellpadding="4"<br />
{{!}}Option<br />
{{!}}Description<br />
{{!}}Possible Selections<br />
{{!}}-<br />
{{!}}Audio Format<br />
{{!}}Select what format you would like the audio stream to be saved in.<br />
{{!}}'''AAC''', AMRNB, MP3<br />
{{!}}-<br />
{{!}}Video Format<br />
{{!}}Select what format you would like the video stream to be saved in.<br />
{{!}}Mpeg-4, H.263, '''H.264/AVC'''<br />
{{!}}-<br />
{{!}}Container<br />
{{!}}Select what multimedia container the audio/video streams will be in.<br />
{{!}}'''mp4''', 3gp<br />
{{!}}-<br />
{{!}}Media Source<br />
{{!}}What would you like Precorder to capture?<br />
{{!}}Audio only, Video only, '''Both'''<br />
{{!}}-<br />
{{!}}Flash<br />
{{!}}Would you like to use the built in LED for illumination?<br />
{{!}}'''Off''', Low, Medium, High<br />
{{!}}}<br />
</TD></TR></Table><br />
<br />
=== Recent enhancements ===<br />
<br />
'''0.3.5'''<br />
*Fixed the gst-launch path for webOS 1.3.5<br />
<br />
'''0.3.3'''<br />
*Video player launch button now changes to "Play Last Recorded" after recording a video<br />
*Killswitch on card close should avoid most crashing issues<br />
*Minor bug fixes<br />
<br />
<br />
'''0.3.0'''<br />
*LED brightness now selectable<br />
*Launch button added to launch video player<br />
*Videos now are saved in /media/internal/video<br />
<br />
<br />
'''0.2.3'''<br />
*fixed css bug (correctly pushing the record button to the bottom of the screen)<br />
*added icon for launcher<br />
<br />
=== Known bugs ===<br />
<br />
Precorder is currently in Alpha stages and as such is in a constant state of flux with new features being added and old functionality being modified. Please use this software at your own risk. Due to the alpha nature of the software, please check the discussion page for a more accurate list of bugs and/or feature requests.<br />
<br />
*First run on any phone will cause a blank output.<br />
**Simply start recording, wait a moment, and stop recording, wait a moment. After that, it should be fine.<br />
<br />
*Getting the video light to work may cause 2 starts. Should be a 1-time-only process.<br />
*2 minute limitation of recording. Once the video hits 2 minutes, the video data is lost and outputs a blank file.<br />
<br />
== Source Code ==<br />
<br />
Source at git.webos-internals.org<br />
<br />
Packages in the webos-internals testing feed<br />
<br />
== Screenshots ==<br />
<br />
[[Image:Precorder 2009-01-12 141733.png|alt=Precorder Main View|This is the initial view upon launching Precorder]]<br />
[[Image:Precorder 2009-01-12 141738.png|alt=Precorder Recording View|This is the display during audio/video capture]]<br />
[[Image:Precorder_2009-01-12_141805.png|alt=Precorder Preferences View|This is the preferences selection screen]]<br />
[[Image:Precorder_2009-01-12_141742.png|alt=Precorder Finished Recording View|Button at top now allow opening the recorded file directly]]<br />
[[Image:Launcher_2009-24-11_164206.png|alt=Palm OEM video app|All videos are viewable on the device via the Palm OEM video application]]<br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Application:Precorder&diff=7817Application:Precorder2009-12-20T11:42:20Z<p>Fritos1406: </p>
<hr />
<div>{{application<br />
|name=Precorder<br />
|type=webOS<br />
|version=Version: Alpha 0.3.3 <br />(26 Nov 2009)<br />
|tag=Utilities<br />
|screenshot=Precorder_2009-01-12_141733.png<br />
|description=<br />
<br />
== Summary == <br />
<br />
Precorder has been developed to bridge the gap between the current revision of WebOS and a future release that will enable video recording. It is capable of recording in multiple combinations of audio and video and includes support for using the built-in LED for lumination while recording in dark areas. Video recorded with Precorder is viewable through Palms built in video application.<br />
<br />
== Status ==<br />
<br />
Precorder is ALPHA SOFTWARE developed primarily by ZSoc of WebOS Internals with assistance from a number of other developers (as listed in the Maintainers field in the package metadata).<br />
<br />
It does not have a viewfinder, cause we technically do not know how to do that (yet?).<br />
<br />
== Recent Changes ==<br />
<br />
Even though Precorder in alpha state is not available for download in Preware (it will be when it goes into beta), once you install Precorder it appears in the Installed Packages section and you can see the package changelogs there.<br />
<br />
== Donations ==<br />
<br />
Please see the official PreCentral thread first post at http://forums.precentral.net/2059462-post1.html for the donation link. Since this is a wiki that anyone can edit, we do not put the donation link here.<br />
<br />
==Installation==<br />
<br />
Note that you cannot install the packages using any other method than the methods below. Specifically, fileCoaster is not able to install these packages.<br />
<br />
=== Preware ===<br />
<br />
Precorder will be added to Preware once it reaches beta status. Until then, please use the Precorder bootstrap script.<br />
<br />
=== Bootstrap Script ===<br />
<br />
The easiest (and guaranteed to always be up to date) method of installing the latest packages via the precorder bootstrap script.<br />
<br />
Just run the following commands on your Pre. You can get a command line either via the Terminal application in Preware, or by an SSH connection, or by using the Linux commandline window in WebOS Quick Install. The precorder bootstrap can also be re-run at any time to safely update Precorder to the latest alpha testing version.<br />
<br />
<br><br />
mount -o remount,rw /<br><br />
rm -f precorder-bootstrap<br />
<br><br />
wget http://bit.ly/precorder-bootstrap<br />
<br><br />
sh precorder-bootstrap<br />
<br />
=== WebOS Quick Install ===<br />
<br />
If you can't use the precorder bootstrap script for some reason, you can also use the following links to download the individual packages and install them with WebOS Quick Install. Note that these links will quickly get out of date, so please use the precorder bootstrap to always get the latest alpha testing version.<br />
<br />
Note that to be able to use WebOS Quick Install to install Precorder, you must first have installed Preware on your device. See http://install.preware.org for instructions on how to do that. When Precorder reaches beta status, you will be able to install, update and remove the packages directly in Preware.<br />
<br />
You can install the GstService ([http://ipkg.preware.org/feeds/webos-internals/testing/armv7/org.webosinternals.gstservice_0.3.3_armv7.ipk Pre] or [http://ipkg.preware.org/feeds/webos-internals/testing/armv6/org.webosinternals.gstservice_0.3.0_armv6.ipk Pixi]) and [http://ipkg.preware.org/feeds/webos-internals/testing/all/org.webosinternals.precorder_0.3.3_all.ipk Precorder] ipkg files with [http://www.webos-internals.org/wiki/Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method WebOS Quick Install]. (Note that these links may be out of date if we forget to update them every time we release a new version)<br />
<br />
# Save the gstservice and and Precorder ipk's to your local computer.<br />
# Install [[Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method|WebOS Quick Install]]<br />
# Drag the gstservice IPK into the center of the WebOS Quick install window.<br />
# Click the Install button.<br />
# Drag the Precorder application ipk into the center of the WebOS Quick Install window.<br />
# Click the install button.<br />
<br />
== License ==<br />
<br />
The GStreamer Service package is MIT Open Source licensed. The Precorder application is GPLv2 Open Source licensed.<br />
<br />
== Operating notes ==<br />
<br />
When precorder is first launched you will see the main screen. Only one button is currently functional. Tapping the 'Record Now' button will begin recording video to the /media/internal location on the pre making these videos available to be copied via USB. They will be located in the root of the USB drive when connected to your computer.<br />
=== Viewfinder ===<br />
Note that you are not able to see the video as it is recording. There is no viewfinder. It is currently technically infeasible to create a viewfinder (but maybe someone will work out how to do it). (For a description of why it is technically infeasible, and to make suggestions, ask questions, please see [http://www.webos-internals.org/wiki/Application_talk:Precorder#Viewfinder_discussion this section in the discussion page].) <br />
=== Controls === <br />
When you tap the 'Record Now' button the screen will change to notify you that Precorder is currently capturing audio and video. There is a 'Stop recording' button located on the screen. Tapping this button stops the audio/video capture and returns you to the main view.<br />
=== Customization ===<br />
There are several features of Precorder that can be customized. All of these settings are available via the preferences option within the Precorder menu. The table below lists all possible preferences. Options in bold represent defaults.<br />
<br />
<Table><TR><TD><br />
{{{!}} border="1" cellpadding="4"<br />
{{!}}Option<br />
{{!}}Description<br />
{{!}}Possible Selections<br />
{{!}}-<br />
{{!}}Audio Format<br />
{{!}}Select what format you would like the audio stream to be saved in.<br />
{{!}}'''AAC''', AMRNB, MP3<br />
{{!}}-<br />
{{!}}Video Format<br />
{{!}}Select what format you would like the video stream to be saved in.<br />
{{!}}Mpeg-4, H.263, '''H.264/AVC'''<br />
{{!}}-<br />
{{!}}Container<br />
{{!}}Select what multimedia container the audio/video streams will be in.<br />
{{!}}'''mp4''', 3gp<br />
{{!}}-<br />
{{!}}Media Source<br />
{{!}}What would you like Precorder to capture?<br />
{{!}}Audio only, Video only, '''Both'''<br />
{{!}}-<br />
{{!}}Flash<br />
{{!}}Would you like to use the built in LED for illumination?<br />
{{!}}'''Off''', Low, Medium, High<br />
{{!}}}<br />
</TD></TR></Table><br />
<br />
=== Recent enhancements ===<br />
<br />
'''0.3.3'''<br />
*Video player launch button now changes to "Play Last Recorded" after recording a video<br />
*Killswitch on card close should avoid most crashing issues<br />
*Minor bug fixes<br />
<br />
<br />
'''0.3.0'''<br />
*LED brightness now selectable<br />
*Launch button added to launch video player<br />
*Videos now are saved in /media/internal/video<br />
<br />
<br />
'''0.2.3'''<br />
*fixed css bug (correctly pushing the record button to the bottom of the screen)<br />
*added icon for launcher<br />
<br />
=== Known bugs ===<br />
<br />
Precorder is currently in Alpha stages and as such is in a constant state of flux with new features being added and old functionality being modified. Please use this software at your own risk. Due to the alpha nature of the software, please check the discussion page for a more accurate list of bugs and/or feature requests.<br />
<br />
*First run on any phone will cause a blank output.<br />
**Simply start recording, wait a moment, and stop recording, wait a moment. After that, it should be fine.<br />
<br />
*Getting the video light to work may cause 2 starts. Should be a 1-time-only process.<br />
*2 minute limitation of recording. Once the video hits 2 minutes, the video data is lost and outputs a blank file.<br />
<br />
== Source Code ==<br />
<br />
Source at git.webos-internals.org<br />
<br />
Packages in the webos-internals testing feed<br />
<br />
== Screenshots ==<br />
<br />
[[Image:Precorder 2009-01-12 141733.png|alt=Precorder Main View|This is the initial view upon launching Precorder]]<br />
[[Image:Precorder 2009-01-12 141738.png|alt=Precorder Recording View|This is the display during audio/video capture]]<br />
[[Image:Precorder_2009-01-12_141805.png|alt=Precorder Preferences View|This is the preferences selection screen]]<br />
[[Image:Precorder_2009-01-12_141742.png|alt=Precorder Finished Recording View|Button at top now allow opening the recorded file directly]]<br />
[[Image:Launcher_2009-24-11_164206.png|alt=Palm OEM video app|All videos are viewable on the device via the Palm OEM video application]]<br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Application:Precorder&diff=7816Application:Precorder2009-12-20T11:41:56Z<p>Fritos1406: </p>
<hr />
<div>{{application<br />
|name=Precorder<br />
|type=webOS<br />
|version=Version: Alpha 0.3.3 <br />(26 Nov 2009)<br />
|tag=Utilities<br />
|screenshot=Precorder_2009-01-12_141733.png<br />
|description=<br />
<br />
== Summary == <br />
<br />
Precorder has been developed to bridge the gap between the current revision of WebOS and a future release that will enable video recording. It is capable of recording in multiple combinations of audio and video and includes support for using the built-in LED for lumination while recording in dark areas. Video recorded with Precorder is viewable through Palms built in video application.<br />
<br />
== Status ==<br />
<br />
Precorder is ALPHA SOFTWARE developed primarily by ZSoc of WebOS Internals with assistance from a number of other developers (as listed in the Maintainers field in the package metadata).<br />
<br />
It does not have a viewfinder, cause we technically do not know how to do that (yet?).<br />
<br />
== Recent Changes ==<br />
<br />
Even though Precorder in alpha state is not available for download in Preware (it will be when it goes into beta), once you install Precorder it appears in the Installed Packages section and you can see the package changelogs there.<br />
<br />
== Donations ==<br />
<br />
Please see the official PreCentral thread first post at http://forums.precentral.net/2059462-post1.html for the donation link. Since this is a wiki that anyone can edit, we do not put the donation link here.<br />
<br />
==Installation==<br />
<br />
Note that you cannot install the packages using any other method than the methods below. Specifically, fileCoaster is not able to install these packages.<br />
<br />
=== Preware ===<br />
<br />
Precorder will be added to Preware once it reaches beta status. Until then, please use the Precorder bootstrap script.<br />
<br />
=== Bootstrap Script ===<br />
<br />
The easiest (and guaranteed to always be up to date) method of installing the latest packages via the precorder bootstrap script.<br />
<br />
Just run the following commands on your Pre. You can get a command line either via the Terminal application in Preware, or by an SSH connection, or by using the Linux commandline window in WebOS Quick Install. The precorder bootstrap can also be re-run at any time to safely update Precorder to the latest alpha testing version.<br />
<br />
<br><br />
mount -o remount,rw /<br />
rm -f precorder-bootstrap<br />
<br><br />
wget http://bit.ly/precorder-bootstrap<br />
<br><br />
sh precorder-bootstrap<br />
<br />
=== WebOS Quick Install ===<br />
<br />
If you can't use the precorder bootstrap script for some reason, you can also use the following links to download the individual packages and install them with WebOS Quick Install. Note that these links will quickly get out of date, so please use the precorder bootstrap to always get the latest alpha testing version.<br />
<br />
Note that to be able to use WebOS Quick Install to install Precorder, you must first have installed Preware on your device. See http://install.preware.org for instructions on how to do that. When Precorder reaches beta status, you will be able to install, update and remove the packages directly in Preware.<br />
<br />
You can install the GstService ([http://ipkg.preware.org/feeds/webos-internals/testing/armv7/org.webosinternals.gstservice_0.3.3_armv7.ipk Pre] or [http://ipkg.preware.org/feeds/webos-internals/testing/armv6/org.webosinternals.gstservice_0.3.0_armv6.ipk Pixi]) and [http://ipkg.preware.org/feeds/webos-internals/testing/all/org.webosinternals.precorder_0.3.3_all.ipk Precorder] ipkg files with [http://www.webos-internals.org/wiki/Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method WebOS Quick Install]. (Note that these links may be out of date if we forget to update them every time we release a new version)<br />
<br />
# Save the gstservice and and Precorder ipk's to your local computer.<br />
# Install [[Tutorials_webOS_Installing_An_Ipk#WebOS_Quick_Install_Method|WebOS Quick Install]]<br />
# Drag the gstservice IPK into the center of the WebOS Quick install window.<br />
# Click the Install button.<br />
# Drag the Precorder application ipk into the center of the WebOS Quick Install window.<br />
# Click the install button.<br />
<br />
== License ==<br />
<br />
The GStreamer Service package is MIT Open Source licensed. The Precorder application is GPLv2 Open Source licensed.<br />
<br />
== Operating notes ==<br />
<br />
When precorder is first launched you will see the main screen. Only one button is currently functional. Tapping the 'Record Now' button will begin recording video to the /media/internal location on the pre making these videos available to be copied via USB. They will be located in the root of the USB drive when connected to your computer.<br />
=== Viewfinder ===<br />
Note that you are not able to see the video as it is recording. There is no viewfinder. It is currently technically infeasible to create a viewfinder (but maybe someone will work out how to do it). (For a description of why it is technically infeasible, and to make suggestions, ask questions, please see [http://www.webos-internals.org/wiki/Application_talk:Precorder#Viewfinder_discussion this section in the discussion page].) <br />
=== Controls === <br />
When you tap the 'Record Now' button the screen will change to notify you that Precorder is currently capturing audio and video. There is a 'Stop recording' button located on the screen. Tapping this button stops the audio/video capture and returns you to the main view.<br />
=== Customization ===<br />
There are several features of Precorder that can be customized. All of these settings are available via the preferences option within the Precorder menu. The table below lists all possible preferences. Options in bold represent defaults.<br />
<br />
<Table><TR><TD><br />
{{{!}} border="1" cellpadding="4"<br />
{{!}}Option<br />
{{!}}Description<br />
{{!}}Possible Selections<br />
{{!}}-<br />
{{!}}Audio Format<br />
{{!}}Select what format you would like the audio stream to be saved in.<br />
{{!}}'''AAC''', AMRNB, MP3<br />
{{!}}-<br />
{{!}}Video Format<br />
{{!}}Select what format you would like the video stream to be saved in.<br />
{{!}}Mpeg-4, H.263, '''H.264/AVC'''<br />
{{!}}-<br />
{{!}}Container<br />
{{!}}Select what multimedia container the audio/video streams will be in.<br />
{{!}}'''mp4''', 3gp<br />
{{!}}-<br />
{{!}}Media Source<br />
{{!}}What would you like Precorder to capture?<br />
{{!}}Audio only, Video only, '''Both'''<br />
{{!}}-<br />
{{!}}Flash<br />
{{!}}Would you like to use the built in LED for illumination?<br />
{{!}}'''Off''', Low, Medium, High<br />
{{!}}}<br />
</TD></TR></Table><br />
<br />
=== Recent enhancements ===<br />
<br />
'''0.3.3'''<br />
*Video player launch button now changes to "Play Last Recorded" after recording a video<br />
*Killswitch on card close should avoid most crashing issues<br />
*Minor bug fixes<br />
<br />
<br />
'''0.3.0'''<br />
*LED brightness now selectable<br />
*Launch button added to launch video player<br />
*Videos now are saved in /media/internal/video<br />
<br />
<br />
'''0.2.3'''<br />
*fixed css bug (correctly pushing the record button to the bottom of the screen)<br />
*added icon for launcher<br />
<br />
=== Known bugs ===<br />
<br />
Precorder is currently in Alpha stages and as such is in a constant state of flux with new features being added and old functionality being modified. Please use this software at your own risk. Due to the alpha nature of the software, please check the discussion page for a more accurate list of bugs and/or feature requests.<br />
<br />
*First run on any phone will cause a blank output.<br />
**Simply start recording, wait a moment, and stop recording, wait a moment. After that, it should be fine.<br />
<br />
*Getting the video light to work may cause 2 starts. Should be a 1-time-only process.<br />
*2 minute limitation of recording. Once the video hits 2 minutes, the video data is lost and outputs a blank file.<br />
<br />
== Source Code ==<br />
<br />
Source at git.webos-internals.org<br />
<br />
Packages in the webos-internals testing feed<br />
<br />
== Screenshots ==<br />
<br />
[[Image:Precorder 2009-01-12 141733.png|alt=Precorder Main View|This is the initial view upon launching Precorder]]<br />
[[Image:Precorder 2009-01-12 141738.png|alt=Precorder Recording View|This is the display during audio/video capture]]<br />
[[Image:Precorder_2009-01-12_141805.png|alt=Precorder Preferences View|This is the preferences selection screen]]<br />
[[Image:Precorder_2009-01-12_141742.png|alt=Precorder Finished Recording View|Button at top now allow opening the recorded file directly]]<br />
[[Image:Launcher_2009-24-11_164206.png|alt=Palm OEM video app|All videos are viewable on the device via the Palm OEM video application]]<br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Youtube_Landscape_Orientation&diff=6389Patch Youtube Landscape Orientation2009-10-09T12:18:45Z<p>Fritos1406: New page: You will have to resize the background.png image found in /usr/palm/applications/com.palm.app.youtube/images/ to 480x480 so that it doesnt cut off when switching orientation. or u can do...</p>
<hr />
<div>You will have to resize the background.png image found in /usr/palm/applications/com.palm.app.youtube/images/ to 480x480 so that it doesnt cut off when switching orientation.<br />
<br />
or u can download this one which is already resized and use quick install to send the file to the directory http://www.webos-internals.org/images/2/26/Background.png<br />
----<br />
'''PATCH CODE'''<br />
<br />
<br />
<pre>Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/home-assistant.js<br />
@@ -12,6 +12,9 @@ var HomeAssistant = Class.create({<br />
// setup application menu<br />
this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);<br />
<br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
+ <br />
// setup bottom menus <br />
this.controller.setupWidget('videos-menu', undefined, this.videosMenuModel); <br />
this.controller.setupWidget(Mojo.Menu.commandMenu, {menuClass: "no-fade"}, this.cmdMenuModel);<br />
@@ -52,6 +55,14 @@ var HomeAssistant = Class.create({<br />
});<br />
},<br />
<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
activate: function() {<br />
$('search_string').mojo.focus();<br />
this._checkHistoryCount();<br />
Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/search-assistant.js<br />
@@ -20,6 +20,9 @@ var SearchAssistant = Class.create({<br />
// setup application menu<br />
this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);<br />
<br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
+ <br />
// setup search field<br />
this.searchFieldModel.attributes = {<br />
hintText: $L('Search All Videos...'),<br />
@@ -66,6 +69,14 @@ var SearchAssistant = Class.create({<br />
}); <br />
},<br />
<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
activate: function() {<br />
// in case of cross app launch we want to focus the app only after <br />
// search scene is ready to go. This is so that user won't see a<br />
Index: /usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js<br />
@@ -11,6 +11,9 @@ var VideoAssistant = Class.create({<br />
setup: function() {<br />
// setup application menu<br />
this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems: true}, AppAssistant.appMenuModel);<br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
<br />
// setup bottom menus<br />
this.cmdMenuModel = {items: [{label: $L('More'), submenu:'more-menu'}, <br />
@@ -29,7 +32,15 @@ var VideoAssistant = Class.create({<br />
AppAssistant.common.playVideo(this.video);<br />
}.bind(this));<br />
},<br />
- <br />
+<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+<br />
activate: function() {<br />
// in case of cross app launch we want to focus the app only after <br />
// search scene is ready to go. This is so that user won't see a</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=File:Background.png&diff=6388File:Background.png2009-10-09T12:16:57Z<p>Fritos1406: </p>
<hr />
<div></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Portal:Patches_to_webOS&diff=6387Portal:Patches to webOS2009-10-09T12:05:15Z<p>Fritos1406: </p>
<hr />
<div>__notoc__<br />
{{portal-header<br />
|This page lists patches to webOS existing apps which modify the behavior as shipped. '''Note''' that these patches may be version specific and may be broken by future webOS updates. Proceed with caution. If you get one that works please move it under the correct column, alphabetically, and title the page:<br />
'''"Patch [application] [description]"''' (for application specific patches) <br><br />
'''"Patch webOS [description]"''' (for patches not part of a specific application)<br><br />
<br />
Each page should contain at least the basic headings<br />
*1. '''Introduction''': A brief description to introduce people to the patch.<br />
**1.1 '''Usage''':An explanation if it is needed on how to use the modification see Add/Delete Pages in the Launcher as an example.<br />
*2. '''Editing Process''': Step by step instructions to manually edit. <br />
*3. '''Patching Process''': Details for making the edits with a patch file and pointing people to the [[Applying Patches]] page if the patch is also provided in the webos-internals gitorious repository.<br />
<br />
For patches that aren't listed here you'll also want to check out the gitorious repository at http://gitorious.org/webos-internals/modifications/trees/master<br />
}}<br />
<br />
{{portal-three-columns<br />
|column1= <br />
===webOS Update Information===<br />
* [[Update 1.2.1|Update 1.2.1]]<br />
* [[Update 1.2.0|Update 1.2]]<br />
* [[Update 1.1.0|Update 1.1]]<br />
* [[Update 1.0.4|Update 1.0.4]] <br />
* [[Update 1.0.3|Update 1.0.3]]<br />
<br />
===Patches that Need Work===<br />
* [[Bugs]]<br />
<br />
|column2=<br />
===Patch Ideas to be Created or in Progress===<br />
<br />
* [[More_Calculator_Functions|Accessing additional built-in calculator functions]]<br />
* [[Add_Ability_To_Choose_Snooze_Length|Add Ability to Choose Snooze Length]]<br />
* [[Add_Icon_To_Quick_Launcher|Add an icon to the quick launcher]]<br />
* [[Changing Clipboard Data From The Shell|Changing Clipboard Data from the Shell]]<br />
* [[Development_%26_Tweak_Ideas | Development & Tweaking Ideas]]<br />
* [[Longer Vibrate|Longer Vibrate]]<br />
<br />
<br />
<br />
|column3=<br />
===Notes===<br />
These modifications lack a patch process, please add one to the details to the page and have it added to the webOS-internals gitorious repository. Info for the repository is on [[Applying Patches]].<br />
<br />
*Empty<br />
}}<br />
{{portal-three-columns<br />
|column1= <br />
==Application Patches==<br />
===webOS 1.2.1 OK===<br />
* ++[[Patch Browser Global Search Addons|Browser: Global Search Addons]]<br />
* ++[[Patch Camera Easy Shutter Sound Off|Camera: Easy Shutter Sound Off]]<br />
* ++[[Patch Calendar Notification Repeat|Calendar: Notification Repeat]]<br />
* ++[[Patch Calendar Snooze Duration Selection|Calendar: Snooze Duration Selection]]<br />
* [[Patch Clock Enabling the Hidden Theme|Clock: Enabling the Hidden Theme]]<br />
* ++[[Patch Clock Change Alarm Button Order|Clock: Change Alarm Button Order]]<br />
* ++[[Patch Clock Change Alarm Snooze Length|Clock: Change Alarm Snooze Length]]<br />
* [[Patch Email Confirm Deletion|Email: Confirm Deletion]]<br />
* [[Patch Email Change Default Font for Replies-Forwards from Navy to Black|Email: Change Default Font for Replies/Forwards from Navy to Black]]<br />
* [[Patch Email DeleteAll|Email: Delete All]]<br />
* [[Patch Launcher Add or Delete Pages|Launcher: Add/Delete Pages]]<br />
* [[Patch Launcher Hide-Delete The NASCAR App|Launcher: Hide/Delete The NASCAR App]]<br />
* ++[[Patch Launcher Hide Media Sync Option|Launcher: Hide Media Sync Option]]<br />
* [[Patch Launcher Reset Scroll on Page Change|Launcher: Reset Scroll on Page Change]]<br />
* [[Patch Launcher Unhide the DeveloperMode App|Launcher: Unhide the DeveloperMode App]]<br />
* [[Patch Launcher To Allow More Icons Per Row|Launcher: Allows More Icons Per Row]]<br />
* [[Patch Messaging Character Counter|Messaging: Character Counter]]<br />
* [[Patch Messaging Display Full Status Messages|Messaging: Display Full Status Messages]]<br />
* ++[[Patch MediaPlayer Ignore 'A', 'An', and 'The' In Artist and Album names|Music Player: Ignore 'A', 'An', and 'The' in Artist and Album Names]]<br />
* [[Patch Phone Show Call Duration in the Call Log|Phone: Show Call Duration in the Call Log]]<br />
* [[Patch Youtube Landscape Orientation|Youtube: Landscape Orientation]]<br />
<br />
===webOS 1.2 OK===<br />
++ Indicates needs to be added to the git repository. Please help add them and remove the notation when added.<br />
* [[Patch Camera Shutter Sound On-Off Button|Camera: Shutter Sound On-Off Button]]<br />
* [[Patch Clock Enabling the Hidden Theme|Clock: Enabling the Hidden Theme]]<br />
* [[Patch Messaging Change "Enter Key" To Create Newline|Messaging: Change "Enter Key" To Create Newline]]<br />
* [[Patch Messaging New Cards For Each Conversation|Messaging: New Cards For Each Conversation]]<br />
* [[Patch Messaging Adding Timestamps to All Received Messages|Messaging: Adding Timestamps to All Received Messages]]<br />
* ++[[Patch Phone Edit Dialer Theme|Phone: Edit Dialer Theme]]<br />
* [[Patch Tasks Always Show Details of New Tasks|Tasks: Always Show Details of New Tasks]]<br />
<br />
===Fixed in 1.2 - No longer needed===<br />
* [[Patch Amazon Download Music over EVDO|Amazon: Download Music over EVDO]]<br />
* [[Patch Browser Downloading Files|Browser: Downloading Files]] <br />
* [[Patch MediaPlayer Bookmarking|Music Player: Bookmarking - Works in 1.2 for podcast, speech, spoken word, netcast, or audiobook genre tags only]]<br />
<br />
===webOS 1.1 OK===<br />
<br />
* [[Patch Browser Delete Individual History Items|Browser: Delete Individual History Items]]<br />
* [[Patch Calendar Show All-Day Events in Month View|Calendar: Show All-Day Events in Month View]] <br />
* ++[[Patch Camera 10 Second Countdown Timer|Camera: 10 Second Countdown Timer]]<br />
* [[Patch Camera Using Volume Buttons to Take a Picture|Camera: Using Volume Buttons to Take a Picture]]<br />
* ++[[Patch Email Change "Running Late" Message|Email: Change "Running Late" Message]]<br />
* [[Patch Email DeleteAll|Email: Delete All]]<br />
* ++[[Patch Messaging Force Offline Send Without Dialog|Messaging: Force Offline Send Without Dialog]]<br />
* [[Patch Messaging Forward Messages|Messaging: Forward Messages]]<br />
* [[Patch Messaging Jump Forward, Backward One Word at a Time|Messaging: Jump Forward, Backward One Word at a Time]]<br />
* [[Patch Messaging Landscape Orientation|Messaging: Landscape Orientation]]<br />
* [[Patch Messaging Sounds|Messaging: Message Sound]]<br />
* ++[[Patch MCraig Enabling Personals Category|mCraig: Enabling Personals Category]]<br />
* ++[[Patch PDF Viewer Change Orientation|PDF Viewer: Change Orientation]]<br />
* [[Patch Phone Disable Various Call Sounds|Phone: Disable Various Call Sounds]]<br />
* ++[[Patch Phone Editing the Lock Screen|Phone: Editing the Lock Screen]]<br />
* [[Patch Tasks Always Show Details of New Tasks|Tasks: Always Show Details of New Tasks]]<br />
* ++[[Patch WebOS Bypassing Lock Screen|Unlock: Bypass the Passcode Entry Screen]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* [[Patch Email Fix Broken Formatting|Email: Fix Broken Formatting for E-mails]]<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch Camera Remote View|Camera: Remote View]]<br />
* [[Patch Email Enable Landscape Viewing|Email: Enable Landscape Viewing]] <br />
* [[Patch Email Fix Attachments|Email: Fix Attachments]]<br />
* [[Patch Sudoku Disable Zooming|Sudoku: Disable Zooming]]<br />
<br />
<br />
|column2=<br />
==General Patches==<br />
===webOS 1.2 OK===<br />
* [[Patch Enable LED Notifications|Enable LED Notifications]]<br />
* [[On Screen Keyboard]]<br />
* [[Patch webOS Disable Charging Event Sounds|Disable Charging Event Sounds]]<br />
* [[Patch webOS Turning Off Dialpad Noise|Turning Off Dialpad Noise]]<br />
* [[Patch webOS Add Words to AutoCorrect Dictionary|Modify AutoCorrect Dictionary]]<br />
* [[Patch webOS Roam Control|Roam Control]]<br />
<br />
===webOS 1.1 OK===<br />
<br />
++ Indicates needs to be added to the git repository. Please help add them and remove the notation when added.<br />
<br />
* ++[[Patch webOS Boot Themes|Boot Themes]]<br />
* ++[[Patch webOS Brightness|Brightness]]<br />
* ++[[Patch webOS Bypassing Activation|Bypassing Activation]]<br />
* ++[[Patch webOS Change Carrier String|Change Carrier String]]<br />
* ++[[Change_the_default_notification.wav_Sound|Change the Default notification.wav Sound]]<br />
* [[Patch webOS Changing the "Turn off after X" time|Changing the "Turn off after X" Time]]<br />
* ++[[Patch webOS CPU Frequency or Voltage Scaling|CPU Frequency or Voltage Scaling]]<br />
* ++[[Patch webOS GPS Tracking|GPS Tracking]]<br />
* ++[[Patch webOS Graphics|Graphics]]<br />
* ++[[Patch webOS Hourly Chime|Hourly Chime]] <br />
* ++[[Patch webOS Keep Phone Awake While in Remote Session|Keep Phone Awake While in Remote Session]]<br />
* [[Patch webOS Logging Information from Within Scripts|Logging Information from Within Scripts]]<br />
* [[Patch webOS Modifying a Stock App While Keeping the Original|Modifying a Stock App While Keeping the Original]] <br />
* [[Patch webOS Radio Power Switch|Radio Power Switch]]<br />
* ++[[Patch webOS Random Wallpaper Switching|Random Wallpaper Switching]]<br />
* [[Patch webOS Reverse Tunnel|Reverse Tunnel]] <br />
* [[Patch webOS Show Actual Battery Percentage | Show Actual Battery Percentage]]<br />
* [[Screenlock On When Connected|Stay On While Connected]]<br />
* [[Make USB Partition Writable via SFTP|Make USB Partition writable via SFTP]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* Empty<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch webOS Email App Patch to Prompt for IPK Installation|Email App Patch to Prompt for IPK Installation]] <br />
<br />
|column3=<br />
==== The following have not been checked for compatibility with webOS 1.1. ====<br />
<br />
* [[Browser_Plugins|Browser Plugins]]<br />
* [[Camera Mod Alternate Sound Disable]]<br />
* [[Changes_Alert/Notification_Sounds|Changes Alert/Notification Sounds]]<br />
* [[Myavatar In Messaging App|Myavatar In Messaging App]] <br />
* [[Photos Slideshow|Photos Slideshow]] <br />
<br />
==== The following are deprecated. They have been replaced with methods which are easier or are moot in 1.1 ====<br />
<br />
* [[Installing Homebrew Apps With A Rooted Pre|Installing Homebrew Apps With A Linux Accessed Pre]] <br />
* [[Packaging Homebrew Apps for Stock Pre without Rooting|Packaging Homebrew Apps for Stock Pre without Accessing Linux]] <br />
* [[Modifying Stock Applications|Modifying Stock Applications]] <br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=6152Patch Messaging Landscape Orientation2009-10-04T05:04:30Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin App:<br />
<br />
<br />
'''MUST BE IN [root@castle:/#] TO INSTALL'''<br />
<pre>cd /opt/src/modifications<br />
git pull<br />
cd /<br />
quilt import /opt/src/modifications/message-orientation.patch<br />
quilt push -a -f</pre><br />
'''''to apply this patch just copy the above how-to and then you will be done..thats it !!'''''<br />
<br />
<br />
----<br />
<br />
<br />
Manually doing this patch you will have to put the codes in the patch in their corresponding places..<br />
<br />
<br />
'''PATCH CODE'''<br />
<pre>Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
@@ -97,7 +97,9 @@ var ChatviewAssistant = Class.create({<br />
<br />
setup: function(){ <br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
- <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
var messageTextWidgetAttributes = {<br />
modelProperty: 'value',<br />
hintText: $L('Enter message here...'),<br />
@@ -196,6 +198,14 @@ var ChatviewAssistant = Class.create({<br />
this.handleFocus();<br />
} <br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function(){<br />
this.chatViewHeaderClickTarget.stopObserving(Mojo.Event.tap, this.handleHeaderTap);<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
@@ -73,7 +73,9 @@ var ComposeAssistant = Class.create({<br />
<br />
setup: function() {<br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
-<br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.searchList = {<br />
"property": "to$A",<br />
"includeEmails": false,<br />
@@ -386,6 +388,14 @@ var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function() {<br />
var that = this;<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
@@ -212,8 +212,10 @@ var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
- this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel); <br />
- <br />
+ this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);<br />
@@ -1086,7 +1088,15 @@ var ListviewAssistant = Class.create(App<br />
loadDebugView: function() {<br />
this.controller.stageController.pushScene('debug');<br />
}, <br />
- <br />
+<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
cleanup: function() {<br />
// save the listview state<br />
MessagingMojoService.setIsHistoryViewSelected(this.controller,(this.currentListView == this.Messaging.Views.HISTORY));<br />
Index: /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
+++ /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
@@ -642,10 +642,10 @@ img.avatar-overlay {<br />
}<br />
<br />
.their-chat .message-container {<br />
- width: 255px;<br />
+ width: 85%;<br />
}<br />
.my-chat .message-container {<br />
- width: 280px;<br />
+ width: 95%;<br />
}<br />
.chat-entry .chat-balloon {<br />
min-height: 26px;<br />
@@ -823,7 +823,7 @@ img.avatar-overlay {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
- width: 320px;<br />
+ width: 100%;<br />
}<br />
<br />
#messageContainer #messageTextWidget {<br />
</pre><br />
<br />
<br />
'''Credits: FRITOS1406'''</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5800Patch Messaging Landscape Orientation2009-09-17T00:38:55Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin App:<br />
<br />
<br />
'''MUST BE IN [root@castle:/#] TO INSTALL'''<br />
<pre>wget http://filebin.ca/vvyay/message-orientation.patch<br />
quilt import message-orientation.patch<br />
quilt push -a -f</pre><br />
'''''to apply this patch just copy the above how-to and then you will be done..thats it !!'''''<br />
<br />
<br />
----<br />
<br />
<br />
Manually doing this patch you will have to put the codes in the patch in their corresponding places..<br />
<br />
<br />
'''PATCH CODE'''<br />
<pre>Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
@@ -97,7 +97,9 @@ var ChatviewAssistant = Class.create({<br />
<br />
setup: function(){ <br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
- <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
var messageTextWidgetAttributes = {<br />
modelProperty: 'value',<br />
hintText: $L('Enter message here...'),<br />
@@ -196,6 +198,14 @@ var ChatviewAssistant = Class.create({<br />
this.handleFocus();<br />
} <br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function(){<br />
this.chatViewHeaderClickTarget.stopObserving(Mojo.Event.tap, this.handleHeaderTap);<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
@@ -73,7 +73,9 @@ var ComposeAssistant = Class.create({<br />
<br />
setup: function() {<br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
-<br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.searchList = {<br />
"property": "to$A",<br />
"includeEmails": false,<br />
@@ -386,6 +388,14 @@ var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function() {<br />
var that = this;<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
@@ -212,8 +212,10 @@ var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
- this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel); <br />
- <br />
+ this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);<br />
@@ -1086,7 +1088,15 @@ var ListviewAssistant = Class.create(App<br />
loadDebugView: function() {<br />
this.controller.stageController.pushScene('debug');<br />
}, <br />
- <br />
+<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
cleanup: function() {<br />
// save the listview state<br />
MessagingMojoService.setIsHistoryViewSelected(this.controller,(this.currentListView == this.Messaging.Views.HISTORY));<br />
Index: /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
+++ /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
@@ -642,10 +642,10 @@ img.avatar-overlay {<br />
}<br />
<br />
.their-chat .message-container {<br />
- width: 255px;<br />
+ width: 85%;<br />
}<br />
.my-chat .message-container {<br />
- width: 280px;<br />
+ width: 95%;<br />
}<br />
.chat-entry .chat-balloon {<br />
min-height: 26px;<br />
@@ -823,7 +823,7 @@ img.avatar-overlay {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
- width: 320px;<br />
+ width: 100%;<br />
}<br />
<br />
#messageContainer #messageTextWidget {<br />
</pre><br />
<br />
<br />
'''Credits: FRITOS1406'''</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5799Patch Messaging Landscape Orientation2009-09-17T00:19:56Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin App:<br />
<br />
'''MUST BE IN [root@castle:/#] TO INSTALL'''<br />
<pre>wget http://filebin.ca/vvyay/message-orientation.patch<br />
quilt import message-orientation.patch<br />
quilt push -a -f</pre><br />
'''''to apply this patch just copy the above how-to and then you will be done..thats it !!'''''<br />
<br />
<br />
Manually doing this patch you will have to put the codes in the patch in their corresponding places..<br />
<br />
<br />
'''+++PATCH CODE+++'''<br />
<pre>Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
@@ -97,7 +97,9 @@ var ChatviewAssistant = Class.create({<br />
<br />
setup: function(){ <br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
- <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
var messageTextWidgetAttributes = {<br />
modelProperty: 'value',<br />
hintText: $L('Enter message here...'),<br />
@@ -196,6 +198,14 @@ var ChatviewAssistant = Class.create({<br />
this.handleFocus();<br />
} <br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function(){<br />
this.chatViewHeaderClickTarget.stopObserving(Mojo.Event.tap, this.handleHeaderTap);<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
@@ -73,7 +73,9 @@ var ComposeAssistant = Class.create({<br />
<br />
setup: function() {<br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
-<br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.searchList = {<br />
"property": "to$A",<br />
"includeEmails": false,<br />
@@ -386,6 +388,14 @@ var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function() {<br />
var that = this;<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
@@ -212,8 +212,10 @@ var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
- this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel); <br />
- <br />
+ this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);<br />
@@ -1086,7 +1088,15 @@ var ListviewAssistant = Class.create(App<br />
loadDebugView: function() {<br />
this.controller.stageController.pushScene('debug');<br />
}, <br />
- <br />
+<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
cleanup: function() {<br />
// save the listview state<br />
MessagingMojoService.setIsHistoryViewSelected(this.controller,(this.currentListView == this.Messaging.Views.HISTORY));<br />
Index: /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
+++ /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
@@ -642,10 +642,10 @@ img.avatar-overlay {<br />
}<br />
<br />
.their-chat .message-container {<br />
- width: 255px;<br />
+ width: 85%;<br />
}<br />
.my-chat .message-container {<br />
- width: 280px;<br />
+ width: 95%;<br />
}<br />
.chat-entry .chat-balloon {<br />
min-height: 26px;<br />
@@ -823,7 +823,7 @@ img.avatar-overlay {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
- width: 320px;<br />
+ width: 100%;<br />
}<br />
<br />
#messageContainer #messageTextWidget {<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5798Patch Messaging Landscape Orientation2009-09-17T00:08:26Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin App:<br />
<br />
<br />
+++PATCH CODE+++<br />
<pre>Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js<br />
@@ -97,7 +97,9 @@ var ChatviewAssistant = Class.create({<br />
<br />
setup: function(){ <br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
- <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free"); <br />
var messageTextWidgetAttributes = {<br />
modelProperty: 'value',<br />
hintText: $L('Enter message here...'),<br />
@@ -196,6 +198,14 @@ var ChatviewAssistant = Class.create({<br />
this.handleFocus();<br />
} <br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function(){<br />
this.chatViewHeaderClickTarget.stopObserving(Mojo.Event.tap, this.handleHeaderTap);<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js<br />
@@ -73,7 +73,9 @@ var ComposeAssistant = Class.create({<br />
<br />
setup: function() {<br />
this.controller.setupWidget(Mojo.Menu.appMenu, this.appMenuAttrs, this.appMenuModel);<br />
-<br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.searchList = {<br />
"property": "to$A",<br />
"includeEmails": false,<br />
@@ -386,6 +388,14 @@ var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
+ <br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
<br />
cleanup: function() {<br />
var that = this;<br />
Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js<br />
@@ -212,8 +212,10 @@ var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
- this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel); <br />
- <br />
+ this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
+ <br />
+ // enable free orientation<br />
+ this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);<br />
@@ -1086,7 +1088,15 @@ var ListviewAssistant = Class.create(App<br />
loadDebugView: function() {<br />
this.controller.stageController.pushScene('debug');<br />
}, <br />
- <br />
+<br />
+ orientationChanged: function(orientation) {<br />
+ if (orientation === "left" || orientation === "right") {<br />
+ this.controller.sceneElement.addClassName('landscape');<br />
+ } else {<br />
+ this.controller.sceneElement.removeClassName('landscape');<br />
+ }<br />
+ },<br />
+ <br />
cleanup: function() {<br />
// save the listview state<br />
MessagingMojoService.setIsHistoryViewSelected(this.controller,(this.currentListView == this.Messaging.Views.HISTORY));<br />
Index: /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
+++ /usr/palm/applications/com.palm.app.messaging/stylesheets/messaging.css<br />
@@ -642,10 +642,10 @@ img.avatar-overlay {<br />
}<br />
<br />
.their-chat .message-container {<br />
- width: 255px;<br />
+ width: 85%;<br />
}<br />
.my-chat .message-container {<br />
- width: 280px;<br />
+ width: 95%;<br />
}<br />
.chat-entry .chat-balloon {<br />
min-height: 26px;<br />
@@ -823,7 +823,7 @@ img.avatar-overlay {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
- width: 320px;<br />
+ width: 100%;<br />
}<br />
<br />
#messageContainer #messageTextWidget {<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5115Patch Messaging Landscape Orientation2009-09-02T12:11:00Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app: /usr/palm/applications/com.palm.app.messaging/<br />
<br />
first file we should edit is '''/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. next file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel);<br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre> <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre><br />
now save and exit your all done<br />
<br />
next would be to fix the chat balloons and the text box size so we get into '''/stylesheet/messaging.css'''<br />
once there look for '''.their-chat .message-container''' and '''.my-chat .message-container''' around line 645<br />
and change the widths should look like this:<br />
<pre>.their-chat .message-container {<br />
width: 95%;<br />
}<br />
.my-chat .message-container {<br />
width: 95%;<br />
}</pre><br />
after that go down to line 820 and look for '''#messageContainer {''' make it so that it looks like this:<br />
<pre>#messageContainer {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
width: 100%;<br />
}</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5114Patch Messaging Landscape Orientation2009-09-02T12:09:19Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app: /usr/palm/applications/com.palm.app.messaging/<br />
<br />
first file we should edit is '''/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. next file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel);<br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre> <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre><br />
now save and exit your all done<br />
<br />
next would be to fix the chat balloons and the text box size so we get into /stylesheet/messaging.css<br />
once there look for '''.their-chat .message-container''' and '''.my-chat .message-container''' around line 645<br />
and change the widths to 95%. should look like this:<br />
<pre>.their-chat .message-container {<br />
width: 255px;<br />
}<br />
.my-chat .message-container {<br />
width: 280px;<br />
}</pre><br />
after that go down to line 820 and look for '''#messageContainer {''' make it so that it looks like this:<br />
<pre>#messageContainer {<br />
position: fixed;<br />
bottom:0px;<br />
left:0px;<br />
width: 100%;<br />
}</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Portal:Patches_to_webOS&diff=5082Portal:Patches to webOS2009-09-01T19:34:14Z<p>Fritos1406: </p>
<hr />
<div>__notoc__<br />
{{portal-header<br />
|This page lists patches to webOS existing apps which modify the behavior as shipped. '''Note''' that these patches may be version specific and may be broken by future webOS updates. Proceed with caution. If you get one that works please move it under the correct column, alphabetically, and title the page:<br />
'''"Patch [application] [description]"''' (for application specific patches) <br><br />
'''"Patch webOS [description]"''' (for patches not part of a specific application)<br />
}}<br />
This page is undergoing structuring please contribute moving or adding new entries under the appropriate headings. For now put pages in alphabetical order. Each page should contain at least the basic headings<br />
*1. '''Introduction''': A brief description to introduce people to the patch.<br />
**1.1 '''Usage''':An explanation if it is needed on how to use the modification see Add/Delete Pages in the Launcher as an example.<br />
*2. '''Editing Process''': Step by step instructions to manually edit. <br />
*3. '''Patching Process''': Details for making the edits with a patch file and pointing people to the [[Applying Patches]] page if the patch is also provided in the webos-internals gitorious repository.<br />
<br />
{{portal-three-columns<br />
|column1= <br />
===webOS Update Information===<br />
* [[Update 1.1.0|Update 1.1]]<br />
* [[Update 1.0.4|Update 1.0.4]] <br />
* [[Update 1.0.3|Update 1.0.3]]<br />
<br />
===Patches that Need Work===<br />
* [[Bugs]]<br />
<br />
|column2=<br />
===Patch Ideas to be Created or in Progress===<br />
<br />
* [[More_Calculator_Functions|Accessing additional built-in calculator functions]]<br />
* [[Add_Ability_To_Choose_Snooze_Length|Add Ability to Choose Snooze Length]]<br />
* [[Add_Icon_To_Quick_Launcher|Add an icon to the quick launcher]]<br />
* [[Changing Clipboard Data From The Shell|Changing Clipboard Data from the Shell]]<br />
* [[Development_%26_Tweak_Ideas | Development & Tweaking Ideas]]<br />
* [[Longer Vibrate|Longer Vibrate]]<br />
<br />
<br />
<br />
|column3=<br />
===Notes===<br />
These modifications lack a patch process, please add one to the details to the page and have it added to the webOS-internals gitorious repository. Info for the repository is on [[Applying Patches]].<br />
<br />
*Empty<br />
}}<br />
{{portal-three-columns<br />
|column1= <br />
==Patches to webOS apps==<br />
===webOS 1.1 OK===<br />
<br />
* [[Patch Amazon Download Music over EVDO|Amazon: Download Music over EVDO]]<br />
* [[Patch Browser Global Search Addons|Browser: Global Search Addons]]<br />
* [[Patch Browser Delete Individual History Items|Browser: Delete Individual History Items]]<br />
* [[Patch Browser Downloading Files|Browser: Downloading Files]] <br />
* [[Patch Calendar Show All-Day Events in Month View|Calendar: Show All-Day Events in Month View]] <br />
* [[Patch Camera 10 Second Countdown Timer|Camera: 10 Second Countdown Timer]]<br />
* [[Patch Camera Shutter Sound On-Off Button|Camera: Shutter Sound On-Off Button]]<br />
* [[Patch Camera Using Volume Buttons to Take a Picture|Camera: Using Volume Buttons to Take a Picture]]<br />
* [[Patch Clock Changing Alarm Button Order and Snooze Duration|Clock: Changing Alarm Button Order and Snooze Duration]]<br />
* [[Patch Clock Enabling the Hidden Theme|Clock: Enabling the Hidden Theme]]<br />
* [[Patch Email Change "Running Late" Message|Email: Change "Running Late" Message]]<br />
* [[Patch Email Confirm Deletion|Email: Confirm Deletion]]<br />
* [[Patch Email Change Default Font for Replies-Forwards from Navy to Black|Email: Change Default Font for Replies/Forwards from Navy to Black]]<br />
* [[Patch Email DeleteAll|Email: Delete All]]<br />
* [[Patch Launcher Add or Delete Pages|Launcher: Add/Delete Pages]]<br />
* [[Patch Launcher To Allow More Icons Per Row|Launcher: Allows More Icons Per Row]]<br />
* [[Patch Launcher Hide-Delete The NASCAR App|Launcher: Hide/Delete The NASCAR App]]<br />
* [[Patch Launcher Hide Media Sync Option|Launcher: Hide Media Sync Option]]<br />
* [[Patch Launcher Reset Scroll on Page Change|Launcher: Reset Scroll on Page Change]]<br />
* [[Patch Launcher Unhide the DeveloperMode App|Launcher: Unhide the DeveloperMode App]]<br />
* [[Patch Messaging Adding Timestamps to All Received Messages|Messaging: Adding Timestamps to All Received Messages]]<br />
* [[Patch Messaging Change "Enter Key" To Create Newline|Messaging: Change "Enter Key" To Create Newline]]<br />
* [[Patch Messaging Character Counter|Messaging: Character Counter]]<br />
* [[Patch Messaging Display Full Status Messages|Messaging: Display Full Status Messages]] <br />
* [[Patch Messaging Force Offline Send Without Dialog|Messaging: Force Offline Send Without Dialog]]<br />
* [[Patch Messaging Forward Messages|Messaging: Forward Messages]]<br />
* [[Patch Messaging Jump Forward, Backward One Word at a Time|Messaging: Jump Forward, Backward One Word at a Time]]<br />
* [[Patch Messaging Landscape Orientation]]<br />
* [[Patch Messaging New Cards For Each Conversation|Messaging: New Cards For Each Conversation]]<br />
* [[Patch Messaging Sounds|Messaging: Message Sound]]<br />
* [[Patch MCraig Enabling Personals Category|mCraig: Enabling Personals Category]]<br />
* [[Patch MediaPlayer Bookmarking|Music Player: Bookmarking]]<br />
* [[Patch MediaPlayer Ignore 'A', 'An', and 'The' In Artist and Album names|Music Player: Ignore 'A', 'An', and 'The' in Artist and Album Names]]<br />
* [[Patch PDF Viewer Change Orientation|PDF Viewer: Change Orientation]]<br />
* [[Patch Phone Disable Various Call Sounds|Phone: Disable Various Call Sounds]]<br />
* [[Patch Phone Edit Dialer Theme|Phone: Edit Dialer Theme]]<br />
* [[Patch Phone Editing the Lock Screen|Phone: Editing the Lock Screen]]<br />
* [[Patch Phone Show Call Duration in the Call Log|Phone: Show Call Duration in the Call Log]]<br />
* [[Patch Tasks Always Show Details of New Tasks|Tasks: Always Show Details of New Tasks]]<br />
* [[Patch WebOS Bypassing Lock Screen|Unlock: Bypass the Passcode Entry Screen]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* [[Patch Email Fix Broken Formatting|Email: Fix Broken Formatting for E-mails]]<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch Camera Remote View|Camera: Remote View]]<br />
* [[Patch Email Enable Landscape Viewing|Email: Enable Landscape Viewing]] <br />
* [[Patch Email Fix Attachments|Email: Fix Attachments]]<br />
* [[Patch Sudoku Disable Zooming|Sudoku: Disable Zooming]]<br />
<br />
<br />
|column2=<br />
==Patches not part of a specific app==<br />
===webOS 1.1 OK===<br />
* [[Patch webOS Boot Themes|Boot Themes]]<br />
* [[Patch webOS Brightness|Brightness]]<br />
* [[Patch webOS Bypassing Activation|Bypassing Activation]]<br />
* [[Patch webOS Change Carrier String|Change Carrier String]]<br />
* [[Change_the_default_notification.wav_Sound|Change the Default notification.wav Sound]]<br />
* [[Patch webOS Changing the "Turn off after X" time|Changing the "Turn off after X" Time]]<br />
* [[Patch webOS CPU Frequency or Voltage Scaling|CPU Frequency or Voltage Scaling]]<br />
* [[Patch webOS Disable Charging Event Sounds|Disable Charging Event Sounds]]<br />
* [[Patch webOS GPS Tracking|GPS Tracking]]<br />
* [[Patch webOS Graphics|Graphics]]<br />
* [[Patch webOS Hourly Chime|Hourly Chime]] <br />
* [[Patch webOS Turning Off Dialpad Noise|Turning Off Dialpad Noise]]<br />
* [[Patch webOS Keep Phone Awake While in Remote Session|Keep Phone Awake While in Remote Session]]<br />
* [[Patch webOS Logging Information from Within Scripts|Logging Information from Within Scripts]]<br />
* [[Patch webOS Modifying a Stock App While Keeping the Original|Modifying a Stock App While Keeping the Original]] <br />
* [[Patch webOS Add Words to AutoCorrect Dictionary|Modify AutoCorrect Dictionary]]<br />
* [[On Screen Keyboard]]<br />
* [[Patch webOS Radio Power Switch|Radio Power Switch]]<br />
* [[Patch webOS Random Wallpaper Switching|Random Wallpaper Switching]]<br />
* [[Patch webOS Reverse Tunnel|Reverse Tunnel]] <br />
* [[Patch webOS Roam Control|Roam Control]]<br />
* [[Patch webOS Show Actual Battery Percentage | Show Actual Battery Percentage]]<br />
* [[Screenlock On When Connected|Stay On While Connected]]<br />
* [[Make USB Partition Writable via SFTP|Make USB Partition writable via SFTP]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* Empty<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch webOS Email App Patch to Prompt for IPK Installation|Email App Patch to Prompt for IPK Installation]] <br />
<br />
|column3=<br />
==== The following have not been checked for compatibility with webOS 1.1. ====<br />
<br />
* [[Browser_Plugins|Browser Plugins]]<br />
* [[Camera Mod Alternate Sound Disable]]<br />
* [[Changes_Alert/Notification_Sounds|Changes Alert/Notification Sounds]]<br />
* [[Myavatar In Messaging App|Myavatar In Messaging App]] <br />
* [[Photos Slideshow|Photos Slideshow]] <br />
<br />
==== The following are deprecated. They have been replaced with methods which are easier or are moot in 1.1 ====<br />
<br />
* [[Installing Homebrew Apps With A Rooted Pre|Installing Homebrew Apps With A Linux Accessed Pre]] <br />
* [[Packaging Homebrew Apps for Stock Pre without Rooting|Packaging Homebrew Apps for Stock Pre without Accessing Linux]] <br />
* [[Modifying Stock Applications|Modifying Stock Applications]] <br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Portal:Patches_to_webOS&diff=5081Portal:Patches to webOS2009-09-01T19:33:07Z<p>Fritos1406: </p>
<hr />
<div>__notoc__<br />
{{portal-header<br />
|This page lists patches to webOS existing apps which modify the behavior as shipped. '''Note''' that these patches may be version specific and may be broken by future webOS updates. Proceed with caution. If you get one that works please move it under the correct column, alphabetically, and title the page:<br />
'''"Patch [application] [description]"''' (for application specific patches) <br><br />
'''"Patch webOS [description]"''' (for patches not part of a specific application)<br />
}}<br />
This page is undergoing structuring please contribute moving or adding new entries under the appropriate headings. For now put pages in alphabetical order. Each page should contain at least the basic headings<br />
*1. '''Introduction''': A brief description to introduce people to the patch.<br />
**1.1 '''Usage''':An explanation if it is needed on how to use the modification see Add/Delete Pages in the Launcher as an example.<br />
*2. '''Editing Process''': Step by step instructions to manually edit. <br />
*3. '''Patching Process''': Details for making the edits with a patch file and pointing people to the [[Applying Patches]] page if the patch is also provided in the webos-internals gitorious repository.<br />
<br />
{{portal-three-columns<br />
|column1= <br />
===webOS Update Information===<br />
* [[Update 1.1.0|Update 1.1]]<br />
* [[Update 1.0.4|Update 1.0.4]] <br />
* [[Update 1.0.3|Update 1.0.3]]<br />
<br />
===Patches that Need Work===<br />
* [[Bugs]]<br />
<br />
|column2=<br />
===Patch Ideas to be Created or in Progress===<br />
<br />
* [[More_Calculator_Functions|Accessing additional built-in calculator functions]]<br />
* [[Add_Ability_To_Choose_Snooze_Length|Add Ability to Choose Snooze Length]]<br />
* [[Add_Icon_To_Quick_Launcher|Add an icon to the quick launcher]]<br />
* [[Changing Clipboard Data From The Shell|Changing Clipboard Data from the Shell]]<br />
* [[Development_%26_Tweak_Ideas | Development & Tweaking Ideas]]<br />
* [[Longer Vibrate|Longer Vibrate]]<br />
<br />
<br />
<br />
|column3=<br />
===Notes===<br />
These modifications lack a patch process, please add one to the details to the page and have it added to the webOS-internals gitorious repository. Info for the repository is on [[Applying Patches]].<br />
<br />
*Empty<br />
}}<br />
{{portal-three-columns<br />
|column1= <br />
==Patches to webOS apps==<br />
===webOS 1.1 OK===<br />
<br />
* [[Patch Amazon Download Music over EVDO|Amazon: Download Music over EVDO]]<br />
* [[Patch Browser Global Search Addons|Browser: Global Search Addons]]<br />
* [[Patch Browser Delete Individual History Items|Browser: Delete Individual History Items]]<br />
* [[Patch Browser Downloading Files|Browser: Downloading Files]] <br />
* [[Patch Calendar Show All-Day Events in Month View|Calendar: Show All-Day Events in Month View]] <br />
* [[Patch Camera 10 Second Countdown Timer|Camera: 10 Second Countdown Timer]]<br />
* [[Patch Camera Shutter Sound On-Off Button|Camera: Shutter Sound On-Off Button]]<br />
* [[Patch Camera Using Volume Buttons to Take a Picture|Camera: Using Volume Buttons to Take a Picture]]<br />
* [[Patch Clock Changing Alarm Button Order and Snooze Duration|Clock: Changing Alarm Button Order and Snooze Duration]]<br />
* [[Patch Clock Enabling the Hidden Theme|Clock: Enabling the Hidden Theme]]<br />
* [[Patch Email Change "Running Late" Message|Email: Change "Running Late" Message]]<br />
* [[Patch Email Confirm Deletion|Email: Confirm Deletion]]<br />
* [[Patch Email Change Default Font for Replies-Forwards from Navy to Black|Email: Change Default Font for Replies/Forwards from Navy to Black]]<br />
* [[Patch Email DeleteAll|Email: Delete All]]<br />
* [[Patch Launcher Add or Delete Pages|Launcher: Add/Delete Pages]]<br />
* [[Patch Launcher To Allow More Icons Per Row|Launcher: Allows More Icons Per Row]]<br />
* [[Patch Launcher Hide-Delete The NASCAR App|Launcher: Hide/Delete The NASCAR App]]<br />
* [[Patch Launcher Hide Media Sync Option|Launcher: Hide Media Sync Option]]<br />
* [[Patch Launcher Reset Scroll on Page Change|Launcher: Reset Scroll on Page Change]]<br />
* [[Patch Launcher Unhide the DeveloperMode App|Launcher: Unhide the DeveloperMode App]]<br />
* [[Patch Messaging Adding Timestamps to All Received Messages|Messaging: Adding Timestamps to All Received Messages]]<br />
* [[Patch Messaging Change "Enter Key" To Create Newline|Messaging: Change "Enter Key" To Create Newline]]<br />
* [[Patch Messaging Character Counter|Messaging: Character Counter]]<br />
* [[Patch Messaging Display Full Status Messages|Messaging: Display Full Status Messages]] <br />
* [[Patch Messaging Force Offline Send Without Dialog|Messaging: Force Offline Send Without Dialog]]<br />
* [[Patch Messaging Forward Messages|Messaging: Forward Messages]]<br />
* [[Patch Messaging Jump Forward, Backward One Word at a Time|Messaging: Jump Forward, Backward One Word at a Time]]<br />
* [[Messaging: Landscape Orientation]]<br />
* [[Patch Messaging New Cards For Each Conversation|Messaging: New Cards For Each Conversation]]<br />
* [[Patch Messaging Sounds|Messaging: Message Sound]]<br />
* [[Patch MCraig Enabling Personals Category|mCraig: Enabling Personals Category]]<br />
* [[Patch MediaPlayer Bookmarking|Music Player: Bookmarking]]<br />
* [[Patch MediaPlayer Ignore 'A', 'An', and 'The' In Artist and Album names|Music Player: Ignore 'A', 'An', and 'The' in Artist and Album Names]]<br />
* [[Patch PDF Viewer Change Orientation|PDF Viewer: Change Orientation]]<br />
* [[Patch Phone Disable Various Call Sounds|Phone: Disable Various Call Sounds]]<br />
* [[Patch Phone Edit Dialer Theme|Phone: Edit Dialer Theme]]<br />
* [[Patch Phone Editing the Lock Screen|Phone: Editing the Lock Screen]]<br />
* [[Patch Phone Show Call Duration in the Call Log|Phone: Show Call Duration in the Call Log]]<br />
* [[Patch Tasks Always Show Details of New Tasks|Tasks: Always Show Details of New Tasks]]<br />
* [[Patch WebOS Bypassing Lock Screen|Unlock: Bypass the Passcode Entry Screen]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* [[Patch Email Fix Broken Formatting|Email: Fix Broken Formatting for E-mails]]<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch Camera Remote View|Camera: Remote View]]<br />
* [[Patch Email Enable Landscape Viewing|Email: Enable Landscape Viewing]] <br />
* [[Patch Email Fix Attachments|Email: Fix Attachments]]<br />
* [[Patch Sudoku Disable Zooming|Sudoku: Disable Zooming]]<br />
<br />
<br />
|column2=<br />
==Patches not part of a specific app==<br />
===webOS 1.1 OK===<br />
* [[Patch webOS Boot Themes|Boot Themes]]<br />
* [[Patch webOS Brightness|Brightness]]<br />
* [[Patch webOS Bypassing Activation|Bypassing Activation]]<br />
* [[Patch webOS Change Carrier String|Change Carrier String]]<br />
* [[Change_the_default_notification.wav_Sound|Change the Default notification.wav Sound]]<br />
* [[Patch webOS Changing the "Turn off after X" time|Changing the "Turn off after X" Time]]<br />
* [[Patch webOS CPU Frequency or Voltage Scaling|CPU Frequency or Voltage Scaling]]<br />
* [[Patch webOS Disable Charging Event Sounds|Disable Charging Event Sounds]]<br />
* [[Patch webOS GPS Tracking|GPS Tracking]]<br />
* [[Patch webOS Graphics|Graphics]]<br />
* [[Patch webOS Hourly Chime|Hourly Chime]] <br />
* [[Patch webOS Turning Off Dialpad Noise|Turning Off Dialpad Noise]]<br />
* [[Patch webOS Keep Phone Awake While in Remote Session|Keep Phone Awake While in Remote Session]]<br />
* [[Patch webOS Logging Information from Within Scripts|Logging Information from Within Scripts]]<br />
* [[Patch webOS Modifying a Stock App While Keeping the Original|Modifying a Stock App While Keeping the Original]] <br />
* [[Patch webOS Add Words to AutoCorrect Dictionary|Modify AutoCorrect Dictionary]]<br />
* [[On Screen Keyboard]]<br />
* [[Patch webOS Radio Power Switch|Radio Power Switch]]<br />
* [[Patch webOS Random Wallpaper Switching|Random Wallpaper Switching]]<br />
* [[Patch webOS Reverse Tunnel|Reverse Tunnel]] <br />
* [[Patch webOS Roam Control|Roam Control]]<br />
* [[Patch webOS Show Actual Battery Percentage | Show Actual Battery Percentage]]<br />
* [[Screenlock On When Connected|Stay On While Connected]]<br />
* [[Make USB Partition Writable via SFTP|Make USB Partition writable via SFTP]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* Empty<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch webOS Email App Patch to Prompt for IPK Installation|Email App Patch to Prompt for IPK Installation]] <br />
<br />
|column3=<br />
==== The following have not been checked for compatibility with webOS 1.1. ====<br />
<br />
* [[Browser_Plugins|Browser Plugins]]<br />
* [[Camera Mod Alternate Sound Disable]]<br />
* [[Changes_Alert/Notification_Sounds|Changes Alert/Notification Sounds]]<br />
* [[Myavatar In Messaging App|Myavatar In Messaging App]] <br />
* [[Photos Slideshow|Photos Slideshow]] <br />
<br />
==== The following are deprecated. They have been replaced with methods which are easier or are moot in 1.1 ====<br />
<br />
* [[Installing Homebrew Apps With A Rooted Pre|Installing Homebrew Apps With A Linux Accessed Pre]] <br />
* [[Packaging Homebrew Apps for Stock Pre without Rooting|Packaging Homebrew Apps for Stock Pre without Accessing Linux]] <br />
* [[Modifying Stock Applications|Modifying Stock Applications]] <br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5080Patch Messaging Landscape Orientation2009-09-01T19:29:46Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. next file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel);<br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre> <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre><br />
now save and exit your all done</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5079Patch Messaging Landscape Orientation2009-09-01T19:27:40Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. next file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre> <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5078Patch Messaging Landscape Orientation2009-09-01T19:25:19Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. next file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre>+ <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5077Patch Messaging Landscape Orientation2009-09-01T19:24:54Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. new file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);</pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre>+ <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5076Patch Messaging Landscape Orientation2009-09-01T19:24:09Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. new file we should edit is '''listview-assistant.js''' same directory.<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);<pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre>+ <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5075Patch Messaging Landscape Orientation2009-09-01T19:23:11Z<p>Fritos1406: </p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;</pre><br />
now save and exit. new file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js'''<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);<pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre>+ <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Messaging_Landscape_Orientation&diff=5074Patch Messaging Landscape Orientation2009-09-01T19:22:22Z<p>Fritos1406: New page: Landscape Orientation in Messagin app: first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js''' around line 390 u will see thi...</p>
<hr />
<div>Landscape Orientation in Messagin app:<br />
<br />
first file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/compose-assistant.js'''<br />
around line 390 u will see this:<br />
<pre> var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},</pre><br />
add this code right under it<br />
<pre> orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
once you are done it should look like this:<br />
<pre>var ComposeAssistant = Class.create({<br />
}<br />
this.setCharacterCounterMaxLength();<br />
},<br />
<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
cleanup: function() {<br />
var that = this;<pre><br />
now save and exit. new file we should edit is '''/usr/palm/applications/com.palm.app.messaging/app/controllers/listview-assistant.js'''<br />
around line 212 under '''var ListviewAssistant = Class.create(App e''' in the line:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.cmdMenuModel);<pre><br />
edit it so that it looks like this then right under it add:<br />
<pre>this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");</pre><br />
should look like:<br />
<pre>var ListviewAssistant = Class.create(App<br />
items:this.commandMenuModel <br />
}; <br />
<br />
this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.cmdMenuModel); <br />
<br />
// enable free orientation<br />
this.controller.window.PalmSystem.setWindowOrientation("free");<br />
this.filterField = this.controller.get('filterField');<br />
this.buddyListHeader = this.controller.get('buddyListHeader');<br />
this.controller.setupWidget('filterField',{filterFieldName:'filterFieldElement'},this.filterField);</pre><br />
then around line 409 above '''handleCommand: function(event) {''' add :<br />
<pre>+ <br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},</pre><br />
this is how it should look like:<br />
<pre> } <br />
}<br />
},<br />
orientationChanged: function(orientation) {<br />
if (orientation === "left" || orientation === "right") {<br />
this.controller.sceneElement.addClassName('landscape');<br />
} else {<br />
this.controller.sceneElement.removeClassName('landscape');<br />
}<br />
},<br />
<br />
handleCommand: function(event) {<br />
// handle menu button command events</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Portal:Patches_to_webOS&diff=5073Portal:Patches to webOS2009-09-01T18:50:11Z<p>Fritos1406: </p>
<hr />
<div>__notoc__<br />
{{portal-header<br />
|This page lists patches to webOS existing apps which modify the behavior as shipped. '''Note''' that these patches may be version specific and may be broken by future webOS updates. Proceed with caution. If you get one that works please move it under the correct column, alphabetically, and title the page:<br />
'''"Patch [application] [description]"''' (for application specific patches) <br><br />
'''"Patch webOS [description]"''' (for patches not part of a specific application)<br />
}}<br />
This page is undergoing structuring please contribute moving or adding new entries under the appropriate headings. For now put pages in alphabetical order. Each page should contain at least the basic headings<br />
*1. '''Introduction''': A brief description to introduce people to the patch.<br />
**1.1 '''Usage''':An explanation if it is needed on how to use the modification see Add/Delete Pages in the Launcher as an example.<br />
*2. '''Editing Process''': Step by step instructions to manually edit. <br />
*3. '''Patching Process''': Details for making the edits with a patch file and pointing people to the [[Applying Patches]] page if the patch is also provided in the webos-internals gitorious repository.<br />
<br />
{{portal-three-columns<br />
|column1= <br />
===webOS Update Information===<br />
* [[Update 1.1.0|Update 1.1]]<br />
* [[Update 1.0.4|Update 1.0.4]] <br />
* [[Update 1.0.3|Update 1.0.3]]<br />
<br />
===Patches that Need Work===<br />
* [[Bugs]]<br />
<br />
|column2=<br />
===Patch Ideas to be Created or in Progress===<br />
<br />
* [[More_Calculator_Functions|Accessing additional built-in calculator functions]]<br />
* [[Add_Ability_To_Choose_Snooze_Length|Add Ability to Choose Snooze Length]]<br />
* [[Add_Icon_To_Quick_Launcher|Add an icon to the quick launcher]]<br />
* [[Changing Clipboard Data From The Shell|Changing Clipboard Data from the Shell]]<br />
* [[Development_%26_Tweak_Ideas | Development & Tweaking Ideas]]<br />
* [[Longer Vibrate|Longer Vibrate]]<br />
<br />
<br />
<br />
|column3=<br />
===Notes===<br />
These modifications lack a patch process, please add one to the details to the page and have it added to the webOS-internals gitorious repository. Info for the repository is on [[Applying Patches]].<br />
<br />
*Empty<br />
}}<br />
{{portal-three-columns<br />
|column1= <br />
==Patches to webOS apps==<br />
===webOS 1.1 OK===<br />
<br />
* [[Patch Amazon Download Music over EVDO|Amazon: Download Music over EVDO]]<br />
* [[Patch Browser Global Search Addons|Browser: Global Search Addons]]<br />
* [[Patch Browser Delete Individual History Items|Browser: Delete Individual History Items]]<br />
* [[Patch Browser Downloading Files|Browser: Downloading Files]] <br />
* [[Patch Calendar Show All-Day Events in Month View|Calendar: Show All-Day Events in Month View]] <br />
* [[Patch Camera 10 Second Countdown Timer|Camera: 10 Second Countdown Timer]]<br />
* [[Patch Camera Shutter Sound On-Off Button|Camera: Shutter Sound On-Off Button]]<br />
* [[Patch Camera Using Volume Buttons to Take a Picture|Camera: Using Volume Buttons to Take a Picture]]<br />
* [[Patch Clock Changing Alarm Button Order and Snooze Duration|Clock: Changing Alarm Button Order and Snooze Duration]]<br />
* [[Patch Clock Enabling the Hidden Theme|Clock: Enabling the Hidden Theme]]<br />
* [[Patch Email Change "Running Late" Message|Email: Change "Running Late" Message]]<br />
* [[Patch Email Confirm Deletion|Email: Confirm Deletion]]<br />
* [[Patch Email Change Default Font for Replies-Forwards from Navy to Black|Email: Change Default Font for Replies/Forwards from Navy to Black]]<br />
* [[Patch Email DeleteAll|Email: Delete All]]<br />
* [[Patch Launcher Add or Delete Pages|Launcher: Add/Delete Pages]]<br />
* [[Patch Launcher To Allow More Icons Per Row|Launcher: Allows More Icons Per Row]]<br />
* [[Patch Launcher Hide-Delete The NASCAR App|Launcher: Hide/Delete The NASCAR App]]<br />
* [[Patch Launcher Hide Media Sync Option|Launcher: Hide Media Sync Option]]<br />
* [[Patch Launcher Reset Scroll on Page Change|Launcher: Reset Scroll on Page Change]]<br />
* [[Patch Launcher Unhide the DeveloperMode App|Launcher: Unhide the DeveloperMode App]]<br />
* [[Patch Messaging Adding Timestamps to All Received Messages|Messaging: Adding Timestamps to All Received Messages]]<br />
* [[Patch Messaging Change "Enter Key" To Create Newline|Messaging: Change "Enter Key" To Create Newline]]<br />
* [[Patch Messaging Character Counter|Messaging: Character Counter]]<br />
* [[Patch Messaging Display Full Status Messages|Messaging: Display Full Status Messages]] <br />
* [[Patch Messaging Force Offline Send Without Dialog|Messaging: Force Offline Send Without Dialog]]<br />
* [[Patch Messaging Forward Messages|Messaging: Forward Messages]]<br />
* [[Patch Messaging Jump Forward, Backward One Word at a Time|Messaging: Jump Forward, Backward One Word at a Time]]<br />
* [[Patch Messaging Landscape Orientation]]<br />
<br />
* [[Patch Messaging New Cards For Each Conversation|Messaging: New Cards For Each Conversation]]<br />
* [[Patch Messaging Sounds|Messaging: Message Sound]]<br />
* [[Patch MCraig Enabling Personals Category|mCraig: Enabling Personals Category]]<br />
* [[Patch MediaPlayer Bookmarking|Music Player: Bookmarking]]<br />
* [[Patch MediaPlayer Ignore 'A', 'An', and 'The' In Artist and Album names|Music Player: Ignore 'A', 'An', and 'The' in Artist and Album Names]]<br />
* [[Patch PDF Viewer Change Orientation|PDF Viewer: Change Orientation]]<br />
* [[Patch Phone Disable Various Call Sounds|Phone: Disable Various Call Sounds]]<br />
* [[Patch Phone Edit Dialer Theme|Phone: Edit Dialer Theme]]<br />
* [[Patch Phone Editing the Lock Screen|Phone: Editing the Lock Screen]]<br />
* [[Patch Phone Show Call Duration in the Call Log|Phone: Show Call Duration in the Call Log]]<br />
* [[Patch Tasks Always Show Details of New Tasks|Tasks: Always Show Details of New Tasks]]<br />
* [[Patch WebOS Bypassing Lock Screen|Unlock: Bypass the Passcode Entry Screen]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* [[Patch Email Fix Broken Formatting|Email: Fix Broken Formatting for E-mails]]<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch Camera Remote View|Camera: Remote View]]<br />
* [[Patch Email Enable Landscape Viewing|Email: Enable Landscape Viewing]] <br />
* [[Patch Email Fix Attachments|Email: Fix Attachments]]<br />
* [[Patch Sudoku Disable Zooming|Sudoku: Disable Zooming]]<br />
<br />
<br />
|column2=<br />
==Patches not part of a specific app==<br />
===webOS 1.1 OK===<br />
* [[Patch webOS Boot Themes|Boot Themes]]<br />
* [[Patch webOS Brightness|Brightness]]<br />
* [[Patch webOS Bypassing Activation|Bypassing Activation]]<br />
* [[Patch webOS Change Carrier String|Change Carrier String]]<br />
* [[Change_the_default_notification.wav_Sound|Change the Default notification.wav Sound]]<br />
* [[Patch webOS Changing the "Turn off after X" time|Changing the "Turn off after X" Time]]<br />
* [[Patch webOS CPU Frequency or Voltage Scaling|CPU Frequency or Voltage Scaling]]<br />
* [[Patch webOS Disable Charging Event Sounds|Disable Charging Event Sounds]]<br />
* [[Patch webOS GPS Tracking|GPS Tracking]]<br />
* [[Patch webOS Graphics|Graphics]]<br />
* [[Patch webOS Hourly Chime|Hourly Chime]] <br />
* [[Patch webOS Turning Off Dialpad Noise|Turning Off Dialpad Noise]]<br />
* [[Patch webOS Keep Phone Awake While in Remote Session|Keep Phone Awake While in Remote Session]]<br />
* [[Patch webOS Logging Information from Within Scripts|Logging Information from Within Scripts]]<br />
* [[Patch webOS Modifying a Stock App While Keeping the Original|Modifying a Stock App While Keeping the Original]] <br />
* [[Patch webOS Add Words to AutoCorrect Dictionary|Modify AutoCorrect Dictionary]]<br />
* [[On Screen Keyboard]]<br />
* [[Patch webOS Radio Power Switch|Radio Power Switch]]<br />
* [[Patch webOS Random Wallpaper Switching|Random Wallpaper Switching]]<br />
* [[Patch webOS Reverse Tunnel|Reverse Tunnel]] <br />
* [[Patch webOS Roam Control|Roam Control]]<br />
* [[Patch webOS Show Actual Battery Percentage | Show Actual Battery Percentage]]<br />
* [[Screenlock On When Connected|Stay On While Connected]]<br />
* [[Make USB Partition Writable via SFTP|Make USB Partition writable via SFTP]]<br />
<br />
===Fixed in 1.1 - No longer needed===<br />
* Empty<br />
<br />
===Not 1.1 compatible===<br />
* [[Patch webOS Email App Patch to Prompt for IPK Installation|Email App Patch to Prompt for IPK Installation]] <br />
<br />
|column3=<br />
==== The following have not been checked for compatibility with webOS 1.1. ====<br />
<br />
* [[Browser_Plugins|Browser Plugins]]<br />
* [[Camera Mod Alternate Sound Disable]]<br />
* [[Changes_Alert/Notification_Sounds|Changes Alert/Notification Sounds]]<br />
* [[Myavatar In Messaging App|Myavatar In Messaging App]] <br />
* [[Photos Slideshow|Photos Slideshow]] <br />
<br />
==== The following are deprecated. They have been replaced with methods which are easier or are moot in 1.1 ====<br />
<br />
* [[Installing Homebrew Apps With A Rooted Pre|Installing Homebrew Apps With A Linux Accessed Pre]] <br />
* [[Packaging Homebrew Apps for Stock Pre without Rooting|Packaging Homebrew Apps for Stock Pre without Accessing Linux]] <br />
* [[Modifying Stock Applications|Modifying Stock Applications]] <br />
<br />
}}</div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4442Patch Browser Downloading Files2009-08-16T08:03:37Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
<br />
Edit: Anything can be downloaded in this patch, but must download directly from the download link/url.<br />
<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
<pre><br />
cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
<br />
'''-All Done Patch Applied! NO NEED TO DO ANY PORTION AT BOTTOM'''<br />
<br />
NOTE- Swipe to remove finished downloads widget at the bottom of the page, Must not be zoomed in to view<br />
<br />
==================================================================================================================<br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4441Patch Browser Downloading Files2009-08-16T07:57:42Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
<br />
Edit: Anything can be downloaded in this patch, but must download directly from the download link/url.<br />
<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
<pre><br />
cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
<br />
'''-All Done Patch Applied!'''<br />
<br />
NOTE- Swipe to remove finished downloads widget at the bottom of the page, Must not be zoomed in to view<br />
<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4440Patch Browser Downloading Files2009-08-16T07:56:48Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
Edit: Anything can be downloaded in this patch, but must download directly from the download link/url.<br />
<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
<pre><br />
cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
<br />
'''-All Done Patch Applied!'''<br />
<br />
NOTE- Swipe to remove finished downloads widget at the bottom of the page, Must not be zoomed in to view<br />
<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4439Patch Browser Downloading Files2009-08-16T07:48:58Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
Edit: Anything can be downloaded in this patch, but must download directly from the download link/url.<br />
<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
<pre><br />
cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
<br />
'''-All Done Patch Applied. No Need To Do The Bottom Portion!'''<br />
<br />
==================================================================================================================================<br />
Must be In [root@castle:/#] To Work<br />
<br />
BACK UP Files:<pre>cp /usr/palm/applications/com.palm.app.browser/sources.json /usr/palm/applications/com.palm.app.browser/sources.json.orig<br />
cp /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js.orig<br />
cp /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html.orig<br />
cp /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html.orig</pre><br />
<br />
Download PATCH:<br />
<pre>wget http://filebin.ca/xfjjme/enable-browser-downloads110.patch</pre><br />
<br />
Import PATCH into directory:<br />
<pre>quilt import enable-browser-downloads110.patch</pre><br />
Apply PATCH:<br />
<pre>quilt push enable-browser-downloads110.patch</pre><br />
FINALLY: A REBOOT<br />
<br />
<br />
NOTE- Swipe to remove finished downloads widget at the bottom of the page, Must not be zoomed in to view<br />
<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4399Patch Browser Downloading Files2009-08-15T22:07:36Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
-Ensure your list of modifications is up to date. run following commands to install patch<br />
<pre>cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
all done patch has been applied -Fritos1406<br />
<br />
<br />
<s>'''Patch still needs to be uploaded to gitorious to replace the 1.0 patch below:'''</s><br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4398Patch Browser Downloading Files2009-08-15T21:51:04Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
8/15/09 -1.1 Working Patch Up And Ready<br />
Must Be In '''[root@castle:/#]''' not '''[username@castle]''' to work !<br />
<br />
-Ensure your list of modifications is up to date. run following commands to install patch<br />
<pre>cd /opt/src/modifications<br />
git pull<br />
<br />
quilt import /opt/src/modifications/browser/enable-browser-downloads.patch<br />
<br />
cd / <br />
quilt push<br />
<br />
reboot<br />
</pre><br />
<br />
<s>'''Patch still needs to be uploaded to gitorious to replace the 1.0 patch below:'''</s><br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4391Patch Browser Downloading Files2009-08-15T16:18:36Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
'''-1.1 Working Patch Up And Ready'''<br />
<br />
-Ensure your list of modifications is up to date:<br />
<pre>cd /opt/src/modifications<br />
git pull</pre><br />
<br />
<br />
<br />
<s>'''Patch still needs to be uploaded to gitorious to replace the 1.0 patch below:'''</s><br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4388Patch Browser Downloading Files2009-08-15T09:14:10Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
'''-1.1 Working Patch Up And Ready http://gitorious.org/webos-internals/modifications/blobs/master/browser/enable-browser-downloads.patch''' <br />
<br />
<s>'''Patch still needs to be uploaded to gitorious to replace the 1.0 patch below:'''</s><br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4383Patch Browser Downloading Files2009-08-15T08:48:19Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible'''<br />
<br />
'''-1.1 Working Patch Up And Ready http://filebin.ca/xfjjme/enable-browser-downloads110.patch''' Can Someone upload it to gitorious please.<br />
<br />
'''Patch still needs to be uploaded to gitorious to replace the 1.0 patch below:'''<br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
= PATCH=<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for global_code.js, as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the global_code.js function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left the following out of the 1.1 patch update, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, also in global_code.cs (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now in 1.1 (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function (also in global_code.js) to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.<br />
=====PATCH CODE=====<br />
<pre><br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
@@ -0,0 +1,45 @@<br />
+/**<br />
+ * A dialog assistant for display of yes/no box.<br />
+ */<br />
+DownloadDialogAssistant = Class.create({<br />
+<br />
+ initialize: function(params) {<br />
+ this.onDismiss = params.onDismiss;<br />
+ this.onAccept = params.onAccept;<br />
+ this.controller= params.sceneAssistant.controller;<br />
+<br />
+ // Button handlers.<br />
+ this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
+ this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
+ },<br />
+<br />
+ setup: function(widget) {<br />
+ this.widget = widget;<br />
+ this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
+ this.controller.get('acceptButton').focus();<br />
+ this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
+ this.controller.get('dismissButton').focus();<br />
+ },<br />
+<br />
+ handleDismiss: function() {<br />
+ this.onDismiss();<br />
+ delete this.onDismiss;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+ handleAccept: function() {<br />
+ this.onAccept();<br />
+ delete this.onAccept;<br />
+ this.widget.mojo.close();<br />
+ },<br />
+<br />
+ cleanup: function() {<br />
+ Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
+ Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
+ Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
+<br />
+ // Send a dismiss if NOT already sent a response<br />
+ if (this.onDismiss) {<br />
+ this.onDismiss();<br />
+ }<br />
+ }<br />
+});<br />
Index: /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
+++ /usr/palm/applications/com.palm.app.browser/app/controllers/global_code.js<br />
@@ -1449,6 +1449,8 @@ PageAssistant.prototype.setup = function<br />
this._webView.addEventListener(Mojo.Event.webViewUrlRedirect, this._onUrlRedirect.bind(this), false);<br />
this._webView.addEventListener(Mojo.Event.webViewModifierTap, this._onModifierTapHandler, false);<br />
this._webView.addEventListener(Mojo.Event.webViewUpdateHistory, this._onUpdateHistoryHandler, false);<br />
+ this._downloadController = new DownloadController(this.controller);<br />
+ this._downloadController.setup();<br />
}<br />
catch (e) {<br />
Mojo.Log.logException(e, 'PageAssistant#setup');<br />
@@ -2287,28 +2289,39 @@ PageAssistant.prototype._newBrowserPage <br />
*/<br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
- Mojo.Log.info("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
+ Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
- // Only a few select applications can be<br />
- crossAppScene = {<br />
- 'com.palm.app.videoplayer': 'nowplaying',<br />
- 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
- };<br />
- var params = {target: uri, mimeType: mimeType};<br />
- if (crossAppScene[appid]) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ uri: uri,<br />
+ mimeType: mimeType,<br />
+ appid: appid,<br />
+ template: 'download/download-stream-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function(cParams) { // DOWNLOAD<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this),<br />
+ onAccept: function(cParams) { // STREAM<br />
+ var params = {target: uri, mimeType: mimeType, appid: appid};<br />
+ // Only a few select applications can be<br />
+ var crossAppScene = {<br />
+ 'com.palm.app.videoplayer': 'nowplaying',<br />
+ 'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
+ };<br />
+ //this._onPopupHandler('close');<br />
+ if (crossAppScene[appid]) {<br />
+ var args = { appId: appid, name: crossAppScene[appid] };<br />
+ this.controller.stageController.pushScene(args, params);<br />
+ }<br />
+ else {<br />
+ this._downloadController.downloadResource(uri);<br />
+ }<br />
+ }.bind(this)})<br />
+ });<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
<br />
- var args = { appId: appid, name: crossAppScene[appid] };<br />
- this.controller.stageController.pushScene(args, params);<br />
- }<br />
- else {<br />
- this.controller.serviceRequest('palm://com.palm.applicationManager', {<br />
- method: 'open',<br />
- parameters: {<br />
- 'id': appid,<br />
- 'params': params<br />
- }<br />
- });<br />
- }<br />
};<br />
<br />
/**<br />
@@ -2318,16 +2331,29 @@ PageAssistant.prototype._streamResource <br />
*/<br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
- Mojo.Log.info("Downloading: " + uri);<br />
+ Mojo.Log.info("Downloading: " + uri);<br />
<br />
- try {<br />
- // We should no longer download a resource but inform the user<br />
- // we are unable to perform the download.<br />
- this.controller.showAlertDialog({<br />
- onChoose: function(value) { /* Do Nothing */},<br />
- message: $L('Cannot find an application which can open this file.'),<br />
- choices:[{label:$L('OK'), value:'1', type:'dismiss'}]<br />
- });<br />
+ try {<br />
+ // We should no longer download a resource but inform the user<br />
+ // we are unable to perform the download.<br />
+ if (!this._downloadWidgetElement) {<br />
+ this._downloadWidgetElement = this.controller.showDialog({<br />
+ template: 'download/download-popup',<br />
+ assistant: new DownloadDialogAssistant({<br />
+ sceneAssistant: this,<br />
+ onDismiss: function() {<br />
+ //this._onPopupHandler('close');<br />
+ delete this._downloadWidgetElement;<br />
+ }.bind(this),<br />
+ onAccept: function() {<br />
+ //this._onPopupHandler('close');<br />
+ this._downloadController.downloadResource(uri);<br />
+ }.bind(this)})<br />
+ });<br />
+<br />
+ // Record we have a popup<br />
+ //this._onPopupHandler('open');<br />
+ }<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-container.html<br />
@@ -1,3 +1,3 @@<br />
<div x-mojo-elements="List" class="palm-list no-lines"><br />
- #{listElements}<br />
+ #{-listElements}<br />
</div><br />
\ No newline at end of file<br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
===================================================================<br />
--- /dev/null<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/download/download-stream-popup.html<br />
@@ -0,0 +1,8 @@<br />
+<div id="palm-dialog-content" class="palm-dialog-content"><br />
+ <div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
+</div><br />
+<br />
+<div class="palm-dialog-buttons"><br />
+ <div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
+ <div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
+</div><br />
Index: /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
+++ /usr/palm/applications/com.palm.app.browser/app/views/page/page-scene.html<br />
@@ -16,5 +16,9 @@<br />
<div id="server-disconnected" class="palm-scrim"> <br />
<div id="server-disconnected-spinner" x-mojo-element="Spinner"></div> <br />
</div> <br />
+<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
+ <div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
+</div><br />
+<br />
<br />
<br />
Index: /usr/palm/applications/com.palm.app.browser/sources.json<br />
===================================================================<br />
--- .orig/usr/palm/applications/com.palm.app.browser/sources.json<br />
+++ /usr/palm/applications/com.palm.app.browser/sources.json<br />
@@ -1,5 +1,17 @@<br />
-[<br />
+[ <br />
{<br />
- "source": "app\/controllers\/global_code.js"<br />
+ "source":"app\/models\/download-model.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-request.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/download-controller.js"<br />
+ },<br />
+ {<br />
+ "source":"app\/controllers\/downloaddialog-assistant.js"<br />
+ },<br />
+ {<br />
+ "source": "app\/controllers\/global_code.js"<br />
}<br />
]<br />
</pre></div>Fritos1406http://wiki.webos-internals.org/index.php?title=Patch_Browser_Downloading_Files&diff=4371Patch Browser Downloading Files2009-08-15T04:35:09Z<p>Fritos1406: </p>
<hr />
<div>{{template:patch}}<br />
<br />
'''NOTE -- This is newly 1.1 compatible, but the Patch file linked below has not been updated. Anybody wanna do that for me?'''<br />
<br />
'''-1.1 Working Patch Up And Ready http://filebin.ca/xfjjme/enable-browser-downloads110.patch'''<br />
<br />
'''ANOTHER NOTE -- I haven't extensively tested the 1.1 version of the changes. I've confirmed that it works for mp3s, but not other filetypes yet.'''<br />
<br />
As of 2009/07/06, all parts of this modification have been incorporated into the patch file at http://gitorious.org/webos-internals/modifications/blobs/raw/master/browser/enable-browser-downloads.patch.<br />
<br />
If further modifications are made, but for whatever reason the patch cannot be updated according to the steps at [[Applying Patches]], please place these changes above the "PATCH" line so that someone else can incorporate them into the patch (and then note that they have been incorporated)<br />
<br />
'''NOTE''' from dizzwave -- sorry I didn't follow this rule, but since so much stuff got moved around, I didn't see the point of moving everything above the PATCH line. I hope that's ok.<br />
<br />
This patch file contains all of the modifications described below the PATCH line, as well as a typo correction (believe it or not, mimeByExtenstion '''IS''' correct, see the following output if you don't believe it):<br />
<br />
<pre><nowiki><br />
luna-send -n 1 palm://com.palm.applicationManager/getResourceInfo '{"uri":"http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/TWiT0202H.mp3"}'<br />
</nowiki></pre><br />
'''NOTE''' They seem to have fixed that typo in 1.1. :)<br />
<br />
<br />
Also included is a change to DownloadDialogAssistant that clears out the onDismiss function when streaming. Otherwise, anytime you selected stream, the file would be downloaded as well (in the cleanup function).<br />
<br />
It would be good if the developers contributing code could get gitorious accounts and keep this patch updated ...A<br />
<br />
Note: WOW! I used this a lot before and can't wait to use it post-1.1. How do I apply it from Quilt? I don't see it listed there.<br />
<br />
Reply: Yep, i haven't updated the patch yet, just the code changing instructions. I'll try to get on that! -dizz<br />
= PATCH=<br />
<br />
<br />
NOTE: 6/24/2009<br />
chris_phelps merged all of the sections from mdklein back into one set of directions. If you have already done the first part, you will have to figure out what is left for yourself.<br />
<br />
NOTE: 8/11/2009 (dizzwave) Making some minor changes to the code below so as to work with 1.1. My changes in '''bold''', with the old stuff <s>struckthrough</s>, for clarity (and to help whoever fixes up the patch file!:)).<br />
<br />
<br />
During some of my initial digging in the Browser application, I discovered that Palm developers had left quite a bit of code in place to enable downloading via the web interface. User mdklein was interested in the same fix at the same time (6/22/2009), so we shared information as we moved forward.<br />
<br />
'''CODE'''<br />
The first step is to enable the required javascript sources through sources.json:<br />
<br />
<pre><nowiki><br />
{<br />
"source":"app\/models\/download-model.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-request.js"<br />
},<br />
{<br />
"source":"app\/controllers\/download-controller.js"<br />
},<br />
{<br />
"source":"app\/controllers\/downloaddialog-assistant.js"<br />
},<br />
</nowiki></pre><br />
<br />
I put them directly before the import for <s>page-assistant.js</s>'''global_code.js''', as that is where they will be used from.<br />
<br />
<br />
Next, at the end of the <s>app/controllers/page-assistant.js</s>'''global_code.js''' function "PageAssistant.prototype.setup" (right before the ''} catch(e){...)'':<br />
<br />
<pre><nowiki><br />
this._downloadController = new DownloadController(this.controller);<br />
this._downloadController.setup();<br />
</nowiki></pre><br />
<br />
'''SUCCESS''' - 6/24/2009<br />
mdklein has fixed the infinite loop bug with browsers and unknown filetypes. It's a simple modification. Please let me know if this breaks anything...<br />
<br />
'''I left this out for now, since that part of the browser code has changed since 1.0, and we might not need it. (Works for mp3s, anyway... might need to be refactored yet.)'''<br />
<s><br />
in page-assistant.js change the if statement "&& response.mimeByExtenstion" is added to verify we know it's a mime type. (yes, Palm typoed)<br />
writing it this way in case they fix the typo in the future.<br />
<pre><nowiki><br />
// Yes, palm, I caught your typo... writing it this way in case you fix it? function returns mimeByExtenstion... guessing it should be mimeByExtension<br />
if (response.returnValue && response.canStream && (response.mimeByExtenstion||response.mimeByExtension)) {<br />
this._streamResource(event.url, response.appIdByExtension, (response.mimeByExtenstion||response.mimeByExtenstion));<br />
}<br />
<br />
</nowiki></pre><br />
</s> <br />
<br />
And then the downloadResource function, '''also in global_code.cs''' (note that we are now presenting a confirmation dialog). Replace the current function with this:<br />
<pre><nowiki><br />
PageAssistant.prototype._downloadResource = function(uri) {<br />
<br />
Mojo.Log.info("Downloading: " + uri);<br />
<br />
try {<br />
// We should no longer download a resource but inform the user<br />
// we are unable to perform the download.<br />
if (!this._downloadWidgetElement) {<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
template: 'download/download-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function() {<br />
//this._onPopupHandler('close');<br />
delete this._downloadWidgetElement;<br />
}.bind(this),<br />
onAccept: function() {<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this)})<br />
});<br />
<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
}<br />
} catch (e) {<br />
Mojo.Log.logException(e, "#_downloadResource");<br />
}<br />
<br />
// Hide the address bar.<br />
this._addressBar.hide();<br />
this._webView.mojo.focus();<br />
};<br />
</nowiki></pre><br />
'''NOTE I commented out the lines that called _onPopupHandler, since there seems to be no such handler now (that I could find), and it didn't seem to matter.'''<br />
<br />
Now we change the PageAssistant.prototype._streamResource function ('''also in global_code.js''') to this:<br />
<pre><nowiki><br />
PageAssistant.prototype._streamResource = function(uri, appid, mimeType){<br />
<br />
Mojo.Log.error("Streaming: '%s' with '%s' (%s)", uri, appid, mimeType);<br />
<br />
this._downloadWidgetElement = this.controller.showDialog({<br />
uri: uri,<br />
mimeType: mimeType,<br />
appid: appid,<br />
template: 'download/download-stream-popup',<br />
assistant: new DownloadDialogAssistant({<br />
sceneAssistant: this,<br />
onDismiss: function(cParams) { // DOWNLOAD<br />
//this._onPopupHandler('close');<br />
this._downloadController.downloadResource(uri);<br />
}.bind(this),<br />
onAccept: function(cParams) { // STREAM<br />
var params = {target: uri, mimeType: mimeType, appid: appid};<br />
// Only a few select applications can be<br />
var crossAppScene = {<br />
'com.palm.app.videoplayer': 'nowplaying',<br />
'com.palm.app.streamingmusicplayer': 'nowplaying'<br />
};<br />
//this._onPopupHandler('close');<br />
if (crossAppScene[appid]) {<br />
var args = { appId: appid, name: crossAppScene[appid] };<br />
this.controller.stageController.pushScene(args, params);<br />
}<br />
else {<br />
this._downloadController.downloadResource(uri);<br />
}<br />
}.bind(this)})<br />
});<br />
// Record we have a popup<br />
//this._onPopupHandler('open');<br />
<br />
};<br />
</nowiki></pre><br />
'''NOTE again that I commented out the _onPopupHandler calls.'''<br />
<br />
<br />
Then we add a new file /usr/palm/applications/com.palm.app.browser/app/controllers/downloaddialog-assistant.js<br />
<pre><nowiki><br />
/**<br />
* A dialog assistant for display of yes/no box.<br />
*/<br />
DownloadDialogAssistant = Class.create({<br />
<br />
initialize: function(params) {<br />
this.onDismiss = params.onDismiss;<br />
this.onAccept = params.onAccept;<br />
this.controller= params.sceneAssistant.controller;<br />
<br />
// Button handlers.<br />
this.onDismissHandler = this.handleDismiss.bindAsEventListener(this);<br />
this.onAcceptHandler = this.handleAccept.bindAsEventListener(this);<br />
},<br />
<br />
setup: function(widget) {<br />
this.widget = widget;<br />
this.controller.get('acceptButton').addEventListener(Mojo.Event.tap, this.onAcceptHandler);<br />
this.controller.get('acceptButton').focus();<br />
this.controller.get('dismissButton').addEventListener(Mojo.Event.tap, this.onDismissHandler);<br />
this.controller.get('dismissButton').focus();<br />
},<br />
<br />
handleDismiss: function() {<br />
this.onDismiss();<br />
delete this.onDismiss;<br />
this.widget.mojo.close();<br />
},<br />
handleAccept: function() {<br />
this.onAccept();<br />
delete this.onAccept;<br />
this.widget.mojo.close();<br />
},<br />
<br />
cleanup: function() {<br />
Mojo.Log.info("NetworkDialogAssistant#cleanup()");<br />
Mojo.Event.stopListening(this.controller.get('dismissButton'), Mojo.Event.tap, this.onDismissHandler);<br />
Mojo.Event.stopListening(this.controller.get('acceptButton'), Mojo.Event.tap, this.onAcceptHandler);<br />
<br />
// Send a dismiss if NOT already sent a response<br />
if (this.onDismiss) {<br />
this.onDismiss();<br />
}<br />
}<br />
});<br />
</nowiki></pre><br />
<br />
<br />
'''RESOURCES'''<br />
That is all the "code" that needs to be fixed. The rest would be considered resources.<br />
<br />
you also need a /usr/palm/applications/com.palm.app.browser/app/views/download/download-popup.html<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc=""> Cannot find an application which can open this file. Would you like to download it to /media/internal/downloads?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Yes</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">No</div><br />
</div><br />
</nowiki></pre><br />
<br />
In app/views/page/page-scene.html, we append:<br />
<br />
<pre><nowiki><br />
<div id="downloadListScroller" class="browser-download" x-mojo-element="Scroller"><br />
<div id="downloadList" class="palm-list" x-mojo-element="List"></div><br />
</div><br />
</nowiki></pre><br />
<br />
and then in app/views/download/download-container.html, replace the contents with:<br />
'''NOTE: the 1.0 version did not have a '-' before "listElements", but we need that hyphen there.'''<br />
<pre><nowiki><br />
#{-listElements}<br />
</nowiki></pre><br />
<br />
<br />
You will also need to create download-stream-popup.html in app/views/download:<br />
<pre><nowiki><br />
<div id="palm-dialog-content" class="palm-dialog-content"><br />
<div class="dialog-message" x-mojo-loc="">This file type has been registered as a streaming media file. Would you like to download it to /media/internal/downloads instead?</div><br />
</div><br />
<br />
<div class="palm-dialog-buttons"><br />
<div class="dismiss palm-button" id="acceptButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Stream</div><br />
<div class="dismiss palm-button" id="dismissButton" x-mojo-loc="" x-mojo-tap-highlight="momentary">Download</div><br />
</div><br />
</nowiki></pre><br />
<br />
<br />
<br />
<br />
'''IMPORTANT NOTES:'''<br />
<br />
The download widgets will be added to the bottom of the currently rendered page. If you are zoomed in, you probably won't be able to see them.<br />
<br />
Swipe-to-delete works, but not the way you think. The widget will disappear, but the download will finish if it has not already, and will persist afterward. You will have to use a PC and mount the mass storage controller to remove downloads later.<br />
<br />
<br />
<br />
<br />
<br />
<br />
'''SUCCESS''' - 6/23/2009<br />
chris_phelps has completed a "Download" feature that creates it's own Scene for completed downloads in the browser.<br />
<br />
[[Image:Dl-browser1.png]]<br />
[[Image:Dl-browser2.png]]<br />
[[Image:Dl-browser3.png]]<br />
<br />
This however, was not the correct way to do things as the system is already keeping track of all downloads in it's own database. chris_phelps will be moving the code created specifically for the Download scene in the browser application into it's own application. Expect this by the end of the day maybe (6/24/2009) depending on how good the weather gets.</div>Fritos1406