/*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, regexp:true, undef:true, trailing:true,
white:true*/
-/*global enyo:true, XT:true, _:true, document:true, window:true, XM:true */
+/*global Backbone:true, enyo:true, XT:true, _:true, document:true, window:true, XM:true */
(function () {
*/
handleKeyDown: function (inSender, inEvent) {
var that = this,
- keyCode = inEvent.keyCode;
+ keyCode = inEvent.which,
+ exoticTransforms = {},
+ numberShiftCharacters = ")!@#$%^&*(";
+
+ // exotic transforms. sorta hackish, but the inEvent codes coming
+ // through are not always the ones we want
+
+ // http://stackoverflow.com/questions/1898129/javascript-subtract-keycode
+ exoticTransforms[XT.ASCII.VULGAR_HALF] = XT.ASCII.N_DASH;
+ if (_.contains(Object.keys(exoticTransforms), "" + keyCode)) {
+ // account for inexplicably wrongly mapped keys
+ keyCode = exoticTransforms[keyCode];
+ } else if (inEvent.shiftKey && keyCode >= XT.ASCII.ZERO && keyCode <= XT.ASCII.NINE) {
+ // shift-number should be transformed into the appropriate character
+ // XXX jingoistic implementation
+ keyCode = numberShiftCharacters.charCodeAt(keyCode - XT.ASCII.ZERO);
+ }
// remember the last 10 key presses
this._keyBufferArray.push(keyCode);
return;
}
- if (keyCode === 189) {
- // XXX FIXME hack. Dashes aren't coming through as dashes from my keyboard
- keyCode = '-'.charCodeAt(0);
- }
if (inEvent.altKey) {
inEvent.cancelBubble = true;
inEvent.returnValue = false;
details = XT.session.details;
loginInfo.setContent(details.username + " ยท " + details.organization);
this.state = RUNNING;
+ that.startupProcess();
+
+ // TODO - 7. Initiate Empty Database Startup "checklist" process for empty/quick start databases
+ } else if (this.state === RUNNING) {
+ // No process in place so proceed to activate
+ XM.Tuplespace.trigger("activate");
XT.app.$.postbooks.activate();
+
+ // Send no Base Currency event
+ if (!XT.baseCurrency()) {
+ this.waterfallNoBaseCurr();
+ }
+ Backbone.history.start();
}
},
start: function (debug) {
- if (this.getIsStarted()) { return; }
+ if (this.getIsStarted()) {return; }
XT.app = this;
this.setDebug(debug);
togglePullout: function (inSender, inEvent) {
this.$.pullout.togglePullout(inSender, inEvent);
},
+ waterfallNoBaseCurr: function (inSender, inEvent) {
+ this.$.postbooks.waterfall("onNoBaseCurr", inEvent);
+ return true;
+ },
waterfallSearch: function (inSender, inEvent) {
this.$.postbooks.waterfall("onSearch", inEvent);
return true; // don't want to double up