Skip to content
Browse files

first commit

Change-Id: Ie8614a68d61c550f38d93f54bdf2964319bab988
  • Loading branch information...
0 parents commit 149fadcd046b50925cea1ebfb0500167af32e58b @anupamkaul anupamkaul committed
Showing with 4,214 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +24 −0 appinfo.json
  3. +362 −0 css/browser.css
  4. +11 −0 db/kinds/com.palm.browserbookmarks
  5. +11 −0 db/kinds/com.palm.browserhistory
  6. +8 −0 db/kinds/com.palm.browserpreferences
  7. +29 −0 db/permissions/com.palm.browserbookmarks
  8. +18 −0 db/permissions/com.palm.browserhistory
  9. +12 −0 db/permissions/com.palm.browserpreferences
  10. +41 −0 depends.js
  11. BIN icon-256x256.png
  12. BIN icon.png
  13. BIN images/background-bookmarks-grid.png
  14. BIN images/background-startpage.png
  15. BIN images/bookmark-icon-default.png
  16. BIN images/bookmark-icon-frame.png
  17. BIN images/bookmark-info-icon.png
  18. BIN images/bookmark-overlay.png
  19. BIN images/chrome/button-menu.png
  20. BIN images/chrome/drag-handle.png
  21. BIN images/chrome/filter-search-highlight.png
  22. BIN images/chrome/list-divider.png
  23. BIN images/chrome/menu-icon-add.png
  24. BIN images/chrome/menu-icon-back.png
  25. BIN images/chrome/menu-icon-bookmark.png
  26. BIN images/chrome/menu-icon-forward.png
  27. BIN images/chrome/menu-icon-newcard.png
  28. BIN images/chrome/menu-icon-refresh.png
  29. BIN images/chrome/menu-icon-share.png
  30. BIN images/chrome/menu-icon-stop.png
  31. BIN images/chrome/palm-popup-background.png
  32. BIN images/chrome/progress-bar-inner.png
  33. BIN images/chrome/progress-bar.png
  34. BIN images/chrome/radiobutton.png
  35. BIN images/chrome/search-results-background.png
  36. BIN images/chrome/secure-lock.png
  37. BIN images/chrome/toaster-icon-bookmarks.png
  38. BIN images/chrome/toaster-icon-downloads.png
  39. BIN images/chrome/toaster-icon-history.png
  40. BIN images/chrome/url-pill.png
  41. BIN images/header-icon-bookmarks.png
  42. BIN images/header-icon-history.png
  43. BIN images/header-icon-prefs.png
  44. BIN images/list-icon-bing.png
  45. BIN images/list-icon-google.png
  46. BIN images/list-icon-wikipedia.png
  47. BIN images/mime-icon-audio.png
  48. BIN images/mime-icon-download.png
  49. BIN images/mime-icon-image.png
  50. BIN images/mime-icon-pdf.png
  51. BIN images/mime-icon-ppt.png
  52. BIN images/mime-icon-txt.png
  53. BIN images/mime-icon-vcard.png
  54. BIN images/mime-icon-video.png
  55. BIN images/mime-icon-word.png
  56. BIN images/mime-icon-xls.png
  57. BIN images/palm-popup-background.png
  58. BIN images/startpage-placeholder.png
  59. +28 −0 index.html
  60. +15 −0 mock/browserApp_bookmarksService.json
  61. +15 −0 mock/browserApp_bookmarks_bookmarksService.json
  62. +21 −0 mock/browserApp_browserPrefsService.json
  63. +34 −0 mock/browserApp_findBookmarks.json
  64. +41 −0 mock/browserApp_findHistory.json
  65. +41 −0 mock/browserApp_historyService.json
  66. +41 −0 mock/browserApp_history_historyService.json
  67. +15 −0 mock/browserApp_startPage_actionbar_search_bookmarksService.json
  68. +35 −0 mock/browserApp_startPage_actionbar_search_historyService.json
  69. +6 −0 mock/browserApp_startPage_addressbar_bookmarksService.json
  70. +24 −0 mock/browserApp_startPage_addressbar_historyService.json
  71. +80 −0 source/AcceptCancelPopup.js
  72. +123 −0 source/ActionBar.js
  73. +140 −0 source/AddressInput.js
  74. +99 −0 source/BookmarkDialog.js
  75. +78 −0 source/BookmarkList.js
  76. +508 −0 source/Browser.js
  77. +652 −0 source/BrowserApp.js
  78. +64 −0 source/BrowserContextMenu.js
  79. +45 −0 source/BrowserPrompt.js
  80. +223 −0 source/CertificateDetail.js
  81. +130 −0 source/DownloadList.js
  82. +57 −0 source/FindBar.js
  83. +142 −0 source/HistoryList.js
  84. +66 −0 source/MimeIcon.js
  85. +24 −0 source/NoFocusButton.js
  86. +151 −0 source/Preferences.js
  87. +29 −0 source/ProgressItem.js
  88. +75 −0 source/StartPage.js
  89. +266 −0 source/URLSearch.js
  90. +28 −0 source/VerticalAcceptCancelPopup.js
  91. +23 −0 source/clipboard.js
  92. +324 −0 source/tld.js
  93. +54 −0 source/util.js
