Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7490 from dscravag/nightly2

Nightly 2012-11-10
  • Loading branch information...
commit 9d4983b18d5ff79b5900a8075d38eea352635728 2 parents f8e15c1 + 726a738
@dscravag dscravag authored
Showing with 3,285 additions and 1,380 deletions.
  1. +1 −0  .gitignore
  2. +1 −1  Makefile
  3. +5 −0 apps/browser/js/authentication_dialog.js
  4. +45 −47 apps/browser/js/browser.js
  5. +6 −1 apps/browser/js/modal_dialog.js
  6. +3 −0  apps/browser/style/browser.css
  7. +52 −0 apps/calendar/js/app.js
  8. +1 −0  apps/calendar/js/db.js
  9. +29 −27 apps/calendar/js/ext/caldav.js
  10. +2 −0  apps/calendar/js/provider/local.js
  11. +2 −1  apps/calendar/js/service/caldav.js
  12. +9 −5 apps/calendar/js/templates/account.js
  13. +13 −5 apps/calendar/js/templates/calendar.js
  14. +17 −7 apps/calendar/js/templates/day.js
  15. +15 −4 apps/calendar/js/templates/week.js
  16. +10 −2 apps/calendar/js/views/months_day.js
  17. +10 −1 apps/calendar/js/views/time_header.js
  18. +3 −1 apps/calendar/locales/calendar.en-US.properties
  19. +53 −0 apps/calendar/test/unit/app_test.js
  20. +2 −1  apps/calendar/test/unit/service/caldav_test.js
  21. +17 −0 apps/calendar/test/unit/templates/calendar_test.js
  22. +14 −1 apps/calendar/test/unit/views/months_day_test.js
  23. +13 −0 apps/calendar/test/unit/views/time_header_test.js
  24. +9 −9 apps/camera/js/camera.js
  25. +3 −2 apps/clock/index.html
  26. +6 −47 apps/clock/style/clock.css
  27. +11 −4 apps/communications/contacts/js/contacts_details.js
  28. +10 −6 apps/communications/contacts/js/contacts_settings.js
  29. +6 −1 apps/communications/contacts/style/app.css
  30. +29 −1 apps/communications/contacts/style/contacts.css
  31. BIN  apps/communications/contacts/style/images/icon-fav-button-off.png
  32. BIN  apps/communications/contacts/style/images/icon-fav-button-on.png
  33. BIN  apps/communications/contacts/style/images/icon-fav-button.png
  34. +1 −1  apps/communications/dialer/js/keypad.js
  35. +10 −10 apps/communications/dialer/js/lazy_l10n.js
  36. +5 −2 apps/communications/dialer/js/recents.js
  37. +1 −1  apps/communications/dialer/js/utils.js
  38. +1 −1  apps/communications/dialer/style/keypad.css
  39. +25 −11 apps/communications/ftu/css/style.css
  40. +38 −13 apps/communications/ftu/index.html
  41. +6 −19 apps/communications/ftu/js/app.js
  42. +18 −16 apps/communications/ftu/js/language.js
  43. +5 −4 apps/communications/ftu/js/navigation.js
  44. +151 −32 apps/communications/ftu/js/sim_manager.js
  45. +47 −10 apps/communications/ftu/js/ui.js
  46. +28 −12 apps/communications/ftu/locales/ftu.en-US.properties
  47. +24 −3 apps/costcontrol/js/app.js
  48. +23 −6 apps/costcontrol/js/common.js
  49. +13 −11 apps/costcontrol/js/config_manager.js
  50. +14 −14 apps/costcontrol/js/costcontrol.js
  51. +5 −6 apps/costcontrol/js/message_handler.js
  52. +73 −32 apps/costcontrol/js/mindgap.js
  53. +6 −2 apps/costcontrol/js/settings/settings.js
  54. +3 −2 apps/costcontrol/js/utils/debug.js
  55. +7 −7 apps/costcontrol/js/views/balance.js
  56. +1 −1  apps/costcontrol/js/views/datausage.js
  57. +2 −2 apps/costcontrol/js/views/telephony.js
  58. +33 −6 apps/costcontrol/js/widget.js
  59. +4 −4 apps/email/index.html
  60. +45 −23 apps/email/js/ext/gaia-email-opt.js
  61. +22 −18 apps/email/js/message-cards.js
  62. +2 −2 apps/email/locales/email.en-US.properties
  63. +1 −1  apps/homescreen/everything.me/css/common.css
  64. +5 −49 apps/homescreen/everything.me/modules/Banner/Banner.css
  65. +2 −1  apps/homescreen/index.html
  66. +15 −2 apps/homescreen/js/grid.js
  67. +12 −22 apps/keyboard/style/keyboard.css
  68. +1 −0  apps/music/style/music.css
  69. +54 −60 apps/settings/index.html
  70. +53 −8 apps/settings/js/apps.js
  71. +14 −9 apps/settings/js/bluetooth.js
  72. +23 −5 apps/settings/js/connectivity.js
  73. +8 −0 apps/settings/js/hiddenapps.js
  74. +72 −19 apps/settings/js/icc.js
  75. +5 −15 apps/settings/js/settings.js
  76. +2 −2 apps/settings/js/simcard_dialog.js
  77. +5 −4 apps/settings/js/support.js
  78. +24 −5 apps/settings/js/wifi.js
  79. +1 −0  apps/settings/locales/settings.ar.properties
  80. +10 −9 apps/settings/locales/settings.en-US.properties
  81. +1 −0  apps/settings/locales/settings.fr.properties
  82. +1 −0  apps/settings/locales/settings.zh-TW.properties
  83. +2 −1  apps/settings/style/lists.css
  84. +2 −2 apps/settings/style/settings.css
  85. +1 −8 apps/sms/index.html
  86. +11 −23 apps/sms/js/contacts.js
  87. +0 −104 apps/sms/js/phoneNumberUtils.js
  88. +144 −128 apps/sms/js/sms.js
  89. +8 −5 apps/sms/js/utils.js
  90. +1 −0  apps/sms/locales/sms.en-US.properties
  91. +16 −7 apps/system/index.html
  92. +0 −2  apps/system/js/airplane_mode.js
  93. +2 −2 apps/system/js/app_install_manager.js
  94. +3 −2 apps/system/js/cost_control.js
  95. +41 −0 apps/system/js/remote_debugger.js
  96. +4 −6 apps/system/js/sim_lock.js
  97. +6 −7 apps/system/js/statusbar.js
  98. +19 −7 apps/system/js/trusted_ui.js
  99. +15 −6 apps/system/js/updatable.js
  100. +46 −10 apps/system/js/update_manager.js
  101. +8 −0 apps/system/js/wifi.js
  102. +0 −4 apps/system/js/window_manager.js
  103. +12 −6 apps/system/locales/system.en-US.properties
  104. +0 −56 apps/system/style/lockscreen/fonts/Keyboard-Symbols.svg
  105. BIN  apps/system/style/lockscreen/fonts/Keyboard-Symbols.woff
  106. BIN  apps/system/style/lockscreen/images/icon-clear.png
  107. +18 −9 apps/system/style/lockscreen/lockscreen.css
  108. +5 −0 apps/system/style/statusbar/statusbar.css
  109. +14 −14 apps/system/style/system/system.css
  110. +32 −0 apps/system/style/update_manager/update_manager.css
  111. +78 −17 apps/system/test/unit/app_install_manager_test.js
  112. +15 −0 apps/system/test/unit/mobile_operator_test.js
  113. +1 −1  apps/system/test/unit/mock_navigator_moz_mobile_connection.js
  114. +56 −16 apps/system/test/unit/updatable_test.js
  115. +70 −7 apps/system/test/unit/update_manager_test.js
  116. +7 −2 build/settings.py
  117. +10 −5 build/utils.js
  118. +3 −1 build/webapp-l10n.js
  119. +2 −1  shared/js/mobile_operator.js
  120. +1 −10 shared/style/status.css
  121. +16 −15 tests/atoms/gaia_apps.js
  122. +14 −22 tests/atoms/gaia_data_layer.js
  123. +2 −0  tests/atoms/gaia_lock_screen.js
  124. +10 −9 tests/python/README.md
  125. +44 −10 tests/python/gaiatest/gaia_test.py
  126. +1 −1  tests/python/gaiatest/mocks/mock_contact.py
  127. +3 −0  tests/python/gaiatest/tests/__init__.py
  128. +3 −0  tests/python/gaiatest/tests/clock/__init__.py
  129. +50 −0 tests/python/gaiatest/tests/clock/clock_object.py
  130. +9 −0 tests/python/gaiatest/tests/clock/manifest.ini
  131. +39 −0 tests/python/gaiatest/tests/clock/test_clock_all_items_present_new_alarm.py
  132. +78 −0 tests/python/gaiatest/tests/clock/test_clock_create_new_alarm.py
  133. +46 −0 tests/python/gaiatest/tests/clock/test_clock_delete_alarm.py
  134. +59 −0 tests/python/gaiatest/tests/clock/test_clock_switch_clock_type.py
  135. +51 −0 tests/python/gaiatest/tests/clock/test_clock_turn_on_off_alarm.py
  136. +1 −4 tests/python/gaiatest/tests/contacts/manifest.ini
  137. +0 −6 tests/python/gaiatest/tests/contacts/test_add_new_contact.py
  138. +1 −2  tests/python/gaiatest/tests/contacts/test_call_contact.py
  139. +1 −2  tests/python/gaiatest/tests/contacts/test_edit_contact.py
  140. +4 −3 tests/python/gaiatest/tests/contacts/test_sms_contact.py
  141. +3 −0  tests/python/gaiatest/tests/fmradio/__init__.py
  142. +11 −0 tests/python/gaiatest/tests/fmradio/manifest.ini
  143. +63 −0 tests/python/gaiatest/tests/fmradio/test_fmradio_add_to_favorite.py
  144. +85 −0 tests/python/gaiatest/tests/fmradio/test_fmradio_find_stations.py
  145. +57 −0 tests/python/gaiatest/tests/fmradio/test_fmradio_remove_from_favorite.py
  146. +55 −0 tests/python/gaiatest/tests/fmradio/test_fmradio_turn_on_off.py
  147. +13 −4 tests/python/gaiatest/tests/manifest.ini
  148. +77 −18 tests/python/gaiatest/tests/marketplace/test_marketplace_login.py
  149. +0 −6 tests/python/gaiatest/tests/marketplace/test_search_marketplace_and_install_app.py
  150. +0 −6 tests/python/gaiatest/tests/test_browser_cell_data.py
  151. +5 −8 tests/python/gaiatest/tests/test_browser_lan.py
  152. +0 −8 tests/python/gaiatest/tests/test_calculator.py
  153. +8 −21 tests/python/gaiatest/tests/test_calendar.py
  154. +0 −8 tests/python/gaiatest/tests/test_call_log.py
  155. +9 −11 tests/python/gaiatest/tests/test_camera.py
  156. +11 −25 tests/python/gaiatest/tests/test_cards_view.py
  157. +0 −5 tests/python/gaiatest/tests/test_dialer.py
  158. +107 −0 tests/python/gaiatest/tests/test_dialer_verify.py
  159. +196 −0 tests/python/gaiatest/tests/test_ftu.py
  160. +0 −8 tests/python/gaiatest/tests/test_gallery.py
  161. +7 −1 tests/python/gaiatest/tests/test_launch_app.py
  162. +33 −2 tests/python/gaiatest/tests/test_lockscreen.py
  163. +0 −7 tests/python/gaiatest/tests/test_music.py
  164. +18 −10 tests/python/gaiatest/tests/test_radio.py
  165. +3 −12 tests/python/gaiatest/tests/test_sms.py
  166. +0 −8 tests/python/gaiatest/tests/test_updater.py
  167. +0 −8 tests/python/gaiatest/tests/test_video_player.py
  168. +77 −0 tests/python/gaiatest/tests/test_wallpaper.py
  169. +1 −0  tests/python/gaiatest/tests/unit/manifest.ini
  170. +33 −0 tests/python/gaiatest/tests/unit/test_debug.py
  171. +1 −1  tests/python/gaiatest/tests/unit/test_kill.py
  172. +2 −2 tests/python/gaiatest/tests/unit/test_killall.py
  173. +6 −2 tests/python/gaiatest/testvars_template.json
