use which instead of keycode
[xtuple] / lib / enyo-x / source / app.js
index 4eb74bf..ff4a060 100644 (file)
@@ -1,7 +1,7 @@
 /*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 () {
 
@@ -44,7 +44,7 @@ white:true*/
     */
     handleKeyDown: function (inSender, inEvent) {
       var that = this,
-        keyCode = inEvent.keyCode,
+        keyCode = inEvent.which,
         exoticTransforms = {},
         numberShiftCharacters = ")!@#$%^&*(";
 
@@ -331,12 +331,23 @@ white:true*/
         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);
 
@@ -356,6 +367,10 @@ white:true*/
     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