Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Merge pull request #12322 from davidflanagan/autocorrect-config"
Browse files Browse the repository at this point in the history
This reverts commit 38456b0, reversing
changes made to 6b0a810.
  • Loading branch information
wanderview committed Oct 19, 2013
1 parent 0b28ac4 commit 8bfeb8f
Show file tree
Hide file tree
Showing 75 changed files with 1,528 additions and 1,686 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -73,6 +73,3 @@ manifest.appcache
apps/*, external-apps/* & GAIA_DISTRIBUTION_DIR

/build/config.js
/apps/keyboard/js/imes/latin/dictionaries/*.dict
/apps/keyboard/js/layouts/*.js
/apps/keyboard/js/manifest.webapp
16 changes: 2 additions & 14 deletions Makefile
Expand Up @@ -263,9 +263,6 @@ GAIA_DEFAULT_LOCALE?=en-US
GAIA_INLINE_LOCALES?=1
GAIA_CONCAT_LOCALES?=1

# This variable is for customizing the keyboard layouts in a build.
GAIA_KEYBOARD_LAYOUTS?=en,pt-BR,es,de,fr,pl

ifeq ($(SYS),Darwin)
MD5SUM = md5 -r
SED_INPLACE_NO_SUFFIX = /usr/bin/sed -i ''
Expand Down Expand Up @@ -301,6 +298,7 @@ MARIONETTE_HOST ?= localhost
MARIONETTE_PORT ?= 2828
TEST_DIRS ?= $(CURDIR)/tests


define BUILD_CONFIG
{ \
"GAIA_DIR" : "$(CURDIR)", \
Expand All @@ -316,7 +314,6 @@ define BUILD_CONFIG
"GAIA_PORT" : "$(GAIA_PORT)", \
"GAIA_LOCALES_PATH" : "$(GAIA_LOCALES_PATH)", \
"LOCALES_FILE" : "$(subst \,\\,$(LOCALES_FILE))", \
"GAIA_KEYBOARD_LAYOUTS" : "$(GAIA_KEYBOARD_LAYOUTS)", \
"BUILD_APP_NAME" : "$(BUILD_APP_NAME)", \
"PRODUCTION" : "$(PRODUCTION)", \
"GAIA_OPTIMIZE" : "$(GAIA_OPTIMIZE)", \
Expand All @@ -339,7 +336,7 @@ export BUILD_CONFIG

# Generate profile/

$(PROFILE_FOLDER): multilocale keyboard applications-data preferences local-apps app-makefiles test-agent-config offline contacts extensions install-xulrunner-sdk .git/hooks/pre-commit $(PROFILE_FOLDER)/settings.json create-default-data $(PROFILE_FOLDER)/installed-extensions.json
$(PROFILE_FOLDER): multilocale applications-data preferences local-apps app-makefiles test-agent-config offline contacts extensions install-xulrunner-sdk .git/hooks/pre-commit $(PROFILE_FOLDER)/settings.json create-default-data $(PROFILE_FOLDER)/installed-extensions.json
ifeq ($(BUILD_APP_NAME),*)
@echo "Profile Ready: please run [b2g|firefox] -profile $(CURDIR)$(SEP)$(PROFILE_FOLDER)"
endif
Expand Down Expand Up @@ -385,15 +382,6 @@ ifneq ($(DEBUG),1)
endif
endif

.PHONY: keyboard
keyboard: install-xulrunner-sdk
@# Delete dictionaries and layouts from the last time
@rm -f apps/keyboard/js/layouts/*.js
@rm -f apps/keyboard/js/imes/latin/dictionaries/*.dict
@# Now copy the current set of dictionaries and layouts
@# And also create a custom manifest.webapp file
@$(call run-js-command, configure-keyboard)

app-makefiles:
@for d in ${GAIA_APPDIRS}; \
do \
Expand Down
15 changes: 0 additions & 15 deletions apps/keyboard/CONFIGURE

This file was deleted.

74 changes: 30 additions & 44 deletions apps/keyboard/js/keyboard.js
@@ -1,3 +1,6 @@
/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */

/*
* keyboard.js:
*
Expand Down Expand Up @@ -503,54 +506,33 @@ function handleKeyboardSound() {
function setKeyboardName(name, callback) {
var keyboard;

loadLayout(name, function(layout) {
if (layout.imEngine) {
loadIMEngine(name, function() {
setInputMethod(InputMethods[layout.imEngine]);
});
} else {
setInputMethod(defaultInputMethod);
}

function setInputMethod(im) {
if (im !== inputMethod && inputMethod && inputMethod.deactivate)
inputMethod.deactivate();
inputMethod = im;
callback();
}
});

function loadLayout(name, callback) {
if (name in Keyboards) {
setLayout(name);
if (name in Keyboards) {
keyboard = Keyboards[name];
keyboardName = name;
}
else {
var alias = keyboardAlias[name];
if (alias in Keyboards) {
keyboard = Keyboards[alias];
keyboardName = alias;
}
else {
var alias = keyboardAlias[name];
if (alias in Keyboards) {
setLayout(alias);
}
else {
// If we have not already loaded the layout, load it now
var layoutFile = 'js/layouts/' + name + '.js';
var script = document.createElement('script');
script.src = layoutFile;
script.onload = function() {
setLayout(name);
};
script.onerror = function() {
// If this happens, we have a misconfigured build and the
// keyboard manifest does not match the layouts in js/layouts/
console.error('Cannot load keyboard layout', layoutFile);
};
document.head.appendChild(script);
}
console.warn('Unknown keyboard name', name);
return;
}
}

function setLayout(name) {
keyboardName = name;
keyboard = Keyboards[name];
callback(keyboard);
}
if (inputMethod.deactivate)
inputMethod.deactivate();

if (keyboard.imEngine) {
loadIMEngine(name, function() {
inputMethod = InputMethods[keyboard.imEngine];
callback();
});
} else {
inputMethod = defaultInputMethod;
callback();
}
}

Expand Down Expand Up @@ -581,6 +563,10 @@ function handleNewKeyboards() {
Array.prototype.push.apply(enabledKeyboardNames,
defaultKeyboardNames);

// Now load each of these keyboards and their input methods
for (var i = 0; i < enabledKeyboardNames.length; i++)
loadKeyboard(enabledKeyboardNames[i]);

// If the keyboard has been disabled, reset keyboardName allowing it to be
// properly set when showing the keyboard
if (enabledKeyboardNames.indexOf(keyboardName) == -1)
Expand Down

0 comments on commit 8bfeb8f

Please sign in to comment.