1 .gitignore
@@ -0,0 +1 @@
+resources/
24 appinfo.json
@@ -0,0 +1,24 @@
+{
+ "id": "com.palm.app.browser",
+ "version": "1.0.0",
+ "vendor": "HP",
+ "type": "web",
+ "main": "index.html",
+ "title": "Web",
+ "keywords" : [ "web", "Browser", "Blazer", "Internet" ],
+ "icon": "icon.png",
+ "splashicon": "icon-256x256.png",
+ "uiRevision": 2,
+ "tapToShareSupported":true,
+ "universalSearch": {
+ "dbsearch": {
+ "displayName":"Bookmarks & History",
+ "url":"com.palm.app.browser",
+ "launchParam":"url",
+ "launchParamDbField":"url",
+ "displayFields": ["title", "url"],
+ "dbQuery": [{"method":"search","params":{"query":{"from":"com.palm.browserbookmarks:1","where":[{"prop":"searchText","op":"?","val":"","collate":"primary"}],"limit":20}}},{"method":"search","params":{"query":{"from":"com.palm.browserhistory:1","where":[{"prop":"searchText","op":"?","val":"","collate":"primary"}],"limit":50}}}],
+ "batchQuery":true
+ }
+ }
+}
362 css/browser.css
@@ -0,0 +1,362 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+/* Start Page */
+
+.startpage-list .enyo-datalist-client {
+ display: inline-block;
+ vertical-align: middle;
+}
+
+.startpage-list-item: {
+ display: inline-block;
+}
+
+.startpage {
+ background: #313131 url(../images/background-startpage.png) center center no-repeat ;
+ -webkit-background-size: 100% 100%;
+ height: 1024px;
+ /*
+ background-color: #323232;
+ background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 250, from(#5c5d5f), color-stop(0.1, #3c3c3c), to(#101010));
+ */
+}
+
+.startpage .startpage-placeholder {
+ background: url(../images/startpage-placeholder.png) 50% 50% no-repeat;
+}
+
+.startpage .startpage-placeholder-tall {
+ height: 1024px;
+}
+
+/* AddressBar */
+
+.actionbar.enyo-toolbar {
+ height: 54px;
+ border-width: 2px 0;
+}
+
+.actionbar .enyo-tool-button .enyo-button-icon {
+ margin: 2px;
+}
+
+.actionbar .menu-container {
+ padding: 1px 4px 0;
+}
+
+.actionbar-tool-button {
+ padding: 0;
+}
+
+.page-title {
+ width: 620px;
+ margin: 0 auto;
+ padding-right: 10px;
+ text-align: center;
+ color: white;
+ font-size: .65em;
+ font-weight: bold;
+}
+
+.addressbar {
+ margin: 0 10px;
+}
+
+.addressbar input {
+ font-size: 15px;
+ color: #ccc;
+}
+
+.addressbar .enyo-tool-input-focus input {
+ color: #333;
+}
+
+.addressbar .enyo-input.enyo-tool-input .enyo-input-input:focus {
+ color: #e5e5e5;
+}
+
+.addressbar .enyo-tool-input-spacing {
+ margin: -7px 0;
+}
+
+.search-button.enyo-button-down {
+ background-position: 0 -34px;
+}
+
+.addressbar-button {
+ width: 32px;
+ height: 32px;
+ position: relative;
+ right: -6px;
+}
+
+.go-button {
+ background: url(../images/chrome/menu-icon-go.png) 0 0 no-repeat;
+}
+
+.go-button.enyo-button-down {
+ background-position: 0 32px;
+}
+
+.refresh-button {
+ background: url(../images/chrome/menu-icon-refresh.png) 0 1px no-repeat;
+}
+
+.refresh-button.enyo-button-down {
+ background-position: 0 -31px;
+}
+
+.stop-button {
+ background: url(../images/chrome/menu-icon-stop.png) 0 1px no-repeat;
+}
+
+.stop-button.enyo-button-down {
+ background-position: 0 -31px;
+}
+
+.secure-lock {
+ background: url(../images/chrome/secure-lock.png) center center no-repeat;
+ width: 32px;
+ height: 32px;
+ position: relative;
+ left: -3px;
+}
+
+.enyo-button-disabled .enyo-button-icon {
+ opacity: .5;
+}
+
+.addressbar-popup {
+ position: absolute;
+ width: 100%;
+ margin: -36px 0;
+ border-width: 24px;
+ -webkit-border-image: url(../images/chrome/search-results-background.png) 24 24 24 24 repeat;
+ -webkit-box-sizing: border-box;
+}
+
+.addressbar-popup-inner {
+ margin: 0 -16px -15px -16px;
+ padding-bottom: 12px;
+}
+
+.transparent-scrim {
+ opacity: 0;
+}
+
+.addressbar-providerslist {
+ min-height: 10px;
+}
+
+.addressbar-provider-title,
+.addressbar-search-title {
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ line-height: 32px;
+ padding: 0 12px;
+}
+
+.addressbar-providerslist .enyo-item {
+ border: 0;
+}
+
+.addressbar-popup-divider {
+ background: silver;
+ height: 2px;
+ border-bottom: 1px solid #fff;
+}
+
+.addressbar-highlight {
+ background: url(../images/chrome/filter-search-highlight.png) bottom left repeat-x;
+}
+
+/* Progress bar */
+
+.url-progress.enyo-progress-bar {
+ -webkit-border-image: none;
+ border-width: 0;
+ height: 4px;
+ background: url(../images/chrome/progress-bar.png) 0 0 repeat-x;
+ width: 100%;
+ z-index: 10;
+ top: 2px;
+
+ -webkit-transition: opacity 1s;
+ opacity: 1;
+}
+.progress-bar.completed {
+ opacity: 0;
+ display: none;
+}
+.url-progress .enyo-progress-bar-inner {
+ -webkit-border-image: none;
+ margin: 0;
+ height: 4px;
+ background: url(../images/chrome/progress-bar-inner.png) 0 0 repeat-x;
+}
+.url-progress.invisible {
+ opacity: 0;
+}
+
+/* Browser */
+
+.browser-dialog-body enyo-text-body {
+ word-wrap: break-word;
+}
+
+/* Toaster */
+
+.enyo-toaster .enyo-header {
+ height: 54px;
+}
+
+.enyo-toaster .enyo-header-inner {
+ padding: 5px 13px;
+}
+
+.enyo-toaster .basic-back {
+ background-color: #e5e5e5;
+}
+
+.enyo-toaster .enyo-toolbar {
+ height: 56px; /* avoid the toolbar w/ no buttons gets a few px shorter */
+}
+
+.enyo-toaster .enyo-radiobutton.enyo-button-depressed .enyo-button-icon,
+.enyo-toaster .enyo-radiobutton.enyo-button-down .enyo-button-icon,
+.enyo-toaster .enyo-tabbutton.enyo-button-depressed .enyo-button-icon,
+.enyo-toaster .enyo-tabbutton.enyo-button-down .enyo-button-icon {
+ background-position: 0 -32px;
+}
+
+.toaster-item {
+ padding: 8px 3px 8px 11px;
+}
+
+.toaster-item .enyo-confirmprompt .enyo-button {
+ min-width:100px;
+}
+
+.item-image {
+ width: 46px;
+ height: 46px;
+ margin: 4px;
+}
+
+.item-thumb-container {
+ position: relative;
+ width: 52px;
+ height: 52px;
+}
+
+.item-image-frame {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 52px;
+ height: 52px;
+ background: url(../images/bookmark-icon-frame.png) 1px 2px no-repeat;
+}
+
+.bookmark-edit {
+ padding: 11px; /* make the tappable area to 48x48 */
+}
+
+/* History */
+
+/* Downloads */
+
+.dl-toaster-item {
+ padding: 8px 11px;
+ min-height: 60px;
+}
+
+.dl-item-image {
+ width: 36px;
+ height: 36px;
+ margin-top: 4px;
+}
+.dl-item-title {
+ padding: 0 8px 0 6px;
+}
+.dl-toaster-item .enyo-progress-button {
+ font-size: .8em;
+ min-height: 30px;
+}
+
+.dl-toaster-item .enyo-progress-button-cancel {
+ margin-top: 0;
+}
+
+.item-progress {
+ margin-right: 2px;
+}
+
+/* List Items for Site Titles and URLs (search pop and bookmarks) */
+
+.url-item-title {
+ padding: 0 0 0 12px;
+}
+
+.url-item-url {
+ padding: 0 0 0 12px;
+ line-height: 18px;
+}
+
+.url-item-image {
+ vertical-align: middle;
+ margin-top: 6px;
+}
+
+/* Progress Menu Button */
+
+.progress-menu-button-icon {
+ display: inline-block;
+ margin: -5px -24px 0px -24px;
+ width: 48px;
+ height: 48px;
+ vertical-align: middle;
+}
+
+/* Preferences */
+
+.preferences-header {
+ height: 58px;
+ max-height: 58px;
+}
+
+.preferences-header .enyo-header-inner {
+ padding: 3px 12px;
+}
+
+.preferences-header-image {
+ padding-right: 10px;
+}
+
+.enyo-preferences-box .enyo-button,
+.preference-prompt .enyo-button {
+ margin: 6px 3px;
+}
+
+/* Misc */
+
+.launch-popup {
+ margin-top: 5px;
+}
+
+.enyo-gemstone.enyo-item.enyo-held {
+ background-repeat: repeat-x;
+}
11 db/kinds/com.palm.browserbookmarks
@@ -0,0 +1,11 @@
+{
+ "id":"com.palm.browserbookmarks:1",
+ "owner":"com.palm.app.browser",
+ "indexes":[ {"name":"rev","props":[{"name":"_rev"}]},
+ {"name": "url", "props": [{"name": "url"}] },
+ {"name": "title", "props": [{"name": "title"}] },
+ {"name": "search", "props": [{"name":"searchText", "type":"multi","collate":"primary","include":[{"name":"title","tokenize":"all"},{"name":"url","tokenize":"all"}]}]},
+ {"name": "defaultEntry", "props": [{"name": "defaultEntry"}] },
+ {"name": "idx", "props": [{"name": "idx"}] }],
+ "sync": true
+}
11 db/kinds/com.palm.browserhistory
@@ -0,0 +1,11 @@
+{
+ "id":"com.palm.browserhistory:1",
+ "owner":"com.palm.app.browser",
+ "indexes":[ {"name": "url", "props": [{"name": "url"}] },
+ {"name": "title", "props": [{"name": "title"}] },
+ {"name": "search", "props": [{"name":"searchText", "type":"multi", "collate":"primary","include":[{"name":"title","tokenize":"all"},
+ {"name":"url","tokenize":"all"}]}]},
+ {"name": "date", "props": [{"name": "date"}] },
+ {"name": "revision", "props": [{"name": "_rev"}] }],
+ "sync": true
+}
8 db/kinds/com.palm.browserpreferences
@@ -0,0 +1,8 @@
+{
+ "id":"com.palm.browserpreferences:1",
+ "owner":"com.palm.app.browser",
+ "indexes": [
+ {"name":"key", "props":[{"name":"key"}]}
+ ],
+ "sync": true
+}
29 db/permissions/com.palm.browserbookmarks
@@ -0,0 +1,29 @@
+[
+ { "type" : "db.kind"
+ , "object" : "com.palm.browserbookmarks:1"
+ , "caller" : "com.palm.app.enyo-browser"
+ , "operations":
+ { "create": "allow"
+ , "read" : "allow"
+ , "update": "allow"
+ , "delete": "allow"
+ }
+ },
+ { "type" : "db.kind"
+ , "object" : "com.palm.browserbookmarks:1"
+ , "caller" : "com.palm.launcher"
+ , "operations":
+ { "read" : "allow"
+ }
+ },
+ { "type" : "db.kind"
+ , "object" : "com.palm.browserbookmarks:1"
+ , "caller" : "com.palm.service.customization"
+ , "operations":
+ { "create": "allow"
+ , "read" : "allow"
+ , "update": "allow"
+ , "delete": "allow"
+ }
+ }
+]
18 db/permissions/com.palm.browserhistory
@@ -0,0 +1,18 @@
+[ { "type" : "db.kind"
+ , "object" : "com.palm.browserhistory:1"
+ , "caller" : "com.palm.app.enyo-browser"
+ , "operations":
+ { "create": "allow"
+ , "read" : "allow"
+ , "update": "allow"
+ , "delete": "allow"
+ }
+ },
+ { "type" : "db.kind"
+ , "object" : "com.palm.browserhistory:1"
+ , "caller" : "com.palm.launcher"
+ , "operations":
+ { "read" : "allow"
+ }
+ }
+]
12 db/permissions/com.palm.browserpreferences
@@ -0,0 +1,12 @@
+[
+ { "type" : "db.kind"
+ , "object" : "com.palm.browserpreferences:1"
+ , "caller" : "com.palm.app.enyo-browser"
+ , "operations":
+ { "create": "allow"
+ , "read" : "allow"
+ , "update": "allow"
+ , "delete": "allow"
+ }
+ }
+]
41 depends.js
@@ -0,0 +1,41 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.depends(
+ "$enyo-lib/printdialog/",
+ "css/browser.css",
+ "source/ActionBar.js",
+ "source/URLSearch.js",
+ "source/AddressInput.js",
+ "source/FindBar.js",
+ "source/StartPage.js",
+ "source/Preferences.js",
+ "source/Browser.js",
+ "source/BookmarkList.js",
+ "source/CertificateDetail.js",
+ "source/HistoryList.js",
+ "source/MimeIcon.js",
+ "source/DownloadList.js",
+ "source/ProgressItem.js",
+ "source/BrowserApp.js",
+ "source/BrowserContextMenu.js",
+ "source/AcceptCancelPopup.js",
+ "source/VerticalAcceptCancelPopup.js",
+ "source/BrowserPrompt.js",
+ "source/BookmarkDialog.js",
+ "source/NoFocusButton.js",
+ "source/clipboard.js",
+ "source/util.js",
+ "source/tld.js"
+);
BIN icon-256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/background-bookmarks-grid.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/background-startpage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/bookmark-icon-default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/bookmark-icon-frame.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/bookmark-info-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/bookmark-overlay.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/button-menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/drag-handle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/filter-search-highlight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/list-divider.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-add.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-back.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-bookmark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-forward.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-newcard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-refresh.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-share.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/menu-icon-stop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/palm-popup-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/progress-bar-inner.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/progress-bar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/radiobutton.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/search-results-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/chrome/secure-lock.png
Diff not rendered.
BIN images/chrome/toaster-icon-bookmarks.png
Diff not rendered.
BIN images/chrome/toaster-icon-downloads.png
Diff not rendered.
BIN images/chrome/toaster-icon-history.png
Diff not rendered.
BIN images/chrome/url-pill.png
Diff not rendered.
BIN images/header-icon-bookmarks.png
Diff not rendered.
BIN images/header-icon-history.png
Diff not rendered.
BIN images/header-icon-prefs.png
Diff not rendered.
BIN images/list-icon-bing.png
Diff not rendered.
BIN images/list-icon-google.png
Diff not rendered.
BIN images/list-icon-wikipedia.png
Diff not rendered.
BIN images/mime-icon-audio.png
Diff not rendered.
BIN images/mime-icon-download.png
Diff not rendered.
BIN images/mime-icon-image.png
Diff not rendered.
BIN images/mime-icon-pdf.png
Diff not rendered.
BIN images/mime-icon-ppt.png
Diff not rendered.
BIN images/mime-icon-txt.png
Diff not rendered.
BIN images/mime-icon-vcard.png
Diff not rendered.
BIN images/mime-icon-video.png
Diff not rendered.
BIN images/mime-icon-word.png
Diff not rendered.
BIN images/mime-icon-xls.png
Diff not rendered.
BIN images/palm-popup-background.png
Diff not rendered.
BIN images/startpage-placeholder.png
Diff not rendered.
28 index.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+
+<!-- Copyright 2012 Hewlett-Packard Development Company, L.P. -->
+<!>
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
+<!-- you may not use this file except in compliance with the License. -->
+<!-- You may obtain a copy of the License at-->
+<!>
+<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
+<!>
+<!-- Unless required by applicable law or agreed to in writing, software -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
+<!-- See the License for the specific language governing permissions and -->
+<!-- limitations under the License. -->
+
+<html>
+<head>
+ <title>Web</title>
+ <script src="../../enyo/0.10/framework/enyo.js" type="text/javascript"></script>
+ <!--<script src="/media/work/git/enyo-dev/framework/enyo.js" type="text/javascript" launch="debug"></script>//-->
+</head>
+<body>
+<script type="text/javascript">
+ enyo.create({kind: "BrowserApp"}).renderInto(document.body);
+</script>
+</body>
+</html>
15 mock/browserApp_bookmarksService.json
@@ -0,0 +1,15 @@
+{
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ }
+ ],
+ "returnValue": true
+}
15 mock/browserApp_bookmarks_bookmarksService.json
@@ -0,0 +1,15 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ }
+ ]
+}
21 mock/browserApp_browserPrefsService.json
@@ -0,0 +1,21 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "key": "blockPopups",
+ "value": true
+ },
+ {
+ "key": "acceptCookies",
+ "value": true
+ },
+ {
+ "key": "enableJavascript",
+ "value": true
+ },
+ {
+ "key": "rememberPasswords",
+ "value": true
+ }
+ ]
+}
34 mock/browserApp_findBookmarks.json
@@ -0,0 +1,34 @@
+{results: [
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"}
+]}
41 mock/browserApp_findHistory.json
@@ -0,0 +1,41 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300224386683
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300138094718
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1299878924431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1297459724431
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1294781324431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 0
+ }
+ ]
+}
41 mock/browserApp_historyService.json
@@ -0,0 +1,41 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300224386683
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300138094718
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1299878924431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1297459724431
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1294781324431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 0
+ }
+ ]
+}
41 mock/browserApp_history_historyService.json
@@ -0,0 +1,41 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300224386683
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1300138094718
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1299878924431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1297459724431
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 1294781324431
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png",
+ "date": 0
+ }
+ ]
+}
15 mock/browserApp_startPage_actionbar_search_bookmarksService.json
@@ -0,0 +1,15 @@
+{
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/bookmark-icon-default.png"
+ }
+ ],
+ "returnValue": true
+}
35 mock/browserApp_startPage_actionbar_search_historyService.json
@@ -0,0 +1,35 @@
+{
+ "returnValue": true,
+ "results": [
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ },
+ {
+ "title": "Google",
+ "url": "http://www.google.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ },
+ {
+ "title": "CNN",
+ "url": "http://www.cnn.com",
+ "thumbnailFile": "images/header-icon-history.png"
+ }
+ ]
+}
6 mock/browserApp_startPage_addressbar_bookmarksService.json
@@ -0,0 +1,6 @@
+{results: [
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "Google", url: "http://www.google.com", thumbnailFile: "images/bookmark-icon-default.png"},
+ {title: "CNN", url: "http://www.cnn.com", thumbnailFile: "images/bookmark-icon-default.png"}
+]}
24 mock/browserApp_startPage_addressbar_historyService.json
@@ -0,0 +1,24 @@
+{
+ results: [
+ {
+ title: "Google",
+ url: "http://www.google.com",
+ thumbnailFile: "images/header-icon-history.png"
+ },
+ {
+ title: "CNN",
+ url: "http://www.cnn.com",
+ thumbnailFile: "images/header-icon-history.png"
+ },
+ {
+ title: "Google",
+ url: "http://www.google.com",
+ thumbnailFile: "images/header-icon-history.png"
+ },
+ {
+ title: "CNN",
+ url: "http://www.cnn.com",
+ thumbnailFile: "images/header-icon-history.png"
+ }
+ ]
+}
80 source/AcceptCancelPopup.js
@@ -0,0 +1,80 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "AcceptCancelPopup",
+ kind: "ModalDialog",
+ published: {
+ acceptCaption: $L("OK"),
+ cancelCaption: $L("Cancel")
+ },
+ events: {
+ onAccept: "",
+ onResponse: ""
+ },
+ chrome: [
+ {className: "enyo-modaldialog-container", components: [
+ {name: "modalDialogTitle", className: "enyo-modaldialog-title"},
+ {name: "client"},
+ {kind: enyo.HFlexBox, components: [
+ {name: "cancel", kind: "NoFocusButton", flex: 1, onclick: "cancelClick"},
+ {name: "accept", kind: "NoFocusButton", className: "enyo-button-dark", flex: 1, onclick: "acceptClick"}
+ ]}
+ ]}
+ ],
+ //* @protected
+ accepted: false,
+ componentsReady: function() {
+ this.inherited(arguments);
+ this.acceptCaptionChanged();
+ this.cancelCaptionChanged();
+ },
+ acceptCaptionChanged: function() {
+ if (this.acceptCaption) {
+ this.$.accept.setCaption(this.acceptCaption);
+ this.$.accept.show();
+ } else {
+ this.$.accept.hide();
+ }
+ },
+ cancelCaptionChanged: function() {
+ if (this.cancelCaption) {
+ this.$.cancel.setCaption(this.cancelCaption);
+ this.$.cancel.show();
+ } else {
+ this.$.cancel.hide();
+ }
+ },
+ acceptClick: function() {
+ this.accepted = true;
+ this.doAccept();
+ this.close();
+ },
+ cancelClick: function() {
+ this.accepted = false;
+ this.close();
+ },
+ prepareClose: function() {
+ this.inherited(arguments);
+ this.sendResponse(this.accepted);
+ },
+ sendResponse: function(inAccepted) {
+ this.doResponse(this.accepted);
+ },
+ //* @public
+ openPopup: function(inMsg) {
+ this.accepted = false;
+ this.openAtCenter();
+ },
+});
123 source/ActionBar.js
@@ -0,0 +1,123 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "ActionBar",
+ kind: enyo.VFlexBox,
+ defaultKind: "ToolButton",
+ pack: "center",
+ className: "enyo-toolbar actionbar",
+ published: {
+ url: "",
+ title: "",
+ canGoBack: false,
+ canGoForward: false,
+ canShare: true,
+ searchPreferences: {},
+ defaultSearch: "",
+ progress: 0,
+ loading: false
+ },
+ events: {
+ onBack: "",
+ onForward: "",
+ onLoad: "",
+ onStopLoad: "",
+ onRefresh: "",
+ onAddBookmark: "",
+ onAddToLauncher: "",
+ onShareLink: "",
+ onOpenBookmarks: "",
+ onNewCard: ""
+ },
+ components: [
+ {kind: "Control", showing: false, name: "title", className: "page-title enyo-text-ellipsis", content: "Untitled"},
+ {kind: enyo.HFlexBox, className: "menu-container", align: "center", components: [
+ {kind: "ToolButton", name: "back", className: "actionbar-tool-button", icon: "images/chrome/menu-icon-back.png", onclick: "doBack"},
+ {kind: "ToolButton", name: "forward", className: "actionbar-tool-button", icon: "images/chrome/menu-icon-forward.png", onclick: "doForward"},
+ {kind: "ToolButton", name: "search", className: "actionbar-tool-button", flex: 1, kind: "URLSearch", onLoad: "doLoad", onStopLoad: "doStopLoad", onRefresh: "doRefresh"},
+ {kind: "ToolButton", name: "share", className: "actionbar-tool-button", icon: "images/chrome/menu-icon-share.png", onclick: "showSharePopup"},
+ {kind: "ToolButton", className: "actionbar-tool-button", icon: "images/chrome/menu-icon-newcard.png", onclick: "doNewCard"},
+ {kind: "ToolButton", className: "actionbar-tool-button", icon: "images/chrome/menu-icon-bookmark.png", onclick: "doOpenBookmarks"},
+ ]},
+ {name: "sharePopup", className: "launch-popup", kind: "Menu", components: [
+ {caption: $L("Add Bookmark"), onclick: "doAddBookmark"},
+ {caption: $L("Share Link"), onclick: "doShareLink"},
+ {caption: $L("Add to Launcher"), onclick: "doAddToLauncher"}
+ ]},
+ {name: "progressBar", kind: "ProgressBar", className: "url-progress invisible", animatePosition: false},
+ ],
+ //* @public
+ resize: function() {
+ this.$.search.resize();
+ },
+ forceFocus: function() {
+ this.$.search.forceFocus();
+ },
+ forceBlur: function() {
+ this.$.search.closeSearchPopup();
+ },
+ //* @protected
+ create: function() {
+ this.inherited(arguments);
+ this.urlChanged();
+ this.titleChanged();
+ this.canGoBackChanged();
+ this.canGoForwardChanged();
+ this.canShareChanged();
+ this.loadingChanged();
+ },
+ urlChanged: function() {
+ this.$.search.setUrl(this.url);
+ },
+ titleChanged: function() {
+ this.$.title.setContent(this.title || $L("Untitled"));
+ },
+ canGoBackChanged: function() {
+ this.$.back.setDisabled(!this.canGoBack);
+ },
+ canGoForwardChanged: function() {
+ this.$.forward.setDisabled(!this.canGoForward);
+ },
+ canShareChanged: function() {
+ this.$.share.setDisabled(!this.canShare);
+ },
+ searchPreferencesChanged: function() {
+ this.$.search.setSearchPreferences(this.searchPreferences);
+ },
+ defaultSearchChanged: function() {
+ this.$.search.setDefaultSearch(this.defaultSearch);
+ },
+ showSharePopup: function(inSender, inEvent) {
+ this.$.sharePopup.openAt({top: -1000});
+ var pop = this.$.sharePopup.getBounds();
+ this.$.sharePopup.close();
+ this.$.sharePopup.openAtControl(this.$.share, {left: -pop.width+10, top: 26});
+ },
+ progressChanged: function() {
+ this.$.progressBar.setPosition(this.progress);
+ },
+ loadingChanged: function() {
+ this.$.search.setLoading(this.loading);
+ if (this.loading) {
+ if (this.$.progressBar.hasClass("invisible")) {
+ this.$.progressBar.removeClass("invisible");
+ }
+ } else {
+ if (!this.$.progressBar.hasClass("invisible")) {
+ this.$.progressBar.addClass("invisible");
+ }
+ }
+ },
+});
140 source/AddressInput.js
@@ -0,0 +1,140 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "AddressInput",
+ kind: enyo.HFlexBox,
+ align: "center",
+ published: {
+ url: "",
+ loading: false
+ },
+ events: {
+ onBlur: "",
+ onInputChange: "",
+ onGo: "",
+ onStop: "",
+ onRefresh: ""
+ },
+ chrome: [
+
+ {kind: "InputBox", layoutKind: "HFlexLayout", flex: 1, className: "enyo-tool-input", focusClassName: "enyo-tool-input-focus", spacingClassName: "enyo-tool-input-spacing", components: [
+ {name: "secureLock", kind: enyo.CustomButton, showing: false, className: "secure-lock"},
+
+ {name: "userinput", kind: "Input", flex: 1, styled: false, inputType: "url", width: "100%", spellcheck: false, autocorrect: false, autoCapitalize: "lowercase", autoWordComplete: false, hint: $L("Enter URL or search terms"), selectAllOnFocus: true,
+ onfocus: "selectInput",
+ onblur: "deselectInput",
+ onkeydown: "inputKeydown",
+ oninput: "inputChange",
+ },
+ {name: "refreshButton", kind: "CustomButton", showing: false, className: "addressbar-button refresh-button", onclick: "doRefresh"},
+ {name: "clearButton", kind: "CustomButton", showing: true, className: "addressbar-button stop-button", onmousedown: "clearInput"},
+ {name: "stopButton", kind: "CustomButton", showing: false, className: "addressbar-button stop-button", onclick: "doStop"}
+ ]}
+ ],
+ //* @protected
+ _leftButton: "",
+ _rightButton: "clearButton",
+ selectInput: function() {
+ this.changeButtons();
+ },
+ deselectInput: function() {
+ if (this.$.userinput.getValue() === "") {
+ this.$.userinput.setValue(this.url);
+ }
+ this.changeButtons();
+ this.doBlur();
+ },
+ inputChange: function(inSender, inEvent, inValue) {
+ this.changeButtons();
+ this.doInputChange(inValue);
+ },
+ inputKeydown: function(inSender, inEvent) {
+ if (inEvent.keyCode == 13) {
+ this.go();
+ }
+ },
+ urlChanged: function() {
+ if (this.url) {
+ if (!this.hasFocus()) {
+ this.$.userinput.setValue(this.url);
+ }
+ this.changeButtons();
+ }
+ },
+ loadingChanged: function() {
+ this.changeButtons();
+ },
+ changeButtons: function() {
+ this.showLeftButton("");
+ if (this.hasFocus() && this.$.userinput.getValue().length >= 0) {
+ this.showRightButton("clearButton");
+ } else {
+ if (this.url.toLowerCase().substring(0, 8) === "https://") {
+ this.showLeftButton("secureLock");
+ }
+ if (this.loading) {
+ this.showRightButton("stopButton");
+ } else {
+ this.showRightButton("refreshButton");
+ }
+ }
+ },
+
+ // need an IxD for secure lock icon (wireframe b5)
+ showLeftButton: function(inButton) {
+ this.showButton(inButton, this._leftButton);
+ this._leftButton = inButton;
+ },
+
+ showRightButton: function(inButton) {
+ this.showButton(inButton, this._rightButton);
+ this._rightButton = inButton;
+ },
+ showButton: function(inButton, inOldButton) {
+ if (inOldButton !== "") {
+ this.$[inOldButton].hide();
+ }
+ if (inButton !== "") {
+ this.$[inButton].show();
+ }
+ },
+ go: function() {
+ this.setLoading(true);
+ var value = this.getUserInput(true);
+ this.doGo(value);
+ // XXX: I dunno why I have to do this
+ document.activeElement.blur();
+ },
+ getUserInput: function(inRaw) {
+ var value = enyo.string.trim(this.$.userinput.getValue());
+ if (!inRaw) {
+ return enyo.string.escapeHtml(value);
+ } else {
+ return value;
+ }
+ },
+ clearInput: function() {
+ this.$.userinput.setValue("");
+ // XXX: input is blurred here causing the keyboard to reappear
+ this.$.userinput.forceFocus();
+ },
+ forceFocus: function() {
+ this.$.userinput.forceFocus();
+ },
+ //* public
+ hasFocus: function() {
+ return document.activeElement.tagName == "INPUT";
+ }
+});
99 source/BookmarkDialog.js
@@ -0,0 +1,99 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "BookmarkDialog",
+ kind: "ModalDialog",
+ published: {
+ title: "",
+ url: "",
+ icons: {},
+ id: "",
+ acceptCaption: ""
+ },
+ events: {
+ onAccept: ""
+ },
+ components: [
+ {components: [
+ {className: "item-thumb-container", style: "margin: 0 auto 8px", components: [
+ {name: "icon", className: "item-image", kind: "Image"},
+ {className: "item-image-frame"}
+ ]},
+ ]},
+ {name: "titleInput", kind: "Input", hint: " ", insetClass: "enyo-flat-shadow", onkeydown: "inputKeydown", selectAllOnFocus: true},
+ {name: "urlInput", kind: "Input", inputType: "url", hint: " ", insetClass: "enyo-flat-shadow", selectAllOnFocus: true, autoCapitalize:"lowercase"},
+ {kind: enyo.VFlexBox, components: [
+ {name: "acceptButton", flex: 1, kind: "NoFocusButton", className: "enyo-button-dark", onclick: "acceptClick"},
+ {kind: "NoFocusButton", flex: 1, caption: $L("Cancel"), onclick: "cancelClick"}
+ ]}
+ ],
+ componentsReady: function() {
+ this.inherited(arguments);
+ this.titleChanged();
+ this.iconsChanged();
+ this.urlChanged();
+ this.acceptCaptionChanged();
+ },
+ inputKeydown: function(inSender, inEvent) {
+ if (inEvent.keyCode == 13) {
+ this.acceptClick();
+ return true;
+ }
+ },
+ titleChanged: function() {
+ if (!this.lazy) {
+ this.$.titleInput.setValue(this.title);
+ }
+ },
+ urlChanged: function() {
+ if (!this.lazy) {
+ this.$.urlInput.setValue(this.url);
+ }
+ },
+ iconsChanged: function() {
+ if (!this.lazy) {
+ if (this.icons.iconFile64) {
+ this.$.icon.setSrc(this.icons.iconFile64);
+ } else {
+ this.$.icon.setSrc("images/bookmark-icon-default.png");
+ }
+ }
+ },
+ acceptCaptionChanged: function() {
+ if (!this.lazy) {
+ this.$.acceptButton.setCaption(this.acceptCaption);
+ }
+ },
+ getTitle: function() {
+ return this.$.titleInput.getValue();
+ },
+ getUrl: function() {
+ return this.$.urlInput.getValue();
+ },
+ acceptClick: function() {
+ var t = enyo.string.escapeHtml(this.getTitle());
+ var u = enyo.string.escapeHtml(this.getUrl());
+ this.doAccept(t, u, this.icons, this.getId());
+ this.close();
+ },
+ cancelClick: function() {
+ this.close();
+ },
+ close: function() {
+ this.inherited(arguments);
+ this.$.titleInput.forceBlur();
+ this.$.urlInput.forceBlur();
+ }
+});
78 source/BookmarkList.js
@@ -0,0 +1,78 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "BookmarkList",
+ kind: enyo.VFlexBox,
+ flex: 1,
+ className: "basic-back",
+ events: {
+ onSelectItem: "",
+ onEditItem: "",
+ onDeleteItem: "",
+ onAddBookmark: "",
+ onClose: "",
+ },
+ components: [
+ {name: "bookmarksService", kind: "DbService", dbKind: "com.palm.browserbookmarks:1", reCallWatches: true, method: "find", onSuccess: "gotBookmarksData", subscribe: true, onWatch:"refreshList"},
+ {name: "list", kind: "DbList", flex: 1, desc: true, onQuery:"bookmarksQuery", onSetupRow: "listSetupRow", components: [
+ {name: "item", kind: "SwipeableItem", className: "toaster-item", layoutKind: "HFlexLayout", align: "center", tapHighlight: true, onclick: "itemClick", onConfirm: "deleteItem", components: [
+ {className: "item-thumb-container", components: [
+ {name: "icon", className: "item-image", kind: "Image"},
+ {className: "item-image-frame"}
+ ]},
+ {kind: "VFlexBox", flex: 1, pack: "center", components: [
+ {name: "title", className: "url-item-title enyo-text-ellipsis"},
+ {name: "url", className: "url-item-url enyo-item-ternary enyo-text-ellipsis"}
+ ]},
+ {name: "infoIcon", className: "bookmark-edit", kind: "Image", src: "images/bookmark-info-icon.png", onclick: "itemEdit"}
+ ]}
+ ]},
+ {kind: "Toolbar", components: [
+ {kind: "GrabButton", onclick: "doClose"},
+ {flex: 1, kind: "Control"},
+ {icon: "images/chrome/menu-icon-add.png", onclick: "doAddBookmark", style: "margin-right:10px; top:1px"}
+ ]}
+ ],
+ listSetupRow: function(inSender, inRowItem, inIndex) {
+ this.$.item.domStyles["border-top"] = inIndex == 0 ? "0" : null;
+ var icon = inRowItem.iconFile32 || inRowItem.thumbnailFile;
+ this.$.icon.showing = Boolean(icon);
+ this.$.icon.domAttributes.src = icon;
+ this.$.title.content = inRowItem.title || "";
+ this.$.url.content = inRowItem.url || "";
+ },
+ itemClick: function(inSender, inEvent, inIndex) {
+ var msg = this.$.list.fetch(inIndex);
+ this.doSelectItem(msg);
+ },
+ itemEdit: function(inSender, inEvent) {
+ var msg = this.$.list.fetch(inEvent.rowIndex);
+ this.doEditItem(msg);
+ return true;
+ },
+ deleteItem: function(inSender, inIndex) {
+ var msg = this.$.list.fetch(inIndex);
+ this.doDeleteItem(msg);
+ },
+ gotBookmarksData: function(inSender, inResponse, inRequest) {
+ this.$.list.queryResponse(inResponse,inRequest);
+ },
+ bookmarksQuery: function(inSender, inQuery) {
+ return this.$.bookmarksService.call({query:inQuery});
+ },
+ refreshList: function(inSender, inWatch) {
+ this.$.list.refresh();
+ }
+});
508 source/Browser.js
@@ -0,0 +1,508 @@
+// Copyright 2012 Hewlett-Packard Development Company, L.P.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+enyo.kind({
+ name: "Browser",
+ kind: enyo.VFlexBox,
+ className: "basic-back",
+ published: {
+ url: "",
+ searchPreferences: {},
+ defaultSearch: ""
+ },
+ events: {
+ onPageTitleChanged: "",
+ onPageLoadStopped: "",
+ onFileLoad: "",
+ onAddBookmark: "",
+ onAddToLauncher: "",
+ onShareLink: "",
+ onOpenBookmarks: "",
+ onPrint: "",
+ onUrlRedirected: "",
+ // called when user wants to leave the browser
+ onClose: ""
+ },
+ components: [
+ {name: "launchApplicationService", kind: enyo.PalmService, service: enyo.palmServices.application, method: "open"},
+ {name: "importWallpaperService", kind: enyo.PalmService, service: enyo.palmServices.system, method: "wallpaper/importWallpaper", onSuccess: "importedWallpaper", onFailure: "wallpaperError"},
+ {name: "setWallpaperService", kind: enyo.PalmService, service: enyo.palmServices.system, method: "setPreferences", onFailure: "wallpaperError"},
+ {name: "actionbar", kind: "ActionBar",
+ onBack: "goBack",
+ onForward: "goForward",
+ onLoad: "goClick",
+ onStopLoad: "stopClick",
+ onRefresh: "reloadClick",
+ onAddBookmark: "doAddBookmark",
+ onAddToLauncher: "doAddToLauncher",
+ onShareLink: "doShareLink",
+ onOpenBookmarks: "doOpenBookmarks",
+ onNewCard: "openNewCard"
+ },
+ {name: "view", kind: "WebView", flex: 1, height: "100%",
+ onMousehold: "openContextMenu",
+ onPageTitleChanged: "pageTitleChanged",
+ onUrlRedirected: "doUrlRedirected",
+ onLoadStarted: "loadStarted",
+ onLoadProgress: "loadProgress",
+ onLoadStopped: "loadStopped",
+ onLoadComplete: "loadCompleted",
+ onFileLoad: "doFileLoad",
+ onError: "browserError",
+ onSingleTap: "browserTap",
+ onAlertDialog: "showAlertDialog",
+ onConfirmDialog: "showConfirmDialog",
+ onPromptDialog: "showPromptDialog",
+ onSSLConfirmDialog: "showSSLConfirmDialog",
+ onUserPasswordDialog: "showUserPasswordDialog",
+ onNewPage: "openNewCardWithIdentifier",
+ onPrint: "doPrint",
+ minFontSize: 2,
+ },
+ {kind: "FindBar", showing: false, onFind: "find", onGoToPrevious: "goToPrevious", onGoToNext: "goToNext"},
+ {name: "context", kind: "BrowserContextMenu", onItemClick: "contextItemClick"},
+ {name: "dialog", kind: "VerticalAcceptCancelPopup", cancelCaption: "", components: [
+ {name: "dialogTitle", className: "enyo-dialog-prompt-title"},
+ {name: "dialogMessage", className: "browser-dialog-body enyo-text-body "}
+ ]},
+ {name: "alertDialog", kind: "AcceptCancelPopup", cancelCaption: "", onResponse: "sendDialogResponse", components: [
+ {name: "alertMessage", className: "browser-dialog-body enyo-text-body "}
+ ]},
+ {name: "confirmDialog", kind: "VerticalAcceptCancelPopup", onResponse: "sendDialogResponse", components: [
+ {name: "confirmMessage", className: "browser-dialog-body enyo-text-body "}
+ ]},
+ {name: "promptDialog", kind: "AcceptCancelPopup", cancelCaption: "", onResponse: "promptResponse", onClose: "closePrompt", components: [
+ {name: "promptMessage", className: "browser-dialog-body enyo-text-body "},
+ {name: "promptInput", kind: "Input", spellcheck: false, autocorrect: false, autoCapitalize: "lowercase"}
+ ]},
+ {name: "loginDialog", kind: "AcceptCancelPopup", onResponse: "loginResponse", onClose: "closeLogin", components: [
+ {name: "loginMessage", className: "browser-dialog-body enyo-text-body "},
+ {name: "userInput", kind: "Input", spellcheck: false, autocorrect: false, autoCapitalize: "lowercase", hint: $L("Username...")},
+ {name: "passwordInput", kind: "PasswordInput", hint: $L("Password...")}
+ ]},
+ {name: "sslDialog", kind: "Popup", onClose: "sslConfirmResponse", components: [
+ {name: "sslConfirmMessage", className: "browser-dialog-body enyo-text-body "},
+ {kind: enyo.HFlexBox, components: [
+ {kind: "Button", name: "viewCertButton", flex: 1, caption: $L("View Certificate"), className: "enyo-button-dark", onclick: "viewSSLCertificate"},
+ {kind: "Button", flex: 1, caption: $L("Trust Always"), response: "1", className: "enyo-button-dark", onclick: "closeSSLConfirmBox"},
+ {kind: "Button", flex: 1, caption: $L("Trust Once"), response: "2", className: "enyo-button-dark", onclick: "closeSSLConfirmBox"},
+ {kind: "Button", flex: 1, caption: $L("Don't Trust"), response: "0", className: "enyo-button-dark", onclick: "closeSSLConfirmBox"}
+ ]}
+ ]},
+ {name: "sslCertDialog", kind: "CertificateDialog", onCertLoad: "enableViewSSLCertificate", onClose: "closeSSLCertificate"}
+ ],
+ WebKitErrors: {
+ ERR_SYS_FILE_DOESNT_EXIST: 14,
+ ERR_WK_FLOADER_CANCELLED: 1000,
+ ERR_WK_NOINTERNET:1005,
+ ERR_CURL_FAILURE: 2000,
+ ERR_CURL_COULDNT_RESOLVE_HOST: 2006,
+ ERR_CURL_SSL_CACERT: 2060
+ },
+ create: function() {
+ this.inherited(arguments);
+ this.$.context.setView(this.$.view);
+ this.urlChanged();
+ this.searchPreferencesChanged();
+ this.defaultSearchChanged();
+ if (window.PalmSystem) {
+ this.$.view.setIdentifier(enyo.windowParams.webviewId);
+ }
+ },
+ resize: function() {
+ this.$.actionbar.resize();
+ this.$.view.resize();
+ },
+ showingChanged: function() {
+ this.inherited(arguments);
+ if (!this.showing) {
+ this.$.actionbar.forceBlur();
+ }
+ },
+ //* @public
+ printFrame: function(inJobID, inPrintParams) {
+ this.viewCall("printFrame", ["", inJobID, inPrintParams.width, inPrintParams.height, inPrintParams.pixelUnits, false, inPrintParams.renderInReverseOrder]);
+ },
+ showFind: function() {
+ this.$.findBar.show();
+ },
+ //* @protected
+ find: function(inSender, inString) {
+ this.log(inString);
+ this.$.view.callBrowserAdapter("findInPage", [inString]);
+ },
+ goToPrevious: function() {
+ },
+ goToNext: function() {
+ },
+ setEnableJavascript: function(inEnable) {
+ this.viewCall("setEnableJavascript", [inEnable]);
+ },
+ setBlockPopups: function(inBlock) {
+ this.viewCall("setBlockPopups", [inBlock]);
+ },
+ setAcceptCookies: function(inAccept) {
+ this.viewCall("setAcceptCookies", [inAccept]);
+ },
+ clearHistory: function() {
+ this.viewCall("clearHistory");
+ },
+ clearCookies: function() {
+ new PalmServiceBridge().call('palm://com.palm.browserServer/clearCookies', '{}');
+ },
+ clearCache: function() {
+ new PalmServiceBridge().call('palm://com.palm.browserServer/clearCache', '{}');
+ },
+ isLoading: function() {
+ return this.$.actionbar.getProgress() != 0;
+ },
+ viewCall: function(inMethod, inArgs) {
+ if (window.PalmSystem) {
+ var v = this.$.view;
+ if (v[inMethod]) {
+ v[inMethod].apply(v, inArgs);
+ } else {
+ v.callBrowserAdapter(inMethod, inArgs);
+ }
+ }
+ },
+ urlChanged: function() {
+ this.log(this.url);
+ this.$.view.setUrl(this.url);
+ this.$.actionbar.setLoading(true);
+ this.$.actionbar.setUrl(this.url);
+ },
+ searchPreferencesChanged: function() {
+ this.$.actionbar.setSearchPreferences(this.searchPreferences);
+ },
+ defaultSearchChanged: function() {
+ this.$.actionbar.setDefaultSearch(this.defaultSearch);
+ },
+ pageTitleChanged: function(inSender, inTitle, inUrl, inBack, inForward) {
+ this.log(inUrl, inTitle, inBack, inForward);
+ this.url = inUrl;
+ this.title = inTitle || $L("Untitled");
+ if (!this.$.dialog.isOpen) {
+ this.$.actionbar.setUrl(this.url);
+ this.$.actionbar.setTitle(this.title);
+ }
+ this.gotHistoryState(inBack, inForward);
+ this.doPageTitleChanged(this.title, this.url);
+ },
+ gotHistoryState: function(inBack, inForward) {
+ this.canGoBack = inBack;
+ this.$.actionbar.setCanGoBack(inBack);
+ this.$.actionbar.setCanGoForward(inForward);
+ },
+ goClick: function(inSender, inUrl) {
+ //this.$.popup.openAtTap({centerX: 100, centerY: 100});
+ this.setUrl(inUrl);
+ //this.showHideTitle(true);
+ },
+ browserTap: function(inSender, inPosition, inEvent, inTapInfo) {
+ },
+ showPopup: function(inPopup) {
+ var w = enyo.fetchControlSize(this).w;
+ inPopup.applyStyle("max-width", w - 100);
+ inPopup.openPopup();
+ },
+ showAlertDialog: function(inSender, inMsg) {
+ this.$.alertDialog.validateComponents();
+ this.$.alertMessage.setContent(inMsg);
+ this.showPopup(this.$.alertDialog);
+ },
+ showConfirmDialog: function(inSender, inMsg) {
+ this.$.confirmDialog.validateComponents();
+ this.$.confirmMessage.setContent(inMsg);
+ this.showPopup(this.$.confirmDialog);
+ },
+ showPromptDialog: function(inSender, inMsg, inDefaultValue) {
+ this.$.promptDialog.validateComponents();
+ this.$.promptMessage.setContent(inMsg);
+ this.$.promptInput.setValue("");
+ this.$.promptInput.setHint(inDefaultValue);
+ this.showPopup(this.$.promptDialog);
+ },
+ promptResponse: function(inAccept) {
+ this.sendDialogResponse(this, inAccept, this.$.promptInput.getValue() || this.$.promptInput.getHint());
+ },
+ closePrompt: function() {
+ this.$.promptInput.forceBlur();
+ },
+ showSSLConfirmDialog: function(inSender, inHost, inErrorCode, inCertFile) {
+ this.$.sslDialog.validateComponents();
+ this.$.viewCertButton.setDisabled(true);
+ this.$.sslCertDialog.setCertFile(inCertFile);
+ var msg;
+ if (inErrorCode == 0) {
+ msg = $L("The security certificate #{websiteName} sent is expired. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode >= 2 && inErrorCode < 5) {
+ msg = $L("The website #{websiteName} didn't send a security certificate to identify itself. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode >= 5 && inErrorCode < 10) {
+ msg = $L("The security certificate #{websiteName} sent could not be read completely. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode >= 10 && inErrorCode < 18) {
+ msg = $L("The security certificate #{websiteName} sent has some invalid information. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode >= 18 && inErrorCode < 24) {
+ msg = $L("The security certificate #{websiteName} sent has questionable signatures. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode >= 24 && inErrorCode < 30) {
+ msg = $L("The security certificate #{websiteName} sent is invalid. Connecting to this site might put your confidential information at risk.");
+ } else if (inErrorCode == 30 || inErrorCode == 31 || inErrorCode == 50) {
+ msg = $L("The security certificate #{websiteName} sent has inconsistent information in it. Connecting to this site might put your confidential information at risk.");
+ }
+ if (msg) {
+ var m = msg.replace("#{websiteName}", inHost);
+ this.$.sslConfirmMessage.setContent(m);
+ }
+ this.$.sslDialog.response = "0";
+ this.$.sslDialog.openAtCenter();
+ },
+ closeSSLConfirmBox: function(inSender) {
+ this.$.sslDialog.response = inSender.response;
+ this.$.sslDialog.close();
+ },
+ sslConfirmResponse: function(inSender) {
+ this.viewCall("sendDialogResponse", [inSender.response]);
+ },
+ enableViewSSLCertificate: function() {
+ this.$.viewCertButton.setDisabled(false);
+ },
+ viewSSLCertificate: function(inSender) {
+ this.$.sslCertDialog.validateComponents();
+ this.$.sslCertDialog.openAtCenter();
+ },
+ closeSSLCertificate: function(inSender) {
+ this.$.sslCertDialog.close();
+ },
+ showUserPasswordDialog: function(inSender, inMsg) {
+ this.$.loginDialog.validateComponents();
+ var msg = $L("The server {$serverName} requires a username and password");
+ msg = enyo.macroize(msg, {serverName: inMsg});
+ this.$.loginMessage.setContent(msg);
+ this.showPopup(this.$.loginDialog);
+ },
+ loginResponse: function(inSender, inAccept) {
+ this.sendDialogResponse(this, inAccept, this.$.userInput.getValue(), this.$.passwordInput.getValue());
+ },
+ sendDialogResponse: function(inSender, inAccepted) {
+ this.log(inAccepted);
+ if (inAccepted) {
+ this.viewCall("acceptDialog", [].slice.call(arguments, 2));
+ } else {
+ this.viewCall("cancelDialog");
+ }
+ },
+ closeLogin: function() {
+ this.$.userInput.forceBlur();
+ this.$.passwordInput.forceBlur();
+ },
+ openContextMenu: function(inSender, inEvent, inTapInfo) {
+ if (inTapInfo.isLink || inTapInfo.isImage) {
+ this.$.context.openAtTap(inEvent, inTapInfo);
+ return true;
+ }
+ },
+ contextItemClick: function(inSender, inValue, inTapInfo, inPosition) {
+ if (this[inValue]) {
+ this[inValue](inTapInfo, inPosition);
+ }
+ },
+ newCardClick: function(inTapInfo) {
+ enyo.windows.openWindow("index.html", null, {url: inTapInfo.linkUrl});
+ },
+ openNewCard: function() {
+ enyo.windows.openWindow("index.html", null, null);
+ },
+ openNewCardWithIdentifier: function(inSender, inIdentifier) {
+ enyo.windows.openWindow("index.html", null, {webviewId: inIdentifier});
+ },
+ copyLinkClick: function(inTapInfo) {
+ enyo.dom.setClipboard(inTapInfo.linkUrl);
+ var params = enyo.json.stringify({dontLaunch:true});
+ enyo.windows.addBannerMessage($L("Link Copied to clipboard"), params);
+ },
+ shareLinkClick: function(inTapInfo) {
+ this.shareLink(inTapInfo.linkUrl, inTapInfo.linkText || inTapInfo.linkUrl);
+ },
+ shareLink: function(inUrl, inTitle) {
+ this.log(inUrl, inTitle);
+ var msg = $L("Here's a website I think you'll like: <a href=\"{$src}\">{$title}</a>");
+ msg = enyo.macroize(msg, {src: inUrl, title: inTitle || inUrl});
+ var params = {
+ summary: $L("Check out this web page..."),
+ text: msg
+ };
+ this.log(params.text);
+ this.$.launchApplicationService.call({id: "com.palm.app.email", params: params});
+ },
+ copyToPhotosClick: function(inTapInfo, inPosition) {
+ this.viewCall("saveImageAtPoint", [inPosition.left, inPosition.top, "/media/internal",
+ enyo.hitch(this, "finishCopyToPhotos", inTapInfo)]);
+ },
+ shareImageClick: function(inTapInfo, inPosition) {
+ this.viewCall("saveImageAtPoint", [inPosition.left, inPosition.top, "/tmp",
+ enyo.hitch(this, "finishShareImage", inTapInfo)]);
+ },
+ setWallpaperClick: function(inTapInfo, inPosition) {
+ this.viewCall("saveImageAtPoint", [inPosition.left, inPosition.top, "/media/internal",
+ enyo.hitch(this, "finishSetWallpaper", inTapInfo)]);
+ },
+ openDialog: function(inTitle, inMessage) {
+ this.$.dialog.validateComponents();
+ this.$.dialogTitle.setContent(inTitle);
+ this.$.dialogMessage.setContent(inMessage);
+ this.$.dialog.openPopup();
+ },
+ finishCopyToPhotos: function(inTapInfo, inSuccess, inPath) {
+ var params = enyo.json.stringify({dontLaunch:true});
+ if (inSuccess) {
+ enyo.windows.addBannerMessage($L("Image Saved to Photos"),params);
+ } else {
+ enyo.windows.addBannerMessage($L("Error Saving Image"),params);
+ }
+ },
+ finishShareImage: function(inTapInfo, inSuccess, inPath) {
+ if (inSuccess) {
+ var url = inTapInfo.imageUrl;
+ var defaultTitle = url.indexOf("data:") >= 0 ? $L("Picture Link") : $L("Picture at ") + url;
+ var title = inTapInfo.title || inTapInfo.altText || defaultTitle;
+ var msg = $L("Here's a picture I think you'll like: <a href='{$src}'>{$title}</a>");
+ msg = enyo.macroize(msg, {src: url, title: title});
+ var s = url.lastIndexOf("/") + 1;
+ var params = {
+ summary: $L("Check out this picture..."),
+ text: msg,
+ attachments: [{name: url.substring(s), path: inPath}]
+ };
+ this.$.launchApplicationService.call({id: "com.palm.app.email", params: params});
+ } else {
+ var p = enyo.json.stringify({dontLaunch:true});
+ enyo.windows.addBannerMessage($L("Error Sharing Image"),p);
+ }
+ },
+ finishSetWallpaper: function(inTapInfo, inSuccess, inPath) {
+ if (inSuccess) {
+ this.$.importWallpaperService.call({target: inPath, scale: 1.0});
+ } else {
+ var p = enyo.json.stringify({dontLaunch:true});
+ enyo.windows.addBannerMessage($L("Error Setting Wallpaper"),p);
+ }
+ },
+ importedWallpaper: function(inSender, inResponse) {
+ this.$.setWallpaperService.call({wallpaper: inResponse.wallpaper});