Client: CLI access to get/set/save settings
authorDarren <darren@darrenwhitlen.com>
Mon, 5 Nov 2012 20:05:32 +0000 (20:05 +0000)
committerDarren <darren@darrenwhitlen.com>
Mon, 5 Nov 2012 20:05:32 +0000 (20:05 +0000)
client/assets/dev/model_application.js

index 6d90b70aead3cf2f70430ff10321adfe0366d374..338e574761bc940124df2cd380f7bc392533b87e 100644 (file)
@@ -757,6 +757,32 @@ _kiwi.model.Application = function () {
                 $script(ev.params[0] + '?' + (new Date().getTime()));\r
             });\r
 \r
+            \r
+            controlbox.on('command_set', function (ev) {\r
+                if (!ev.params[0]) return;\r
+\r
+                var setting = ev.params[0],\r
+                    value;\r
+\r
+                // Do we have a second param to set a value?\r
+                if (ev.params[1]) {\r
+                    ev.params.shift();\r
+\r
+                    value = ev.params.join(' ');\r
+                    _kiwi.global.settings.set(setting, value);\r
+                }\r
+\r
+                // Read the value to the user\r
+                _kiwi.app.panels.active.addMsg('', setting + ' = ' + _kiwi.global.settings.get(setting));\r
+            });\r
+\r
+\r
+            controlbox.on('command_save', function (ev) {\r
+                _kiwi.global.settings.save();\r
+                _kiwi.app.panels.active.addMsg('', 'Settings have been saved');\r
+            });\r
+\r
+\r
             controlbox.on('command_alias', function (ev) {\r
                 var name, rule;\r
 \r