View
1  .gitignore
@@ -14,6 +14,7 @@ manifest.appcache
/apps/sms/js/blacklist.json
/test_apps/test-agent/test/config.json
/apps/dialer/contacts
+/apps/browser/js/init.json
/apps/*/test/unit/_sandbox.html
/apps/*/test/unit/_proxy.html
View
2  Makefile
@@ -633,7 +633,7 @@ SETTINGS_ARG=--noftu
endif
profile/settings.json: build/settings.py build/wallpaper.jpg
- python build/settings.py $(SETTINGS_ARG) --console --homescreen $(SCHEME)homescreen.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --ftu $(SCHEME)communications.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --wallpaper build/wallpaper.jpg --override build/custom-settings.json --output $@
+ python build/settings.py $(SETTINGS_ARG) --console --locale $(GAIA_DEFAULT_LOCALE) --homescreen $(SCHEME)homescreen.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --ftu $(SCHEME)communications.$(GAIA_DOMAIN)$(GAIA_PORT)/manifest.webapp --wallpaper build/wallpaper.jpg --override build/custom-settings.json --output $@
# push profile/settings.json to the phone
install-settings-defaults: profile/settings.json
View
5 apps/browser/js/authentication_dialog.js
@@ -126,5 +126,10 @@ var AuthenticationDialog = {
originHasEvent: function(origin) {
return origin in this.currentEvents;
+ },
+
+ clear: function ad_clear(origin) {
+ if (this.currentEvents[origin])
+ delete this.currentEvents[origin];
}
};
View
92 apps/browser/js/browser.js
@@ -212,7 +212,7 @@ var Browser = {
},
handleTryReloading: function browser_handleTryReloading() {
- this.navigate(this.currentTab.url);
+ this.reviveCrashedTab(this.currentTab);
},
handleCloseTab: function browser_handleCloseTab() {
@@ -412,14 +412,8 @@ var Browser = {
break;
case 'mozbrowsererror':
- if (evt.detail.type === 'fatal') {
- // A background crash usually means killed to save memory
- if (document.mozHidden) {
- this.handleKilledTab(tab);
- } else {
- this.handleCrashedTab(tab);
- }
- }
+ if (evt.detail.type === 'fatal')
+ this.handleCrashedTab(tab);
break;
case 'mozbrowserscroll':
@@ -493,37 +487,33 @@ var Browser = {
},
handleCrashedTab: function browser_handleCrashedTab(tab) {
- if (tab.id === this.currentTab.id) {
+ // No need to show the crash screen for background tabs,
+ // they will be revived when selected
+ if (tab.id === this.currentTab.id && !document.mozHidden) {
this.showCrashScreen();
}
-
tab.loading = false;
tab.crashed = true;
+ ModalDialog.clear(tab.id);
+ AuthenticationDialog.clear(tab.id);
this.frames.removeChild(tab.dom);
delete tab.dom;
delete tab.screenshot;
tab.loading = false;
- this.createTab(null, null, tab);
- this.refreshButtons();
- },
-
- handleKilledTab: function browser_handleKilledTab(tab) {
- tab.killed = true;
- this.frames.removeChild(tab.dom);
- delete tab.dom;
- tab.loading = false;
},
handleVisibilityChange: function browser_handleVisibilityChange() {
- if (!document.mozHidden && this.currentTab.killed)
- this.reviveKilledTab(this.currentTab);
+ if (!document.mozHidden && this.currentTab.crashed)
+ this.reviveCrashedTab(this.currentTab);
},
- reviveKilledTab: function browser_reviveKilledTab(tab) {
+ reviveCrashedTab: function browser_reviveCrashedTab(tab) {
this.createTab(null, null, tab);
+ this.setTabVisibility(tab, true);
this.refreshButtons();
this.navigate(tab.url);
- tab.killed = false;
+ tab.crashed = false;
+ this.hideCrashScreen();
},
handleWindowOpen: function browser_handleWindowOpen(evt) {
@@ -562,10 +552,6 @@ var Browser = {
},
navigate: function browser_navigate(url) {
- if (this.currentTab.crashed) {
- this.currentTab.crashed = false;
- this.hideCrashScreen();
- }
this.hideStartscreen();
this.showPageScreen();
this.currentTab.title = null;
@@ -601,30 +587,37 @@ var Browser = {
e.preventDefault();
}
- if (this.currentTab.crashed && this.urlButtonMode == this.REFRESH) {
+ if (this.urlButtonMode == this.REFRESH && this.currentTab.crashed) {
this.setUrlBar(this.currentTab.url);
- this.navigate(this.currentTab.url);
+ this.reviveCrashedTab(this.currentTab);
return;
}
- if (this.urlButtonMode == this.REFRESH) {
+ if (this.urlButtonMode == this.REFRESH && !this.currentTab.crashed) {
this.currentTab.dom.reload(true);
return;
}
- if (this.urlButtonMode == this.STOP) {
+ if (this.urlButtonMode == this.STOP && !this.currentTab.crashed) {
this.currentTab.dom.stop();
return;
}
var url = this.getUrlFromInput(this.urlInput.value);
- if (url !== this.currentTab.url && !this.currentTab.crashed) {
+ if (url !== this.currentTab.url) {
this.setUrlBar(url);
this.currentTab.url = url;
}
- this.navigate(url);
+
this.urlInput.blur();
+
+ if (this.currentTab.crashed) {
+ this.reviveCrashedTab(this.currentTab);
+ return;
+ }
+
+ this.navigate(url);
},
goBack: function browser_goBack() {
@@ -852,20 +845,20 @@ var Browser = {
}
},
- showTopSitesTab: function browser_showTopSitesTab(filter) {
+ showTopSitesTab: function browser_showTopSitesTab() {
this.deselectAwesomescreenTabs();
this.topSitesTab.classList.add('selected');
this.topSites.classList.add('selected');
- Places.getTopSites(20, filter, this.showTopSites.bind(this));
+ Places.getTopSites(20, null, this.showTopSites.bind(this));
},
- showTopSites: function browser_showTopSites(topSites, filter) {
+ showTopSites: function browser_showTopSites(topSites) {
this.topSites.innerHTML = '';
var list = document.createElement('ul');
list.setAttribute('role', 'listbox');
this.topSites.appendChild(list);
topSites.forEach(function browser_processTopSite(data) {
- this.drawAwesomescreenListItem(list, data, filter);
+ this.drawAwesomescreenListItem(list, data);
}, this);
},
@@ -1131,6 +1124,9 @@ var Browser = {
},
setTabVisibility: function(tab, visible) {
+ if (!tab.dom)
+ return;
+
if (ModalDialog.originHasEvent(tab.id)) {
if (visible) {
ModalDialog.show(tab.id);
@@ -1146,18 +1142,17 @@ var Browser = {
AuthenticationDialog.hide();
}
}
+
// We put loading tabs off screen as we want to screenshot
// them when loaded
if (tab.loading && !visible) {
tab.dom.style.top = '-999px';
return;
}
- if (tab.dom.setVisible) {
+
+ if (tab.dom.setVisible)
tab.dom.setVisible(visible);
- }
- if (tab.crashed) {
- this.showCrashScreen();
- }
+
tab.dom.style.display = visible ? 'block' : 'none';
tab.dom.style.top = '0px';
},
@@ -1215,8 +1210,11 @@ var Browser = {
deleteTab: function browser_deleteTab(id) {
var tabIds = Object.keys(this.tabs);
- this.tabs[id].dom.parentNode.removeChild(this.tabs[id].dom);
+ if (this.tabs[id].dom)
+ this.tabs[id].dom.parentNode.removeChild(this.tabs[id].dom);
delete this.tabs[id];
+ ModalDialog.clear(id);
+ AuthenticationDialog.clear(id);
if (this.currentTab && this.currentTab.id === id) {
// The tab to be selected when the current one is deleted
var newTab = tabIds.indexOf(id);
@@ -1256,9 +1254,9 @@ var Browser = {
selectTab: function browser_selectTab(id) {
this.currentTab = this.tabs[id];
- // If the tab was killed, bring it back to life
- if (this.currentTab.killed)
- this.reviveKilledTab(this.currentTab);
+ // If the tab crashed, bring it back to life
+ if (this.currentTab.crashed)
+ this.reviveCrashedTab(this.currentTab);
// We may have picked a currently loading background tab
// that was positioned off screen
this.setUrlBar(this.currentTab.title);
View
7 apps/browser/js/modal_dialog.js
@@ -70,7 +70,7 @@ var ModalDialog = {
break;
case 'click':
- if (evt.currentTarget.nodeName == "BUTTON" ||
+ if (evt.currentTarget.nodeName == 'BUTTON' ||
evt.currentTarget == elements.customPromptButtons) {
evt.preventDefault();
}
@@ -242,5 +242,10 @@ var ModalDialog = {
originHasEvent: function(origin) {
return origin in this.currentEvents;
+ },
+
+ clear: function ad_clear(origin) {
+ if (this.currentEvents[origin])
+ delete this.currentEvents[origin];
}
};
View
3  apps/browser/style/browser.css
@@ -878,6 +878,9 @@ li[role="listitem"] small {
#settings li button {
margin: 0;
+ height: auto;
+ line-height: 2rem;
+ padding: 1rem 1.5rem;
}
View
52 apps/calendar/js/app.js
@@ -202,6 +202,55 @@ Calendar.App = (function(window) {
},
/**
+ * Observes localized events and localizes elements
+ * with data-l10n-date-format should be registered
+ * after the first localized event.
+ *
+ *
+ * Example:
+ *
+ *
+ * <span
+ * data-date="Wed Jan 09 2013 19:25:38 GMT+0100 (CET)"
+ * data-l10n-date-format="%x">
+ *
+ * 2013/9/19
+ *
+ * </span>
+ *
+ */
+ observeDateLocalization: function() {
+ function localize() {
+ var elements = document.querySelectorAll(
+ '[data-l10n-date-format]'
+ );
+
+ var len = elements.length;
+ var i = 0;
+
+ var date;
+ var format;
+ var el;
+
+ for (; i < len; i++) {
+ el = elements[i];
+
+ date = el.dataset.date;
+ format = el.dataset.l10nDateFormat;
+
+ if (date) {
+ el.textContent = Calendar.App.dateFormat.localeFormat(
+ new Date(date),
+ format
+ );
+ }
+ }
+ }
+
+ window.addEventListener('localized', localize);
+ },
+
+ /**
* Adds observers to objects capable of being pending.
*
* Object must emit some kind of start/complete events
@@ -304,6 +353,9 @@ Calendar.App = (function(window) {
this.dateFormat = navigator.mozL10n.DateTimeFormat();
+ // re-localize dates on screen
+ this.observeDateLocalization();
+
this.timeController.observe();
this.alarmController.observe();
View
1  apps/calendar/js/db.js
@@ -379,6 +379,7 @@
account._id = uuid();
var calendar = {
+ _id: Calendar.Provider.Local.calendarId,
accountId: account._id,
remote: Calendar.Provider.Local.defaultCalendar()
};
View
56 apps/calendar/js/ext/caldav.js
@@ -2040,15 +2040,6 @@ function write (chunk) {
},
/**
- * Aborts request if its in progress.
- */
- abort: function abort() {
- if (this.xhr) {
- this.xhr.abort();
- }
- },
-
- /**
* @param {String} user basic auth user.
* @param {String} password basic auth pass.
* @return {String} basic auth token.
@@ -2077,9 +2068,6 @@ function write (chunk) {
} else {
xhr = new this.xhrClass();
}
-
- this.xhr = xhr;
-
// This hack is in place due to some platform
// bug in gecko when using mozSystem xhr
// the credentials only seem to work as expected
@@ -2094,6 +2082,12 @@ function write (chunk) {
));
}
+ var useMozChunkedText = false;
+ if (this.globalXhrOptions && this.globalXhrOptions.useMozChunkedText) {
+ useMozChunkedText = true;
+ xhr.responseType = 'moz-chunked-text';
+ }
+
for (header in this.headers) {
if (Object.hasOwnProperty.call(this.headers, header)) {
xhr.setRequestHeader(header, this.headers[header]);
@@ -2107,13 +2101,20 @@ function write (chunk) {
if ('onprogress' in xhr) {
hasProgressEvents = true;
var last = 0;
- xhr.onprogress = function onProgress(event) {
- var chunk = xhr.responseText.substr(last, event.loaded);
- last = event.loaded;
- if (this.ondata) {
- this.ondata(chunk);
- }
- }.bind(this);
+
+ if (useMozChunkedText) {
+ xhr.onprogress = function onChunkedProgress(event) {
+ this.ondata(xhr.responseText);
+ }.bind(this);
+ } else {
+ xhr.onprogress = function onProgress(event) {
+ var chunk = xhr.responseText.substr(last, event.loaded);
+ last = event.loaded;
+ if (this.ondata) {
+ this.ondata(chunk);
+ }
+ }.bind(this);
+ }
}
xhr.onreadystatechange = function onReadyStateChange() {
@@ -2136,6 +2137,8 @@ function write (chunk) {
this.waiting = true;
xhr.send(this._seralize());
+
+ return xhr;
}
};
@@ -2602,26 +2605,26 @@ function write (chunk) {
default:
message = this.code;
}
-
Error.call(this, message);
}
+
CaldavHttpError.prototype = {
__proto__: Error.prototype,
constructor: CaldavHttpError
}
-
+
// Unauthenticated error for
// Google Calendar
function UnauthenticatedError() {
var message = "Wrong username or/and password";
Error.call(this, message);
}
-
+
UnauthenticatedError.prototype = {
__proto__: Error.prototype,
constructor: UnauthenticatedError
}
-
+
module.exports = {
CaldavHttpError: CaldavHttpError,
UnauthenticatedError: UnauthenticatedError
@@ -2700,8 +2703,7 @@ function write (chunk) {
};
// in the future we may stream data somehow
- req.send(function xhrResult() {
- var xhr = req.xhr;
+ req.send(function xhrResult(err, xhr) {
if (xhr.status > 199 && xhr.status < 300) {
// success
self.sax.close();
@@ -3021,8 +3023,7 @@ function write (chunk) {
content += this.filter.toString();
}
- var out = this.template.render(content);
- return out;
+ return this.template.render(content);
}
};
@@ -3110,6 +3111,7 @@ function write (chunk) {
if (!principal) {
principal = findProperty('principal-URL', data, true);
}
+
if ('unauthenticated' in principal) {
callback(new Errors.UnauthenticatedError());
} else if (principal.href){
View
2  apps/calendar/js/provider/local.js
@@ -10,6 +10,8 @@
this.alarms = this.app.store('Alarm');
}
+ Local.calendarId = LOCAL_CALENDAR_ID;
+
/**
* Returns the details for the default calendars.
*/
View
3  apps/calendar/js/service/caldav.js
@@ -5,7 +5,8 @@ Calendar.ns('Service').Caldav = (function() {
/* TODO: ugly hack to enable system XHR fix upstream in Caldav lib */
var xhrOpts = {
mozSystem: true,
- mozAnon: true
+ mozAnon: true,
+ useMozChunkedText: true
};
Caldav.Xhr.prototype.globalXhrOptions = xhrOpts;
View
14 apps/calendar/js/templates/account.js
@@ -3,17 +3,21 @@
var Account = Calendar.Template.create({
provider: function() {
return '<li class="' + this.h('name') + '">' +
- '<a data-provider="' + this.h('name') +
- '" href="/create-account/' + this.h('name') + '">' +
+ '<a ' +
+ 'data-l10n-id="preset-' + this.h('name') + '" ' +
+ 'data-provider="' + this.h('name') + '" href="/create-account/' +
+ this.h('name') + '">' +
this.l10n('name', 'preset-') +
'</a>' +
'</li>';
},
account: function() {
- return '<li id="account-' + this.h('id') + '">' +
- '<a href="/update-account/' + this.h('id') + '">' +
- '<span class="preset">' +
+ var id = this.h('id');
+ return '<li id="account-' + id + '">' +
+ '<a href="/update-account/' + id + '">' +
+ '<span class="preset"' +
+ ' data-l10n-id="preset-' + this.h('preset') + '">' +
this.l10n('preset', 'preset-') +
'</span>' +
'<span class="user">' + this.h('user') + '</span>' +
View
18 apps/calendar/js/templates/calendar.js
@@ -2,13 +2,21 @@
var Cal = Calendar.Template.create({
item: function() {
- return '<li id="calendar-' + this.h('_id') + '">' +
- '<div class="calendar-id-' +
- this.h('_id') + ' calendar-color"></div>' +
+ var id = this.h('_id');
+ var l10n = '';
+
+ // hack localize the only default calendar
+ if (id && Calendar.Provider.Local.calendarId === id) {
+ // localize the default calendar name
+ l10n = 'data-l10n-id="calendar-local"';
+ }
+
+ return '<li id="calendar-' + id + '">' +
+ '<div class="calendar-id-' + id + ' calendar-color"></div>' +
'<label>' +
- '<span class="name">' + this.h('name') + '</span>' +
+ '<span ' + l10n + ' class="name">' + this.h('name') + '</span>' +
'<input ' +
- 'value="' + this.h('_id') + '" ' +
+ 'value="' + id + '" ' +
'type="checkbox" ' +
this.bool('localDisplayed', 'checked') + ' />' +
'<span></span>' +
View
24 apps/calendar/js/templates/day.js
@@ -2,11 +2,21 @@
var Day = Calendar.Template.create({
hour: function() {
- return '<section class="hour hour-' + this.h('hour') +
- ' ' + this.h('classes') + ' calendar-display">' +
+ var hour = this.h('hour');
+ var l10n = '';
+ var displayHour;
+
+ if (hour === Calendar.Calc.ALLDAY) {
+ l10n = ' data-l10n-id="hour-allday" ';
+ displayHour = navigator.mozL10n.get('hour-allday');
+ } else {
+ displayHour = this.h('displayHour');
+ }
+
+ return '<section class="hour hour-' + hour+ ' ' + this.h('classes') + ' calendar-display">' +
'<h4>' +
- '<span class="display-hour ' + this.h('hour') + '">' +
- this.h('displayHour') +
+ '<span ' + l10n + 'class="display-hour ' + hour + '">' +
+ displayHour +
'</span>' +
'</h4>' +
/** has no semantic value - re-evaluate */
@@ -19,10 +29,10 @@
},
event: function() {
- return '<section class="event calendar-id-' + this.h('calendarId') + ' ' +
+ var calendarId = this.h('calendarId');
+ return '<section class="event calendar-id-' + calendarId + ' ' +
'calendar-display" data-id="' + this.h('busytimeId') + '">' +
- '<div class="container calendar-id-' +
- this.h('calendarId') + ' calendar-color">' +
+ '<div class="container calendar-id-' + calendarId + ' calendar-color">' +
'<h5>' + this.h('title') + '</h5>' +
'<span class="details">' +
'<span class="location">' +
View
19 apps/calendar/js/templates/week.js
@@ -5,9 +5,20 @@
},
sidebarHour: function() {
- return '<li class="hour-' + this.h('hour') + '">' +
- this.h('displayHour') +
- '</li>';
+ var l10n = '';
+ var hour = this.h('hour');
+ var displayHour;
+
+ if (hour === Calendar.Calc.ALLDAY) {
+ l10n = ' data-l10n-id="hour-allday" ';
+ displayHour = navigator.mozL10n.get('hour-allday');
+ } else {
+ displayHour = this.h('displayHour');
+ }
+
+ return '<li ' + hour + ' class="hour-' + this.h('hour') + '">' +
+ displayHour +
+ '</li>';
},
hour: function() {
@@ -18,7 +29,7 @@
event: function() {
return '<li class="event" data-id="' + this.h('busytimeId') + '">' +
- '<div class="container calendar-id-' + this.h('calendarId') + ' ' +
+ '<div class="container calend +ar-id-' + this.h('calendarId') + ' ' +
'calendar-display calendar-color">' +
this.h('title') +
'</div>' +
View
12 apps/calendar/js/views/months_day.js
@@ -40,12 +40,20 @@ Calendar.ns('Views').MonthsDay = (function() {
},
_updateHeader: function() {
+ var header = this.header;
+ var template = navigator.mozL10n.get(
+ 'agenda-date-format'
+ );
+
// maybe we should localize this output ?
var format = this.app.dateFormat.localeFormat(
this.date,
- '%A %B %Y'
+ template || '%A %e %B %Y'
);
- this.header.textContent = format;
+
+ header.textContent = format;
+ header.dataset.date = this.date.toString();
+ header.dataset.l10nDateFormat = template;
},
handleEvent: function(e) {
View
11 apps/calendar/js/views/time_header.js
@@ -130,7 +130,16 @@ Calendar.ns('Views').TimeHeader = (function() {
_updateTitle: function() {
var con = this.app.timeController;
- this.title.textContent = this.getScale(
+ var date = this.getScale(con.scale);
+
+ var title = this.title;
+
+ title.dataset.l10nDateFormat =
+ this.scales[con.scale] || this.scales.month;
+
+ title.dataset.date = con.position.toString();
+
+ title.textContent = this.getScale(
con.scale
);
},
View
4 apps/calendar/locales/calendar.en-US.properties
@@ -81,8 +81,10 @@ sync-frequency-hourly.textContent=Each hour
alarm-starting={{title}} started {{distance}}
alarm-started={{title}} starting in {{distance}}
-# 24 vs 12 see http://www.cplusplus.com/reference/clibrary/ctime/strftime/
+# Date formatting details (http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html)
+agenda-date-format=%A %e %B %Y
hour-format=%I %p
+hour-allday=All Day
#errors
error-start-after-end=End date must come after start date
View
53 apps/calendar/test/unit/app_test.js
@@ -45,6 +45,59 @@ suite('app', function() {
router = subject.router;
});
+ suite('date localization', function() {
+ var expected;
+ var fmt;
+ var id = 0;
+
+ function dateElement(date, format) {
+ var el = document.createElement('span');
+ el.dataset.l10nDateFormat = format;
+ el.dataset.date = date.toString();
+ el.textContent = 'you-faiL!';
+
+ document.body.appendChild(el);
+
+ return el;
+ }
+
+ function addExpect(date, format) {
+ var elId = 'dateId-' + (++id);
+ dateElement(date, format).id = elId;
+
+ expected.push(
+ [elId, fmt.localeFormat(date, format)]
+ );
+ }
+
+ setup(function() {
+ fmt = Calendar.App.dateFormat = navigator.mozL10n.DateTimeFormat();
+ expected = [];
+
+ var formatXDate = new Date(2012, 1, 1);
+ var formatCDate = new Date(2012, 1, 1, 7, 2, 9);
+
+ addExpect(formatCDate, '%x');
+ addExpect(formatCDate, '%c');
+
+ subject.observeDateLocalization();
+ window.dispatchEvent(new Event('localized'));
+ });
+
+ test('updates elements with data-l10n-date-format', function() {
+ expected.forEach(function(item) {
+ var element = document.getElementById(item[0]);
+ var expectedText = item[1];
+
+ assert.equal(
+ element.textContent,
+ expectedText,
+ 'should relocalize given'
+ );
+ });
+ });
+ });
+
suite('PendingManager', function() {
var subject;
View
3  apps/calendar/test/unit/service/caldav_test.js
@@ -81,7 +81,8 @@ suite('service/caldav', function() {
var xhr = Caldav.Xhr;
var expected = {
mozSystem: true,
- mozAnon: true
+ mozAnon: true,
+ useMozChunkedText: true
};
assert.deepEqual(xhr.prototype.globalXhrOptions, expected);
View
17 apps/calendar/test/unit/templates/calendar_test.js
@@ -14,6 +14,18 @@ suite('templates/calendar', function() {
return subject[type].render(options);
}
+ test('#item with local id', function() {
+ var model = {
+ localDisplayed: true,
+ _id: Calendar.Provider.Local.calendarId,
+ name: 'foo'
+ };
+
+ var output = renderHTML('item', model);
+ assert.ok(output);
+ assert.include(output, 'calendar-local');
+ });
+
test('#item', function() {
var model = {
localDisplayed: true,
@@ -28,6 +40,11 @@ suite('templates/calendar', function() {
assert.include(output, model.name);
assert.include(output, 'calendar-1');
+ assert.ok(
+ output.indexOf('calendar-local') === -1,
+ 'does not include calendar-local l10n id'
+ );
+
model.localDisplayed = false;
output = renderHTML('item', model);
View
15 apps/calendar/test/unit/views/months_day_test.js
@@ -93,8 +93,21 @@ suite('views/months_day', function() {
subject.date = date;
subject._updateHeader();
+ var format = '%A %e %B %Y';
var expected = date.toLocaleFormat(
- '%A %B %Y'
+ format
+ );
+
+ assert.equal(
+ el.dataset.date,
+ date.toString(),
+ 'sets element\'s date'
+ );
+
+ assert.equal(
+ el.dataset.l10nDateFormat,
+ format,
+ 'sets element\'s l10nDateFormat'
);
assert.ok(el.innerHTML, 'has contents');
View
13 apps/calendar/test/unit/views/time_header_test.js
@@ -98,6 +98,19 @@ suite('views/time_header', function() {
test('#_updateTitle', function() {
subject._updateTitle();
+
+ assert.equal(
+ subject.title.dataset.date,
+ controller.position.toString(),
+ 'sets element date'
+ );
+
+ assert.equal(
+ subject.title.dataset.l10nDateFormat,
+ subject.scales.month,
+ 'sets element scale'
+ );
+
assert.equal(
subject.title.textContent,
subject.getScale('month')
View
18 apps/camera/js/camera.js
@@ -367,15 +367,15 @@ var Camera = {
onsuccess, onerror);
}).bind(this);
- this.createDCFFilename('video', '3gp', (function(filename) {
- this._videoPath = filename;
+ this.createDCFFilename('video', '3gp', (function(path, name) {
+ this._videoPath = path + name;
// The CameraControl API will not automatically create directories
// for the new file if they do not exist, so write a dummy file
// to the same directory via DeviceStorage to ensure that the directory
// exists before recording starts.
var dummyblob = new Blob([''], {type: 'video/3gpp'});
- var dummyfilename = filename + '.dummy.3gp';
+ var dummyfilename = path + '.' + name;
var req = this._videoStorage.addNamed(dummyblob, dummyfilename);
req.onerror = onerror;
req.onsuccess = (function fileCreated() {
@@ -634,7 +634,7 @@ var Camera = {
var self = this;
var dcf = this._dcfConfig;
var filename = dcf[type].prefix + this.padLeft(dcf.seq.file, 4) + '.' + ext;
- var path = 'DCIM/' + dcf.seq.dir + dcf.postFix + '/' + filename;
+ var path = 'DCIM/' + dcf.seq.dir + dcf.postFix + '/';
var storage = type === 'video' ? this._videoStorage : this._pictureStorage;
// A file with this name may have been written by the user or
@@ -661,7 +661,7 @@ var Camera = {
dcf.seq.dir += 1;
}
asyncStorage.setItem(dcf.key, dcf.seq, function() {
- callback(path);
+ callback(path, filename);
});
};
},
@@ -670,8 +670,8 @@ var Camera = {
this._manuallyFocused = false;
this.hideFocusRing();
this.restartPreview();
- this.createDCFFilename('image', 'jpg', (function(name) {
- var addreq = this._pictureStorage.addNamed(blob, name);
+ this.createDCFFilename('image', 'jpg', (function(path, name) {
+ var addreq = this._pictureStorage.addNamed(blob, path + name);
addreq.onsuccess = (function() {
if (this._pendingPick) {
// XXX: https://bugzilla.mozilla.org/show_bug.cgi?id=806503
@@ -679,7 +679,7 @@ var Camera = {
// But there seems to be a bug with blob lifetimes and activities.
// So we'll get a new blob back out of device storage to ensure
// that we've got a file-backed blob instead of a memory-backed blob.
- var getreq = this._pictureStorage.get(name);
+ var getreq = this._pictureStorage.get(path + name);
getreq.onsuccess = (function() {
this._pendingPick.postResult({
type: 'image/jpeg',
@@ -691,7 +691,7 @@ var Camera = {
return;
}
- Filmstrip.addImage(name, blob);
+ Filmstrip.addImage(path + name, blob);
Filmstrip.show(Camera.FILMSTRIP_DURATION);
this.checkStorageSpace();
View
5 apps/clock/index.html
@@ -10,6 +10,7 @@
<!-- Shared styles -->
<link rel="stylesheet" type="text/css" href="shared/style/headers.css">
<link rel="stylesheet" type="text/css" href="shared/style/switches.css">
+ <link rel="stylesheet" type="text/css" href="shared/style/status.css">
<!-- Shared sounds -->
<link rel="resources" type="directory" href="shared/resources/media/alarms/">
@@ -63,11 +64,11 @@
<a id="alarm-new" href="#alarm" class="right button plus"></a>
<ul id="alarms" class="tableView"></ul>
</div>
- <div id="banner-countdown" class="banner">
+ <section id="banner-countdown" role="status">
<p> <!-- this will be replaced dynamically -->
The alarm is set for <strong>8 hours</strong> and <strong>45 minutes</strong> from now.
</p>
- </div>
+ </section>
</div>
<div id="stopwatch-view" class="active view" hidden="true">
View
53 apps/clock/style/clock.css
@@ -452,63 +452,22 @@ html, body {
#minutehandCentralPoint { /* dark-gray central point*/
stroke-width: 0rem;
}
-/* from building blocks, core.css - [role=dialog]*/
-.banner {
- position: absolute;
- background: orange;
- width: 100%;
- height: 8.13rem;
- bottom: 0;
- vertical-align: middle;
- text-align: center;
- background-attachment: scroll, scroll;
- background-clip: border-box, border-box;
- background-color: transparent;
- background-image: url("images/pattern.png"), url("images/gradient.png");
- background-origin: padding-box, padding-box;
- background-position: left top, left top;
- background-repeat: repeat, no-repeat;
- background-size: auto auto, 100% 100%;
- font-family: "MozTT",Sans-serif;
+
+/* banner*/
+#banner-countdown {
z-index: -1;
opacity: 0;
-moz-transition: all 600ms ease;
}
-.banner.visible {
+#banner-countdown.visible {
z-index: 1;
opacity: 1;
-moz-transition: all 600ms ease;
}
-.banner:before {
- content: "";
- display: inline-block;
- height: 100%;
- vertical-align: middle;
- width: 1px;
-}
-.banner:after {
- content: "";
- display: inline-block;
- height: 100%;
- vertical-align: middle;
- width: 1px;
-}
-.banner > p {
- display: inline-block;
- font-size: 1.56rem;
- line-height: 2.34rem;
- max-width: 75%;
- vertical-align: middle;
- white-space: normal;
- color: #FFFFFF;
- font-family: "MozTT",Sans-serif;
-}
-.banner > p > strong {
- color: #0995B0;
- font-weight: normal;
- text-transform: uppercase;
+#banner-countdown > p > strong {
white-space: nowrap;
}
+
/* localization */
body.hidden *[data-l10n-id] {
visibility: hidden;
View
15 apps/communications/contacts/js/contacts_details.js
@@ -165,7 +165,7 @@ contacts.Details = (function() {
};
var isFavorite = function isFavorite(contact) {
- return contact != null & contact.category != null &&
+ return contact != null && contact.category != null &&
contact.category.indexOf('favorite') != -1;
};
@@ -187,6 +187,9 @@ contacts.Details = (function() {
}
}
+ // Disabling button while saving the contact
+ favoriteMessage.style.pointerEvents = 'none';
+
var request = navigator.mozContacts.save(contact);
request.onsuccess = function onsuccess() {
var cList = contacts.List;
@@ -207,19 +210,23 @@ contacts.Details = (function() {
cList.refresh(contact);
}
renderFavorite(contactData);
+ favoriteMessage.style.pointerEvents = 'auto';
}, function onError() {
console.error('Error reloading contact');
+ favoriteMessage.style.pointerEvents = 'auto';
});
};
request.onerror = function onerror() {
+ favoriteMessage.style.pointerEvents = 'auto';
console.error('Error saving favorite');
};
};
var toggleFavoriteMessage = function toggleFavMessage(isFav) {
- favoriteMessage.textContent = !isFav ?
- _('addFavorite') :
- _('removeFavorite');
+ var cList = favoriteMessage.classList;
+ var text = isFav ? _('removeFavorite') : _('addFavorite');
+ favoriteMessage.textContent = text;
+ isFav ? cList.add('on') : cList.remove('on');
};
var renderOrg = function cd_renderOrg(contact) {
View
16 apps/communications/contacts/js/contacts_settings.js
@@ -8,7 +8,7 @@ var contacts = window.contacts || {};
**/
contacts.Settings = (function() {
- var orderCheckbox,
+ var orderItem,
orderByLastName,
simImportLink,
fbImportOption,
@@ -42,7 +42,7 @@ contacts.Settings = (function() {
var updateOrderingUI = function updateOrderingUI() {
var value = newOrderByLastName === null ? orderByLastName :
newOrderByLastName;
- orderCheckbox.checked = value;
+ orderItem.checked = value;
};
var cleanMessage = function cleanMessage() {
@@ -54,8 +54,8 @@ contacts.Settings = (function() {
// Initialises variables and listener for the UI
var initContainers = function initContainers() {
- orderCheckbox = document.querySelector('[name="order.lastname"]');
- orderCheckbox.addEventListener('change', onOrderingChange.bind(this));
+ orderItem = document.getElementById('settingsOrder');
+ orderItem.addEventListener('click', onOrderingChange.bind(this));
simImportLink = document.querySelector('[data-l10n-id="importSim"]');
simImportLink.addEventListener('click',
@@ -100,7 +100,9 @@ contacts.Settings = (function() {
return;
}
- enableSIMImport(conn.cardState == 'ready');
+ // Card should either be "ready" (connected to network) or "null" (card in
+ // phone but cannot connect to network for some reason).
+ enableSIMImport(conn.cardState == 'ready' || conn.cardState == null);
};
// Disables/Enables the actions over the sim import functionality
@@ -325,7 +327,9 @@ contacts.Settings = (function() {
// Listens for any change in the ordering preferences
var onOrderingChange = function onOrderingChange(evt) {
- newOrderByLastName = evt.target.checked;
+ var checkBox = evt.target.querySelector('[name="order.lastname"]');
+ checkBox.checked = !checkBox.checked;
+ newOrderByLastName = checkBox.checked;
asyncStorage.setItem(ORDER_KEY, newOrderByLastName);
updateOrderingUI();
};
View
7 apps/communications/contacts/style/app.css
@@ -467,7 +467,12 @@ li button.icon-link:before {
/* Extending icons */
li button.icon-fav:before {
- background-image: url(/contacts/style/images/icon-fav-button.png);
+ background-image: url(/contacts/style/images/icon-fav-button-off.png);
+ right: 0.5rem;
+}
+
+li button.icon-fav.on:before {
+ background-image: url(/contacts/style/images/icon-fav-button-on.png);
}
li button.icon-fb-profile:before {
View
30 apps/communications/contacts/style/contacts.css
@@ -215,6 +215,12 @@ hr {
}
/* Overriding Input areas BB */
+form p input + button[type="reset"].hide,
+form p textarea + button[type="reset"].hide {
+ display: block!important;
+ opacity: 0;
+ pointer-events: none;
+}
fieldset legend.action {
padding-right: 1.8rem;
@@ -336,6 +342,11 @@ section[role="region"] > header .icon.icon-settings
padding: 0;
}
+/* Order switch */
+#view-settings [data-type="list"] li#settingsOrder aside {
+ pointer-events: none;
+}
+
/* Cutom FB item */
#view-settings [data-type="list"] .fb-item {
height: auto;
@@ -356,8 +367,9 @@ section[role="region"] > header .icon.icon-settings
}
#view-settings [data-type="list"] .fb-item aside {
- position: static;
width: 6.5rem;
+ height: 6rem;
+ pointer-events: none;
}
#view-settings [data-type="list"] .fb-item aside label {
@@ -365,6 +377,20 @@ section[role="region"] > header .icon.icon-settings
right: 0;
}
+#view-settings [data-type="list"] .fb-item[aria-disabled="true"] {
+ pointer-events: none;
+}
+
+#view-settings [data-type="list"] .fb-item[aria-disabled="true"]:after {
+ display: none;
+}
+
+#view-settings [data-type="list"] .fb-item[aria-disabled="true"] aside {
+ opacity: 0.3;
+}
+
+
+
/* Extending BB lists components*/
#view-settings [data-type="list"] li aside {
pointer-events: auto;
@@ -392,6 +418,7 @@ section[role="region"] > header .icon.icon-settings
/* Extending icon types*/
#view-settings [data-type="list"] li button.icon-sim:before {
background-image: url(/contacts/style/images/import_SIM.png);
+ background-size: 1.6rem;
}
@@ -478,3 +505,4 @@ section[role="region"] > header .icon.icon-settings
left: -100%;
opacity: 0;
}
+
View
BIN  apps/communications/contacts/style/images/icon-fav-button-off.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  apps/communications/contacts/style/images/icon-fav-button-on.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  apps/communications/contacts/style/images/icon-fav-button.png
Deleted file not rendered
View
2  apps/communications/dialer/js/keypad.js
@@ -39,7 +39,7 @@ var TonePlayer = {
return;
this._audio = new Audio();
- this._audio.mozAudioChannelType = 'normal';
+ this._audio.mozAudioChannelType = 'ringer';
},
// Generating audio frames for the 2 given frequencies
View
20 apps/communications/dialer/js/lazy_l10n.js
@@ -13,11 +13,11 @@ var LazyL10n = {
return;
}
-
// Adding the l10n JS files to the DOM
// the l10n resources
var l10nScript = document.createElement('script');
l10nScript.src = '/shared/js/l10n.js';
+ l10nScript.onload = this._finalize.bind(this, callback);
document.head.appendChild(l10nScript);
var l10nDateScript = document.createElement('script');
@@ -25,20 +25,20 @@ var LazyL10n = {
document.head.appendChild(l10nDateScript);
this._inDOM = true;
-
- this._waitForLoad(callback);
},
_waitForLoad: function ll10n_waitForLoad(callback) {
- var self = this;
+ var finalize = this._finalize.bind(this);
window.addEventListener('localized', function onLocalized() {
window.removeEventListener('localized', onLocalized);
-
- document.documentElement.lang = navigator.mozL10n.language.code;
- document.documentElement.dir = navigator.mozL10n.language.direction;
-
- self._loaded = true;
- callback(navigator.mozL10n.get);
+ finalize(callback);
});
+ },
+
+ _finalize: function ll10n_finalize(callback) {
+ document.documentElement.lang = navigator.mozL10n.language.code;
+ document.documentElement.dir = navigator.mozL10n.language.direction;
+ this._loaded = true;
+ callback(navigator.mozL10n.get);
}
};
View
7 apps/communications/dialer/js/recents.js
@@ -278,8 +278,9 @@ var Recents = {
return;
}
var action = event.target.dataset.action;
- var noMissedCallsSelector = '.log-item[data-type^=dialing],' +
- '.log-item[data-type=incoming-connected]';
+ var noMissedCallsSelector = '.log-item[data-type^=dialing]' +
+ ':not(.collapsed), ' +
+ '.log-item[data-type=incoming-connected]:not(.collapsed)';
var noMissedCallsItems = document.querySelectorAll(noMissedCallsSelector);
var noMissedCallsLength = noMissedCallsItems.length;
var i;
@@ -670,6 +671,7 @@ var Recents = {
'</div>';
navigator.mozL10n.translate(this.recentsContainer);
this.recentsIconEdit.parentNode.setAttribute('aria-disabled', 'true');
+ this.allFilter.classList.add('selected');
return;
}
@@ -847,6 +849,7 @@ var Recents = {
groupCalls: function re_groupCalls(olderCallEl, newerCallEl, count, inc) {
olderCallEl.classList.add('hide');
+ olderCallEl.classList.add('collapsed');
count += inc;
var entryCountNode = newerCallEl.querySelector('.entry-count');
entryCountNode.innerHTML = '&#160;(' + count + ')';
View
2  apps/communications/dialer/js/utils.js
@@ -66,7 +66,7 @@ var Utils = {
}
if (multipleNumbersSameCarrier) {
- additionalInfo = additionalInfo + ', ' + phoneNumber;
+ additionalInfo = additionalInfo + ', ' + contactPhoneNumber;
} else {
additionalInfo = additionalInfo + ', ' + phoneCarrier;
}
View
2  apps/communications/dialer/style/keypad.css
@@ -23,7 +23,7 @@
#phone-number-view-container {
width: 100%;
height: -moz-calc(100% - 34.5rem);
- background: #242B36;
+ background: #2C3743;
text-align: center;
display: table;
table-layout: fixed;
View
36 apps/communications/ftu/css/style.css
@@ -199,45 +199,54 @@ html, body {
/*
Pin code screen
*/
+#unlock-sim-screen {
+ z-index: 2000;
+}
-#pincode-screen .pin_container {
+#unlock-sim-screen .unlock_container {
height: calc(100% - 10rem);
}
-#pincode-screen section header {
+#unlock-sim-screen section label {
padding: 1.5rem 3rem 0.5rem 3rem;
color: black;
font-size: 1.5rem;
+ width: auto;
+ height: 2rem;
}
-#pincode-screen .input-wrapper {
+#unlock-sim-screen .input-wrapper {
padding: 0 1.5rem;
position: relative;
}
-#pincode-screen #pin-error {
+#unlock-sim-screen .info {
+ font-size: 1.5rem;
+ padding: 1rem 1.5rem;
+}
+
+#unlock-sim-screen .error {
padding: 1rem 2rem;
font-size: 1.5rem;
color: red;
}
-#pincode-screen #pin-input.onerror {
- border-color: red;
+#unlock-sim-screen .onerror {
+ border: 0.1rem solid red;
}
-#pincode-screen .input-wrapper input {
+#unlock-sim-screen .input-wrapper input {
font-size: 2rem;
padding-left: 1.5rem;
- pointer-events: none;
}
-#pincode-screen #fake-sim-pin {
+#unlock-sim-screen .fake-input {
margin-top: -4rem;
opacity: 0;
- pointer-events: auto;
+
}
-#pincode-screen input[type="number"] {
+#unlock-sim-screen input[type="number"] {
-moz-box-sizing: border-box;
display: block;
overflow: hidden;
@@ -245,6 +254,11 @@ html, body {
height: 4rem;
resize: none;
padding: 0 0.8rem;
+ pointer-events: auto;
+}
+
+#unlock-sim-screen input[type="password"] {
+ pointer-events: none;
}
/*
View
51 apps/communications/ftu/index.html
@@ -63,24 +63,49 @@
<section id="splash-screen" role="region" class="show">
</section>
- <section id="pincode-screen" role="region" class="skin-organic">
+ <section id="unlock-sim-screen" role="region" class="skin-organic">
<header>
- <h1 data-l10n-id="pincode">Pin code</h1>
+ <h1 id="unlock-sim-header" data-l10n-id="pincode2">Enter PIN code</h1>
</header>
- <section class="pin_container">
- <header data-l10n-id="type_pin">Type your PIN code:</header>
- <section class="input-wrapper">
- <input id="pin-input" name="simpin" type="password" size="8" maxlength="8" />
- <input id="fake-sim-pin" name="fakesimpin" type="number" size="8" maxlength="8" />
- <div id="pin-error"></div>
+ <article role="main">
+ <section id="pincode-screen" role="region">
+ <label id="pin-label" data-l10n-id="type_pin">Type your PIN code</label>
+ <section class="input-wrapper">
+ <input id="pin-input" name="simpin" type="password" size="8" maxlength="8" />
+ <input id="fake-pin-input" class="fake-input" name="fake-simpin" type="number" size="8" maxlength="8" />
+ <div id="pin-error" class="hidden error"></div>
+ </section>
</section>
- </section>
+
+ <section id="pukcode-screen" role="region">
+ <label id="puk-label" data-l10n-id="simLocked">The SIM card is locked</label>
+ <section class="input-wrapper">
+ <input id="puk-input" name="simpuk" type="password" size="8" maxlength="8" />
+ <input id="fake-puk-input" class="fake-input" name="fake-simpuk" type="number" size="8" maxlength="8" />
+ <div id="puk-info" class="info" data-l10n-id="pukError">You must enter the Personal Unlocking Key (PUK) Code for the SIM card. Refer to your SIM card documentation or contact your carrier for more information.</div>
+ <div id="puk-error" class="hidden error"></div>
+ </section>
+ <label id="newpin" data-l10n-id="create_newpin">Create new PIN (4 to 8 digits)</label>
+ <section class="input-wrapper">
+ <input id="newpin-input" name="newpin" type="password" size="8" maxlength="8" />
+ <input id="fake-newpin-input" class="fake-input" name="fake-newpin" type="number" size="8" maxlength="8" />
+ <div id="newpin-error" class="hidden error"></div>
+ </section>
+ <label id="confirm-newpin" data-l10n-id="confirm_newpin">Confirm new PIN</label>
+ <section class="input-wrapper">
+ <input id="confirm-newpin-input" name="confirm-newpin" type="password" size="8" maxlength="8" />
+ <input id="fake-confirm-newpin-input" class="fake-input" name="fake-confirm-newpin" type="number" size="8" maxlength="8" />
+ <div id="confirm-newpin-error" class="hidden error"></div>
+ </section>
+ </section>
+ </article>
+
<nav role="navigation">
<button id="skip-pin-button" class="button-left" data-l10n-id="skip">
Skip
</button>
- <button id="unlock-sim-button" class="recommend" data-l10n-id="done">
- Done
+ <button id="unlock-sim-button" class="recommend" data-l10n-id="send">
+ Send
</button>
</nav>
</section>
@@ -510,7 +535,7 @@ <h1 data-l10n-id='offline-newsletter-dialog-title'>You must be connected to the
</menu>
</section>
</form>
-
+
<form role='dialog' data-type='confirm' id='invalid-email-error-dialog'>
<section>
<h1 data-l10n-id='invalid-email-dialog-title'>Your email is not valid</h1>
@@ -520,7 +545,7 @@ <h1 data-l10n-id='invalid-email-dialog-title'>Your email is not valid</h1>
</menu>
</section>
</form>
-
+
<section id="loading-overlay" role="region" class="view">
<article class="loading-container">
<header class="loading-header" id="loading-header">
View
25 apps/communications/ftu/js/app.js
@@ -3,9 +3,10 @@
var _ = navigator.mozL10n.get;
var AppManager = {
- thereIsSIM: false,
+
init: function init() {
this.isLocalized = true;
+ SimManager.init();
WifiManager.init();
FacebookIntegration.init();
TimeManager.init();
@@ -19,9 +20,10 @@ var AppManager = {
setTimeout(function() {
// For desktop
window.location.hash = '#';
- UIManager.splashScreen.classList.remove('show');
UIManager.activationScreen.classList.add('show');
window.location.hash = '#languages';
+
+ UIManager.splashScreen.classList.remove('show');
}, kSplashTimeout);
return;
}
@@ -31,23 +33,8 @@ var AppManager = {
// TODO Include VIVO SIM Card management
// https://bugzilla.mozilla.org/show_bug.cgi?id=801269#c6
var self = this;
- var req = conn.getCardLock('pin');
- req.onsuccess = function spl_checkSuccess() {
- AppManager.thereIsSIM = true;
- if (req.result.enabled) {
- UIManager.pincodeScreen.classList.add('show');
- document.getElementById('fake-sim-pin').focus();
- } else {
- // Set the unlocked status so we can still import
- SimManager.unlocked = true;
- UIManager.activationScreen.classList.add('show');
- window.location.hash = '#languages';
- }
- };
- req.onerror = function() {
- UIManager.activationScreen.classList.add('show');
- window.location.hash = '#languages';
- };
+ SimManager.handleCardState();
+
// Remove the splash
UIManager.splashScreen.classList.remove('show');
}, kSplashTimeout);
View
34 apps/communications/ftu/js/language.js
@@ -2,31 +2,33 @@
var LanguageManager = {
init: function init() {
- var panel = document.getElementById('languages');
- this.buildLanguageList(panel.querySelector('ul'));
- panel.addEventListener('change', this);
+ this.getCurrentLanguage(this.buildLanguageList.bind(this));
+ document.getElementById('languages').addEventListener('change', this);
},
handleEvent: function handleEvent(evt) {
- if (evt.target.name != 'language.current') {
+ var settings = window.navigator.mozSettings;
+ if (!settings || evt.target.name != 'language.current')
return true;
- }
+ settings.createLock().set({'language.current': evt.target.value});
+ return false;
+ },
+
+ getCurrentLanguage: function settings_getCurrent(callback) {
var settings = window.navigator.mozSettings;
- if (!settings.createLock) {
- return true;
- }
+ if (!settings || !settings.createLock || !callback)
+ return;
+
var req = settings.createLock().get('language.current');
- req.onsuccess = function() {
- settings.createLock().set({'language.current': evt.target.value});
+ req.onsuccess = function _onsuccess() {
+ callback(req.result['language.current']);
};
- req.onerror = function() {
- console.error('Error changing language');
+ req.onerror = function _onerror() {
+ console.error('Error checking language');
};
-
- return false;
},
getSupportedLanguages: function settings_getLanguages(callback) {
@@ -55,9 +57,9 @@ var LanguageManager = {
}
},
- buildLanguageList: function settings_buildLanguageList(container) {
+ buildLanguageList: function settings_buildLanguageList(uiLanguage) {
+ var container = document.querySelector('#languages ul');
container.innerHTML = '';
- var uiLanguage = document.documentElement.lang || 'en-US';
this.getSupportedLanguages(function fillLanguageList(languages) {
for (var lang in languages) {
var input = document.createElement('input');
View
9 apps/communications/ftu/js/navigation.js
@@ -84,7 +84,7 @@ var Navigation = {
self.currentStep--;
if (self.currentStep > 0) {
var followingStep = steps[self.currentStep];
- if (followingStep.requireSIM && !SimManager.unlocked) {
+ if (followingStep.requireSIM && !SimManager.available()) {
goToStep();
} else {
self.manageStep();
@@ -115,7 +115,7 @@ var Navigation = {
return;
}
var followingStep = steps[self.currentStep];
- if (followingStep.requireSIM && !SimManager.unlocked) {
+ if (followingStep.requireSIM && !SimManager.available()) {
goToStepForward();
} else {
self.manageStep();
@@ -192,13 +192,14 @@ var Navigation = {
var fbOption = document.getElementById('fb_import');
var simOption = document.getElementById('sim-import-button');
// If there is an unlocked SIM we activate import from SIM
- if (AppManager.thereIsSIM && SimManager.unlocked) {
+ if (SimManager.available()) {
simOption.classList.remove('disabled');
} else {
simOption.classList.add('disabled');
}
// If we have 3G or Wifi activate FB import
- if (WifiManager.api.connection.status === 'connected' || DataMobile.isDataAvailable) {
+ if (WifiManager.api.connection.status === 'connected' ||
+ DataMobile.isDataAvailable) {
fbOption.classList.remove('disabled');
} else {
fbOption.classList.add('disabled');
View
183 apps/communications/ftu/js/sim_manager.js
@@ -1,16 +1,83 @@
'use strict';
var SimManager = {
- unlocked: false,
- showScreen: function sm_showScreen() {
+ init: function sm_init() {
+ this.mobConn = window.navigator.mozMobileConnection;
+ if (!this.mobConn)
+ return;
+
+ this.mobConn.addEventListener('icccardlockerror',
+ this.handleUnlockError.bind(this));
+ this.mobConn.addEventListener('cardstatechange',
+ this.handleCardState.bind(this));
+ },
+
+ handleUnlockError: function sm_handleUnlockError(data) {
+ switch (data.lockType) {
+ case 'pin':
+ UIManager.pinInput.value = '';
+ UIManager.fakePinInput.value = '';
+ UIManager.pinInput.classList.add('onerror');
+ UIManager.pinError.innerHTML = _('pinErrorMsg');
+ UIManager.pinError.classList.remove('hidden');
+ UIManager.pinLabel.innerHTML = _('pinAttemptMsg2', {n: data.retryCount});
+ if (data.retryCount == 1)
+ UIManager.pinError.innerHTML += _('pinLastChanceMsg');
+ break;
+ case 'puk':
+ UIManager.pukInput.value = '';
+ UIManager.fakePukInput.value = '';
+ UIManager.pukInput.classList.add('onerror');
+ UIManager.pukError.innerHTML = _('pukErrorMsg');
+ UIManager.pukError.classList.remove('hidden');
+ UIManager.pukInfo.classList.add('hidden');
+ UIManager.pukLabel.innerHTML = _('pukAttemptMsg', {n: data.retryCount});
+ // TODO what if counter gets to 0 ??
+ break;
+ }
+ },
+
+ available: function sm_available() {
+ if (!this.mobConn)
+ return false;
+ return (this.mobConn.cardState == 'ready');
+ },
+
+ handleCardState: function sm_handleCardState() {
+ switch (this.mobConn.cardState) {
+ case 'pinRequired':
+ this.showPinScreen();
+ break;
+ case 'pukRequired':
+ this.showPukScreen();
+ break;
+ default:
+ this.skip();
+ break;
+ }
+ },
+
+ showPinScreen: function sm_showScreen() {
+ UIManager.activationScreen.classList.remove('show');
+ UIManager.unlockSimScreen.classList.add('show');
UIManager.pincodeScreen.classList.add('show');
+ UIManager.fakePinInput.focus();
+ },
+
+ showPukScreen: function sm_showPukScreen() {
+ UIManager.unlockSimScreen.classList.add('show');
UIManager.activationScreen.classList.remove('show');
- UIManager.fakeSimPin.focus();
+ UIManager.pincodeScreen.classList.remove('show');
+ UIManager.pukcodeScreen.classList.add('show');
+ UIManager.unlockSimHeader.innerHTML = _('pukcode');
+ UIManager.fakePukInput.focus();
},
hideScreen: function sm_hideScreen() {
+ UIManager.unlockSimScreen.classList.remove('show');
UIManager.pincodeScreen.classList.remove('show');
+ UIManager.pukcodeScreen.classList.remove('show');
UIManager.activationScreen.classList.add('show');
window.location.hash = '#languages';
Navigation.currentStep = 1;
@@ -21,6 +88,87 @@ var SimManager = {
this.hideScreen();
},
+ unlock: function sm_unlock() {
+ switch (this.mobConn.cardState) {
+ case 'pinRequired':
+ this.unlockPin();
+ break;
+ case 'pukRequired':
+ this.unlockPuk();
+ break;
+ }
+ },
+
+ unlockPin: function sm_unlockPin() {
+ var pin = UIManager.pinInput.value;
+ if (pin.length < 4 || pin.length > 8) {
+ UIManager.pinError.innerHTML = _('pinValidation');
+ UIManager.pinInput.classList.add('onerror');
+ UIManager.pinError.classList.remove('hidden');
+ return;
+ } else {
+ UIManager.pinInput.classList.remove('onerror');
+ UIManager.pinError.classList.add('hidden');
+ }
+
+ // Unlock SIM
+ var options = {lockType: 'pin', pin: pin };
+ var req = this.mobConn.unlockCardLock(options);
+ req.onsuccess = function sm_unlockSuccess() {
+ this.hideScreen();
+ }.bind(this);
+ },
+
+ clearFields: function sm_clearFields() {
+ UIManager.pukInput.classList.remove('onerror');
+ UIManager.pukError.innerHTML = '';
+ UIManager.pukError.classList.add('hidden');
+
+ UIManager.newpinInput.classList.remove('onerror');
+ UIManager.newpinError.innerHTML = '';
+ UIManager.newpinError.classList.add('hidden');
+
+ UIManager.confirmNewpinInput.classList.remove('onerror');
+ UIManager.confirmNewpinError.innerHTML = '';
+ UIManager.confirmNewpinError.classList.add('hidden');
+ },
+ unlockPuk: function sm_unlockPuk() {
+ this.clearFields();
+ var pukCode = UIManager.pukInput.value;
+ if (pukCode.length !== 8) {
+ UIManager.pukError.innerHTML = _('pukValidation');
+ UIManager.pukError.classList.remove('hidden');
+ UIManager.pukInfo.classList.add('hidden');
+ UIManager.pukInput.classList.add('onerror');
+ UIManager.pukError.focus();