// Copyright (c) Pickware GmbH. All rights reserved.
// This file is part of software that is released under a proprietary license.
// You must not copy, modify, distribute, make publicly available, or execute
// its contents or parts thereof without express permission by the copyright
// holder, unless otherwise permitted by law.

Ext.define('Shopware.apps.ViisonCommonAnalytics.view.main.ImprovedToolbar', {

    override: 'Shopware.apps.Analytics.view.main.Toolbar',

    initComponent: function () {
        // This enables the overflow button for the toolbar permanently.
        // TODO: Find a way to only enable it for analytics modules which request it.
        this.enableOverflow = true;

        this.callParent(arguments);

        /*
        if (!me.hasOwnProperty('viisonCommonAnalyticsImprovedToolbar')) {
            me.viisonCommonAnalyticsImprovedToolbar = Object.create(null, {
                inViisonMode: { value: false, writable: true },
                previousOverflowState: { value: me.enableOverflow, writable: true } ,
                previousLayoutOverflowHandler: { value: me.layoutOverflowHandler, writable: true }
            });
        }
        */
    },

    viisonCommonAnalyticsImproveToolbar: function (refreshedCallback) {
        /* // TODO: Make it possible to dynamically enable enableOverflow.
        if (!me.viisonCommonAnalyticsImprovedToolbar.inViisonMode) {
            me.viisonCommonAnalyticsImprovedToolbar.inViisonMode = true;
            me.viisonCommonAnalyticsImprovedToolbar.previousOverflowState = me.enableOverflow;
            me.viisonCommonAnalyticsImprovedToolbar.previousLayoutOverflowHandler = me.layout.overflowHandler;
        }

        me.enableOverflow = true;
        me.viisonCommonAnalyticsImprovedToolbar.previousLayoutOverflowHandler = { overflowHandler: 'Menu' };
        */

        refreshedCallback();
    },

    viisonCommonAnalyticsRestoreToolbar: function (refreshedCallback) {
        /* // TODO: Make it possible to dynamically disable enableOverflow.
        me.viisonCommonAnalyticsImprovedToolbar.inViisonMode = false;
        me.enableOverflow = me.viisonCommonAnalyticsImprovedToolbar.previousOverflowState;
        me.layout.overflowHandler = me.viisonCommonAnalyticsImprovedToolbar.previousLayoutOverflowHandler;
        */

        refreshedCallback();
    },

});
