How to use the ko/prefs.getBoolean function in ko

To help you get started, we’ve selected a few ko examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Komodo / KomodoEdit / src / modules / scope_files / content / files.js View on Github external
}
                }
            }
        }

        // Set includes/excludes.
        var opts_prefs = ((curProject && subscope.path.indexOf(curProject.liveDirectory) === 0) ?
                          curProject.prefset :
                          prefs);
        opts["excludes"] = opts_prefs.getString("import_exclude_matches");
        opts["includes"] = opts_prefs.getString("import_include_matches");

        opts["excludes"] = opts["excludes"] == "" ? [] : opts["excludes"].split(";");
        opts["includes"] = opts["includes"] == "" ? [] : opts["includes"].split(";");

        opts["weightMatch"] = prefs.getBoolean('commando_files_weight_multiplier_match', 30);
        opts["weightHits"] = prefs.getBoolean('commando_files_weight_multiplier_hits', 20);
        opts["weightDepth"] = prefs.getBoolean('commando_files_weight_multiplier_depth', 10);
        
        paths.unshift(subscope.path);

        var _opts = JSON.stringify(opts);
        log.debug(uuid + " - Query: "+ query +", Paths: "+ paths.join(" : ") + ", Opts: " + _opts);

        scope.search(query, uuid, paths.join(","), _opts, function(status, results)
        {
            if (activeUuid != uuid)
            {
                if ( ! (uuid in local.warned))
                {
                    log.debug(uuid + " - No longer the active search, don't pass result");
                    local.warned[uuid] = true;
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / dialogs.js View on Github external
{
            _opts.yes = "Ok";
        }

        if ( ! _opts.no)
        {
            _opts.no = "Cancel";
        }

        // Break out early if "doNotAskPref" prefs so direct.
        if (_opts.doNotAskPref)
        {
            _opts.doNotAskUI = true;
            var bpref = "donotask_"+_opts.doNotAskPref;
            var spref = "donotask_action_"+_opts.doNotAskPref;
            if (prefs.getBoolean(bpref, false))
            {
                var actions = [_opts.yes, _opts.no];
                var action = prefs.getStringPref(spref);
                if (actions.indexOf(action) != -1)
                {
                    return action;
                } else {
                    log.error("illegal action for Yes/No/Cancel dialog in '" +
                                     spref + "' preference: '" + action + "'");
                    // Reset the boolean pref.
                    prefs.deletePref(bpref);
                    prefs.deletePref(spref);
                }
            }
        }
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
this.center = function(returnValues)
    {
        if ( ! returnValues)
        {
            // Hack to get around XUL magically adding width/height to elements, THANKS XUL!
            elem('panel').removeAttr("height");
            elem('panel').removeAttr("width");
        }
        
        var panel = elem('panel');
        
        if (local.quickSearch)
        {
            var classicMode = prefs.getBoolean('ui.classic.toolbar');
            var widget = elem('notifyWidget');
            
            var bo = widget.element().boxObject;
            var top = bo.screenY;
            
            if ( ! classicMode)
            {
                var left = bo.screenX + (bo.width / 2); // calculate center
                left -= (panel.element().boxObject.width || panelWidth) / 2;
            }
            else
            {
                var left = bo.screenX + bo.width; // calculate right edge
                left -= panel.element().boxObject.width || panelWidth;
            }
        }
github Komodo / KomodoEdit / src / modules / elastic_tabstops / content / elastic-tabstops.js View on Github external
this.observe = function(subject, topic, data) {
        if (topic == PREF_ENABLE_ELASTIC_TABSTOPS) {
            var enabled = prefs.getBoolean(PREF_ENABLE_ELASTIC_TABSTOPS);
            for (let view of views.editors()) {
                if (enabled) {
                    this._enableElasticTabstops(view);
                } else {
                    this._disableElasticTabstops(view);
                }
            }
        } else if (topic == PREF_TAB_WIDTH &&
                   prefs.getBoolean(PREF_ENABLE_ELASTIC_TABSTOPS)) {
            for (let view of views.editors()) {
                // Refresh with new tab width.
                this._onModify(view.scimoz, {value: 0}, {value: view.scimoz.length});
            }
        }
    }
}).apply(module.exports)
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
});
        
        fields.nativeBorders = require("ko/ui/checkbox").create("Use native window borders");
        fields.nativeBorders.checked( ! prefs.getBoolean("ui.hide.chrome") );
        
        fields.minimap = require("ko/ui/checkbox").create("Use code minimap");
        fields.minimap.checked( prefs.getBoolean("editShowMinimap") );
        
        fields.taborspace = require("ko/ui/checkbox").create("Prefer tabs over spaces for indentation");
        fields.taborspace.checked( prefs.getBoolean("useTabs") );
        
        fields.wrapping = require("ko/ui/checkbox").create("Wrap long lines");
        fields.wrapping.checked( !! prefs.getLong("editWrapType") );
        
        fields.autoDelimiters = require("ko/ui/checkbox").create("Wrap selection with typed delimiters (eg. quotes)");
        fields.autoDelimiters.checked( prefs.getBoolean("editSmartWrapSelection") );
        
        fields.autofill = require("ko/ui/checkbox").create("Automatically pick code completions using delimiters");
        fields.autofill.checked( prefs.getBoolean("codeintel_completion_auto_fillups_enabled") );
        
        fields.softchars = require("ko/ui/checkbox").create("Automatically insert ending delimiters and tags");
        fields.softchars.checked( prefs.getBoolean("codeintelAutoInsertEndTag") );
        
        fields.showLineNumbers = require("ko/ui/checkbox").create("Show line numbers in Editor");
        fields.showLineNumbers.checked( prefs.getBoolean("showLineNumbers") );
        
        fields.indentWidth = require("ko/ui/textbox").create({attributes: { type: "number", min: 1, max: 16, width: 60, maxlength: 2 }});
        fields.indentWidth.value( prefs.getLong("tabWidth") );
        
        fields.snippetBehavior = require("ko/ui/radiogroup").create(
            "Snippet Behavior: ",
        [
github Komodo / KomodoEdit / src / modules / elastic_tabstops / content / elastic-tabstops.js View on Github external
this._onViewDocumentAttached = function(event) {
        var view = event.originalTarget;
        if (view.getAttribute('type') != 'editor'
            || !prefs.getBoolean(PREF_ENABLE_ELASTIC_TABSTOPS)) {
            return;
        }
        //log.debug("Registering elastic tabstops handler to attached view");
        this._enableElasticTabstops(view);
    }.bind(this)
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / profiler.js View on Github external
(function ()
{
    const {Cc, Ci}  = require("chrome");

    var profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
    var prefs = require("ko/prefs");
    var enabled = prefs.getBoolean("profilerEnabled", false);
    var activeProfiler = null;

    /**
     * Enable profiling, none of the other methods in this module will do anything
     * otherwise
     *
     * @returns {Void}
     */
    this.enable = () =>
    {
        enabled = true;
    }

    /**
     * Disable profiling, does not stop already active profilers
     *
github Komodo / KomodoEdit / src / modules / commando / content / sdk / commando.js View on Github external
onNavDown(e);
                prevDefault = true;
                break;
            case KeyEvent.DOM_VK_UP: 
                onNavUp(e);
                prevDefault = true;
                break;
            case KeyEvent.DOM_VK_RIGHT: 
                onExpandResult(e);
                break;
            case KeyEvent.DOM_VK_ALT:
                local.altPressed = true;
                break;
        }
        
        var numberNav = prefs.getBoolean('commando_navigate_by_number', true);
        numberNav = numberNav && ! local.prevSearchValue;
        if (numberNav || (local.altPressed && e.keyCode != KeyEvent.DOM_VK_ALT))
        {
            var numberPressed = false;
            var numbers = [0,1,2,3,4,5,6,7,8,9];
            for (let number of numbers)
            {
                if (e.keyCode != KeyEvent["DOM_VK_" + number])
                    continue;
                
                numberPressed = true;
                prevDefault = true;
                
                if (local.altNumber)
                    local.altNumber += number;
                else
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
this.createFields = () =>
    {
        fields.keybinding = this.getFieldKeybindings();
        fields.browser = this.getFieldBrowsers();
        fields.colorScheme = this.getFieldColorSchemes();
        
        fields.classicMode = require("ko/ui/checkbox").create("Classic Mode (I'm happy with the way things were)");
        fields.classicMode.checked( prefs.getBoolean("ui.classic.mode") );
        
        fields.classicMode.onChange(() =>
        {
            if (fields.classicMode.checked())
            {
                fields.nativeBorders.checked(true);
                fields.colorScheme.value("Classic");
                fields.colorScheme.disable();
                fields.keybinding.value("Legacy");
            }
            else
            {
                fields.nativeBorders.checked(false);
                fields.colorScheme.enable();
            }
        });
github Komodo / KomodoEdit / src / chrome / komodo / content / startupWizard / startupWizard.js View on Github external
fields.nativeBorders.checked( ! prefs.getBoolean("ui.hide.chrome") );
        
        fields.minimap = require("ko/ui/checkbox").create("Use code minimap");
        fields.minimap.checked( prefs.getBoolean("editShowMinimap") );
        
        fields.taborspace = require("ko/ui/checkbox").create("Prefer tabs over spaces for indentation");
        fields.taborspace.checked( prefs.getBoolean("useTabs") );
        
        fields.wrapping = require("ko/ui/checkbox").create("Wrap long lines");
        fields.wrapping.checked( !! prefs.getLong("editWrapType") );
        
        fields.autoDelimiters = require("ko/ui/checkbox").create("Wrap selection with typed delimiters (eg. quotes)");
        fields.autoDelimiters.checked( prefs.getBoolean("editSmartWrapSelection") );
        
        fields.autofill = require("ko/ui/checkbox").create("Automatically pick code completions using delimiters");
        fields.autofill.checked( prefs.getBoolean("codeintel_completion_auto_fillups_enabled") );
        
        fields.softchars = require("ko/ui/checkbox").create("Automatically insert ending delimiters and tags");
        fields.softchars.checked( prefs.getBoolean("codeintelAutoInsertEndTag") );
        
        fields.showLineNumbers = require("ko/ui/checkbox").create("Show line numbers in Editor");
        fields.showLineNumbers.checked( prefs.getBoolean("showLineNumbers") );
        
        fields.indentWidth = require("ko/ui/textbox").create({attributes: { type: "number", min: 1, max: 16, width: 60, maxlength: 2 }});
        fields.indentWidth.value( prefs.getLong("tabWidth") );
        
        fields.snippetBehavior = require("ko/ui/radiogroup").create(
            "Snippet Behavior: ",
        [
            { attributes: {
                label: "Trigger automatically while typing",
                value: "auto"