]> git.proxmox.com Git - mirror_novnc.git/blobdiff - include/default_controls.js
State machine refactoring.
[mirror_novnc.git] / include / default_controls.js
index 55ba75f8c6b150264d7ece99b404873ad28be522..a6c7ab0bf496bec643ed9d7717bfdaaac2a7d310 100644 (file)
@@ -82,6 +82,12 @@ load: function(target) {
         };
 },
 
+setPassword: function() {
+    console.log("setPassword");
+    RFB.sendPassword($('VNC_password').value);
+    return false;
+},
+
 sendCtrlAltDel: function() {
     RFB.sendCtrlAltDel();
 },
@@ -94,6 +100,7 @@ updateState: function(state, msg) {
     cad = $('sendCtrlAltDelButton');
     switch (state) {
         case 'failed':
+        case 'fatal':
             c.disabled = true;
             cad.disabled = true;
             klass = "VNC_status_error";
@@ -106,6 +113,7 @@ updateState: function(state, msg) {
             klass = "VNC_status_normal";
             break;
         case 'disconnected':
+        case 'loaded':
             c.value = "Connect";
             c.onclick = DefaultControls.connect;
 
@@ -113,6 +121,14 @@ updateState: function(state, msg) {
             cad.disabled = true;
             klass = "VNC_status_normal";
             break;
+        case 'password':
+            c.value = "Send Password";
+            c.onclick = DefaultControls.setPassword;
+
+            c.disabled = false;
+            cad.disabled = true;
+            klass = "VNC_status_warn";
+            break;
         default:
             c.disabled = true;
             cad.disabled = true;