/*
  MIT License http://www.opensource.org/licenses/mit-license.php
  Author Tobias Koppers @sokra
*/

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2023 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Christian Feitl <c.feitl@metaways.de>
 * @copyright   Copyright (c) 2022 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2019 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2020 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiß <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2022 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2020 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Ching En Cheng <c.cheng@metaways.de>
 * @copyright   Copyright (c) 2022 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2020 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 *
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2020 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 *
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2017-2021 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2010 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2017 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2011 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2013 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2011 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @package     Addressbook
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2013 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2018 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * TODO         think about adding a generic felamimail backend with the exception handler
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2011-2012 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2007-2021 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2013 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2018 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009-2018 Metaways Infosystems GmbH (http://www.metaways.de)
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2017 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * 
 * @package     Felamimail
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2020 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/*
 * Tine 2.0
 * contacts combo box and store
 * 
 * @package     Addressbook
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2007-2016 Metaways Infosystems GmbH (http://www.metaways.de)
 *
 */

/* ["default"] */

/* ["default"].locals */

/* asset import */

/* binding */

/* default */

/* default.locals */

/* eslint-disable no-use-before-define */

/* harmony default export */

/* harmony export */

/* harmony import */

/* import() | Tinebase/js/email-addresses */

/* istanbul ignore if  */

/* istanbul ignore next  */

/* pkg: Felamimail FAT Client (css/Felamimail-FAT.css)*/

/* pkg: Felamimail FAT Client (js/Felamimail-FAT.js)*/

/* test - uncomment to run
if (! window.lodash) {
    window.lodash = _;
}

Ext.onReady(function() {
    var testWin = new Ext.Window({
        width: 640,
        height: 480,
        layout: 'fit',
        title: 'ux.itemregistry test',
        items: [{
            xtype: 'tabpanel',
            activeTab: 0,
            border: false,
            defaults: {border: false},
            itemId: 'testWin',
            plugins: ['ux.itemregistry'],
            items: [{
                title: 'basepanel',
                html: 'basepanel'
            }, {
                title: 'no pos',
                html: 'no pos'
            }, {
                title: 'pos 50',
                html: 'pos 50',
                registerdItemPos: 50
            }]
        }]
    });
    testWin.show();

    Ext.ux.ItemRegistry.registerItem(testWin.items.get(0), {
        xtype: 'panel',
        title: 'key-cmp',
        html: 'register item in an existing component'
    }, 80);
});

itemRegTestPanel20 = Ext.extend(Ext.Panel, {
    title: 'add panel pos 20',
    html: 'add panel pos 20',

    initComponent: function() {
        // example how to hook in owner
        this.on('added', function(me, owner, pos) {
            owner.on('tabchange', function() {
                console.log('tabchange');
            })
        }),

        itemRegTestPanel20.superclass.initComponent.call(this);
    }
});
Ext.ux.ItemRegistry.registerItem('testWin', itemRegTestPanel20, 20);

itemRegTestPanel60 = {
    xtype: 'panel',
    title: 'add panel pos 60',
    items: [{items: [{html: 'add panel pos 60'}]}]
};
Ext.ux.ItemRegistry.registerItem('testWin', itemRegTestPanel60, 60);
Ext.ux.ItemRegistry.registerItem(itemRegTestPanel60, {html: 'registered in component config'}, 20);
Ext.ux.ItemRegistry.registerItem('testWin', {html: 'registered with path position '}, '4/0/20');
*/

/*#__PURE__*/

/**
       * functions
       */

/**
     * @event addcontacts
     * Fired when contacts are added
     */

/**
     * @event folderselect
     * Fired when folder is selected
     */

/**
     * @type Object
     */

/**
     * creates a new details panel for given mimeType
     * 
     * @param {String} mimeType
     * @return {Tine.widgets.grid.DisplayPanel}
     */

/**
     * get the last IMAP exception
     *
     * @return {Object}
     */

/**
     * register Display Panel for given MIME type
     * 
     * @param {String/Array} mimeType
     * @param {Function} displayPanel consturctor function of a Tine.widgets.grid.DisplayPanel 
     * @param {Array} otherTypes
     */

/**
     * returns Display Panel for given MIME type
     * 
     * @param  {String} mimeType
     * @return {Function} consturctor function of a Tine.widgets.grid.DisplayPanel 
     */

/**
     * returns basic form of MIME type if a display panel is registered for it
     * 
     * @param {String} mimeType
     * @return {String}
     */

/**
     * returns draftsfolder id
     */

/**
     * returns sendfolder id
     */

/**
     * returns special folder id
     *
     * @param {String} nameProperty
     */

/**
     * returns trashfolder id
     */

/**
     * set or clear IMAP exception and update imap_state
     *
     * @param {Object} exception
     */

/**
   *
   * @return {Promise}
   */

/**
   *  called after a new set of Records has been loaded
   *  
   * @param  {Ext.data.Store} this.store
   * @param  {Array}          loaded records
   * @param  {Array}          load options
   * @return {Void}
   */

/**
   * (on) update details
   * 
   * @param {Tine.Felamimail.Model.Message} record
   * @private
   */

/**
   * - hide spam actions if the current folder is trash/junk folder
   * - disable spam actions if the message has no spam flag
   */

/**
   * // if send, draft, template folders are selected, do the following:
   * // - hide from email + name columns from grid
   * // - show to column in grid
   * // - save this state
   * // - if grid state is changed by user, do not change columns by user
   *
   * // if switched from send, draft, template to "normal" folder
   * // - switch to default state
   */

/**
   * @cfg
   */

/**
   * @cfg 
   */

/**
   * @cfg {Array/String} bcc
   * initial config for bcc
   */

/**
   * @cfg {Array/String} cc
   * initial config for cc
   */

/**
   * @cfg {Array/String} to
   * initial config for to
   */

/**
   * @cfg {Array} contentTypes
   */

/**
   * @cfg {Array} of Tine.Felamimail.Model.Message (optionally encoded)
   * messages to forward
   */

/**
   * @cfg {Boolean} (defaults to false)
   */

/**
   * @cfg {Boolean} addPathFilter
   */

/**
   * @cfg {Boolean} autoSave
   * enable autosave as draft
   */

/**
   * @cfg {Boolean} autoStartEditing
   */

/**
   * @cfg {Boolean} border
   * show border
   */

/**
   * @cfg {Boolean} deferredRender
   * deferred rendering
   */

/**
   * @cfg {Boolean} forceSelection
   */

/**
   * @cfg {Boolean} hasMainScreen
   */

/**
   * @cfg {Boolean} header
   * show header
   */

/**
   * @cfg {Boolean} noEditPlugin
   */

/**
   * @cfg {Boolean} userOnly
   */

/**
   * @cfg {Bool} hasDetailsPanel 
   */

/**
   * @cfg {Bool} useModuleTreePanel
   * use modulePanel (defaults to null -> autodetection)
   */

/**
   * @cfg {Number} clicksToEdit
   * clicks to edit for editor grid panel
   */

/**
   * @cfg {Number} northHeight
   */

/**
   * @cfg {Number} numberOfRecordsForFixedHeight
   */

/**
   * @cfg {Number} westWidth
   */

/**
   * @cfg {Object} routes
   */

/**
   * @cfg {String} accountId
   * the accout id this message is sent from
   */

/**
   * @cfg {String} activeContentType
   */

/**
   * @cfg {String} appName
   * untranslated application name (required)
   */

/**
   * @cfg {String} autoExpandColumn
   * auto expand column of grid
   */

/**
   * @cfg {String} body
   */

/**
   * @cfg {String} centerPanelClassName
   * name of centerpanel class name suffix in namespace of this app (defaults to GridPanel)
   * the class name will be expanded to Tine[this.appName][contentType + this.centerPanelClassNameSuffix]
   */

/**
   * @cfg {String} containerName
   */

/**
   * @cfg {String} defaultRoute
   */

/**
   * @cfg {String} fileInstant|selectOnly
   */

/**
   * @cfg {String} key
   * key the items are registered under. If no key is given, the itemId
   * of the component will be used
   */

/**
   * @cfg {String} subject
   */

/**
   * @cfg {Tine.Felamimail.Model.Account}
   */

/**
   * @cfg {Tine.Felamimail.Model.Message}
   */

/**
   * @cfg {Tine.Felamimail.Model.Message} (optionally encoded)
   * message to reply to
   */

/**
   * @cfg {Tine.Felamimail.Model.Message} (optionally encoded)
   * message to use as draft/template
   */

/**
   * @cfg {Tine.Tinebase.Application} app
   * instance of the app object (required)
   */

/**
   * @cfg {Tinebase.data.Record} record optional instead of selectionModel (implicit fom grid)
   */

/**
   * @event containeradd
   * Fires when a folder was added
   * @param {folder} the new folder
   */

/**
   * @event containerdelete
   * Fires when a folder got deleted
   * @param {folder} the deleted folder
   */

/**
   * @event containerrename
   * Fires when a folder got renamed
   * @param {folder} the renamed folder
   */

/**
   * @param Tine.Tinebase.Model.Tree_Node node
   * @param {Object} options
   * @returns {*}
   */

/**
   * @param {Array} promises        List of promises to batch
   * @returns {Promise<any[]>}
   */

/**
   * @param {String} action
   * @param {Array} params
   */

/**
   * @private
   * 
   * expand default account and select INBOX
   */

/**
   * @private
   */

/**
   * @private grid cfg
   */

/**
   * @private model cfg
   */

/**
   * @property accountStore
   * @type Ext.data.JsonStore
   */

/**
   * @property app
   * @type Tine.Felamimail.Application
   * @private
   */

/**
   * @property app
   * @type Tine.Felamimail.Application
   */

/**
   * @property checkMailsDelayedTask
   * @type Ext.util.DelayedTask
   */

/**
   * @property composeMailActionBCC
   * @type Tine.widgets.ActionUpdater
   * @private
   */

/**
   * @property composeMailActionCC
   * @type Tine.widgets.ActionUpdater
   * @private
   */

/**
   * @property composeMailActionMass
   * @type Tine.widgets.ActionUpdater
   * @private
   */

/**
   * @property composeMailActionTO
   * @type Tine.widgets.ActionUpdater
   * @private
   */

/**
   * @property composeMailBtn
   * @type Ext.Button
   * @private
   */

/**
   * @property defaultAccount
   * @type Tine.Felamimail.Model.Account
   */

/**
   * @property gridPanel
   * @type Tine.Addressbook.gridPanel
   * @private
   */

/**
   * @property queriesDone
   * @type Array
   */

/**
   * @property queriesPending
   * @type Array
   */

/**
   * @property updateInterval user defined update interval (milliseconds)
   * @type Number
   */

/**
   * @property {Boolean} isManualSelection (of file locations)
   */

/**
   * @property {Locale.gettext} i18n
   */

/**
   * @return Array
   */

/**
   * @type Ext.Menu
   * @property contextMenu
   */

/**
   * @type Ext.data.JsonStore
   */

/**
   * @type Ext.data.SimpleStore
   * @property store
   */

/**
   * @type {Boolean}
   */

/**
   * @type {String}
   */

/**
   * Change type card layout depending on selected combo box entry and set field value
   */

/**
   * Override columns
   */

/**
   * Panel config
   * @private
   */

/**
   * Return CSS class to apply to rows depending on enabled status
   * 
   * @param {Tine.Felamimail.Model.Rule} record
   * @param {Integer} index
   * @return {String}
   */

/**
   * Return CSS class to apply to rows depending upon email set or not
   * 
   * @param {Tine.Addressbook.Model.Contact} record
   * @param {Integer} index
   * @return {String}
   */

/**
   * Return CSS class to apply to rows depending upon flags
   * - checks Flagged, Deleted and Seen
   * 
   * @param {Tine.Felamimail.Model.Message} record
   * @param {Integer} index
   * @return {String}
   */

/**
   * Show custom sieve script window
   */

/**
   * Show window for script reading
   */

/**
   * Store with all valid attachment types
   */

/**
   * TODO can this be done in a more elegant way?
   */

/**
   * TODO: make quick filter search "to" in be , and remove all the filter switch in fe
   * add custom filter before or after store load
   *
   * @param params
   * @param isSentFolder
   *
   */

/**
   * TreePanel config
   * @private
   */

/**
   * _bindKeys
   *
   * @access public
   */

/**
   * action renderer
   * 
   * @param {Object} type
   * @param {Object} metadata
   * @param {Object} record
   * @return {String}
   */

/**
   * adapter fn to get folder tree panel
   * 
   * @return {Ext.tree.TreePanel}
   */

/**
   * add account record to root node
   * 
   * @param {Tine.Felamimail.Model.Account} record
   */

/**
   * add accounts from registry as nodes to root node
   * @private
   */

/**
   * add custom items to action toolbar
   * 
   * @return {Object}
   */

/**
   * add custom items to context menu
   * 
   * @return {Array}
   */

/**
   * add default signature to message
   *
   */

/**
   * add event handler
   *
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} record
   * @param {Integer} index
   */

/**
   * add event handler
   * 
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} records
   * @param {Integer} index
   */

/**
   * add given flags to given messages
   *
   * @param  {String/Array} ids
   * @param  {String/Array} flags
   */

/**
   * add mail address from addressbook (if available) and add it to mailAddresses array
   *
   * @param {Array} mailAddresses
   * @param contacts
   */

/**
   * add new account button
   * 
   * @param {Button} button
   * @param {Event} event
   */

/**
   * add new folder to the store
   * 
   * @param {Object} folderData
   */

/**
   * add on click event after render
   * @private
   */

/**
   * add quota bar to paging toolbar
   */

/**
   * add recipients to grid store
   */

/**
   * add status boxes
   * 
   * @param {Object} nodeUi
   */

/**
   * add to action updater the first time we render
   */

/**
   * adds given flag to message
   * 
   * @param  {String} flag
   * @return {Boolean} false if flag was already set before, else true
   */

/**
   * adds row and adjusts layout
   *
   * @param autoStartEdit
   */

/**
   * after edit
   * 
   * @param {} o
   */

/**
   * after render
   */

/**
   * always return raw value
   * 
   * @return String
   */

/**
   * always set valueIsList to false
   *
   * @param value
   */

/**
   * apply changes handler (get rules and send them to saveRules)
   */

/**
   * array with e-mail-addresses used as recipients
   * @type {Array}
   */

/**
   * async query
   */

/**
   * attachment column renderer
   * 
   * @param {String} value
   * @return {String}
   * @private
   */

/**
   * auto hook text i18n._('New Mail')
   */

/**
   * bindClicks
   *
   * @access public
   */

/**
   * call checkState for every field
   */

/**
   * called after a new set of Records has been loaded
   *
   * @param  {Ext.data.Store} this.store
   * @return {Void}
   * @param store
   * @param records
   * @param options
   */

/**
   * called before store queries for data
   */

/**
   * called when a row gets selected
   * 
   * @param {SelectionModel} sm
   * @param {Number} rowIndex
   * @param {Tine.Felamimail.Model.Message} record
   * @param {Number} retryCount
   * 
   * TODO find a better way to check if body is fetched, this does not work correctly if a message is removed
   *       and the next one is selected automatically
   */

/**
   * called when an account record updates
   * 
   * @param {Ext.data.JsonStore} store
   * @param {Tine.Felamimail.Model.Account} record
   * @param {String} action
   */

/**
   * called when the store gets updated
   * 
   * NOTE: we only allow updateing flags BUT the actual updating is done 
   *       directly from the UI fn's to support IMAP optimised bulk actions
   */

/**
   * called when tree selection changes
   * 
   * @param {} sm
   * @param {} node
   */

/**
   * cell click handler -> update recipients in record
   * 
   * @param {Grid} grid
   * @param {Number} row
   * @param {Number} col
   * @param {Event} e
   */

/**
   * check if body has been fetched
   * 
   * @return {Boolean}
   */

/**
   * check if delete/move action is running atm
   * 
   * @return {Boolean}
   */

/**
   * check if message has given flag
   * 
   * @param  {String} flag
   * @return {Boolean}
   */

/**
   * check if query has already loaded or is loading
   * 
   * @param {String} field
   * @param {String} value
   * @return {boolean}
   */

/**
   * check mails
   * 
   * if no folder is given, we find next folder to update ourself
   * 
   * @param {Tine.Felamimail.Model.Folder} [folder]
   * @param {Function} [callback]
   */

/**
   * checks default account id
   * 
   * @param {String} accountId
   * @return {Boolean}
   */

/**
   * checks recipients
   *
   * @return {Boolean}
   */

/**
   * cleanup on destruction
   */

/**
   * clear given flags from given messages
   *
   * @param  {String/Array} ids
   * @param  {String/Array} flags
   */

/**
   * clears given flag from message
   * 
   * @param {String} flag
   * @return {Boolean} false if flag was not set before, else true
   */

/**
   * collects outdated folders and calls getFolderStatus on server to fetch all folders that need to be updated
   */

/**
   * compose an email to selected contacts
   *
   * @param {Button} btn
   * @param to
   */

/**
   * compose an email to selected contacts
   *
   * @param {Button} btn
   */

/**
   * compose mail via mailto link
   *
   * @param paramString from mailto link
   */

/**
   * compose mass maiiling to selected contacts
   *
   * @param {Button} btn
   */

/**
   * compute paths for folder records
   *
   * @param {Tine.Felamimail.Model.Folder} records
   * @param givenParentPath
   */

/**
   * conditions renderer
   * 
   * @param {Object} value
   * @return {String}
   * 
   * TODO show more conditions?
   */

/**
   * config
   * @private
   */

/**
   * convert containerPath to treePath
   * 
   * @param {String}  containerPath
   * @return {String} treePath
   */

/**
   * converts (internal) item representation to location
   * @param item
   * @return {{type: string, model: String, record_id: data|{email}|*}}
   */

/**
   * copy messages handler
   *
   * @return {void}
   */

/**
   * create task handler
   *
   * @param {Button} button
   * @param {Event} event
   */

/**
   * decode this.replyTo / this.forwardMsgs from interwindow json transport
   */

/**
   * decrement unread count of currently selected folder
   */

/**
   * default panel region
   *
   * @property detailsPanelRegion
   */

/**
   * define state events
   */

/**
   * delete handler
   */

/**
   * delete message handler
   */

/**
   * delete messages handler:
   * delete messages from trash/drafts folder, move messages to trash from other folders
   * 
   * @return {Boolean}
   */

/**
   * directly file a single message
   * 
   * TODO: support file multi messages?
   *
   * @param item
   * @param e
   */

/**
   * drag n drop
   */

/**
   * enable / disable rule
   * 
   * @param {Boolean} state
   */

/**
   * exception handler for this proxy
   * 
   * @param {Tine.Exception} exception
   */

/**
   * executed after a msg compose
   * 
   * @param {String} composedMsg
   * @param {String} action
   * @param {Array}  [affectedMsgs]  messages affected 
   * 
   */

/**
   * executed after a msg compose
   * 
   * @param {String} composedMsg
   * @param {String} action
   * @param {Array}  [affectedMsgs]  messages affected 
   * @param {String} [mode]
   */

/**
   * executed after deletion of this message
   */

/**
   * executed after msg delete
   * 
   * @param {Array} [ids]
   */

/**
   * executed after record got updated from proxy
   *
   * -> only allow to change some fields if it is a system account
   */

/**
   * executed after record got updated from proxy
   *
   * @private
   */

/**
   * executed after record got updated from proxy
   * 
   * @private
   */

/**
   * executed after record got updated from proxy
   * -> we don't have a real record here
   * 
   * @private
   */

/**
   * executed right before this app gets activated
   */

/**
   * executed when record gets updated from form
   * - add attachments to record here
   * - add alias / from
   *
   * @private
   */

/**
   * executed when record gets updated from form
   */

/**
   * executed when updateMessageCache requests fail
   * 
   * NOTE: We show the credential error dlg and this only for the first error
   * 
   * @param {Object} exception
   */

/**
   * executed when user clicks refresh btn
   */

/**
   * expand portal column "Email Accounts"
   */

/**
   * felamimail app, needed for translations
   * @type Tine.Felamimail.Application
   */

/**
   * fetch subfolders by parent path 
   * - if parentPath param is empty, it loops all accounts and account folders to find the next folders to fetch
   * 
   * @param {String} parentPath
   * @return {Boolean} true if all folders of all accounts have been fetched
   */

/**
   * fetches body and additional headers (which are needed for the preview panel) into given message
   * 
   * @param {Message} message
   * @param {String} mimeType
   * @param {Function|Object} callback (NOTE: this has NOTHING to do with standard Ext request callback fn)
   */

/**
   * file messages
   *
   * @param appName
   * @param path
   */

/**
   * file selected messages to Filemanager
   */

/**
   * fills this fields with the corresponding message data
   *
   * @param {Tine.Tinebase.data.Record|Object} record
   */

/**
   * fix input fields layout
   */

/**
   * folder quota is updated
   * 
   * @param {Tine.Felamimail.Model.Folder} record
   */

/**
   * folder store gets updated -> refresh grid if new messages arrived or messages have been removed
   * 
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} record
   * @param {String} operation
   */

/**
   * folder store gets updated -> update tree nodes
   * 
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} record
   * @param {String} operation
   */

/**
   * foreign application name
   * @type String
   */

/**
   * format headers
   * 
   * @param {Object} headers
   * @param {Bool} ellipsis
   * @param {Bool} onlyImportant
   * @return {String}
   */

/**
   * forward message handler
   */

/**
   * generic action needs to set custom actionUpdater
   */

/**
   * generic apply changes handler
   * - NOTE: overwritten to check here if the subject is empty and if the user wants to send an empty message
   *
   * @param {Ext.Button} button
   * @param {Event} event
   * @param {Boolean} closeWindow
   */

/**
   * generic apply changes handler
   */

/**
   * generic delete handler
   */

/**
   * generic request exception handler
   *
   * @param {Object} exception
   */

/**
   * get account id from filter (only returns the id if a single account id was found)
   * 
   * @param {Array} filter
   * @return {String}
   */

/**
   * get account signature text
   *
   * @param {Tine.Felamimail.Model.Account} account
   * @param {String} format
   * @param signature
   */

/**
   * get account store
   *
   * @return {Ext.data.JsonStore}
   */

/**
   * get action toolbar
   * 
   * @return {Ext.Toolbar}
   */

/**
   * get active account
   * @return {Tine.Felamimail.Model.Account}
   */

/**
   * get active account by checking selected node
   * @return Tine.Felamimail.Model.Account
   */

/**
   * get addressbook contact grid panel
   */

/**
   * get blockquote level helper
   * 
   * @param {DOMNode} node
   * @return {Integer}
   */

/**
   * get center panel for given contentType
   * 
   * @param {String} contentType
   * @return {Ext.Panel}
   */

/**
   * get conditions and do the mapping
   * 
   * @return {Array}
   */

/**
   * get conditions filter data (reverse of getConditions)
   * 
   * @return {Array}
   */

/**
   * get currently selected folder from tree
   * @return {Tine.Felamimail.Model.Folder}
   */

/**
   * get default / selected addressbook container
   *
   * @returns {Object|Tine.Tinebase.Model.Container}
   */

/**
   * get detail panel content
   * 
   * @param {Tine.Felamimail.GridDetailsPanel} details panel
   * @return {String}
   */

/**
   * get flag icon
   *
   * @private
   *
   * TODO  use spacer if first flag(s) is/are not set?
   * @param value
   * @param metadata
   * @param record
   * @param value
   * @param metadata
   * @param record
   */

/**
   * get folder status returned -> set folders that need an update to pending status
   * 
   * @param {Array} response
   */

/**
   * get folder store
   * 
   * @return {Tine.Felamimail.FolderStore}
   */

/**
   * get grants store
   *
   * @return Ext.data.JsonStore
   */

/**
   * get items for general tab
   *
   * @return Array
   */

/**
   * get items for vacation templates
   *
   * @return Array
   *
   * TODO use grid panel for x representatives?
   * @param templates
   */

/**
   * get key to store query 
   * 
   * @param  {string} field
   * @param  {mixed} value
   * @return {string}
   */

/**
   * get module tree panel
   * 
   * @return {Ext.Panel}
   */

/**
   * get next message in grid
   * 
   * @param msgs
   * @return Tine.Felamimail.Model.Message
   */

/**
   * get north panel for given contentType
   * 
   * @param {String} contentType
   * @return {Ext.Panel}
   */

/**
   * get panel for single record details
   * 
   * @return {Ext.Panel}
   */

/**
   * get panel for westCardPanel region of given contentType
   *
   * NOTE: do not confuse this with westRegionPanel!
   * 
   * @return {Ext.Panel}
   */

/**
   * get parent folder
   * 
   * @param {Tine.Felamimail.Model.Folder} folder
   * @return {Tine.Felamimail.Model.Folder|null}
   */

/**
   * get quoted mail header
   *
   * @param format
   * @returns {String}
   */

/**
   * get route for this app
   * @return {string}
   */

/**
   * get state
   */

/**
   * get the deepest nodes expanded paths
   *
   * @param node
   */

/**
   * get validation error message
   *
   * @return {String}
   */

/**
   * gets default signature of given account
   *
   * @param {Tine.Felamimail.Model.Account} account
   * @return {Tine.Felamimail.Model.Signature}
   */

/**
   * gets filter data (use getValue() if we don't have a store/plugins)
   * 
   * @return {Array} of filter records
   */

/**
   * gets next folder which needs to be checked for mails
   * 
   * @return {Model.Folder/null}
   */

/**
   * gets the currently displayed toolbar
   *
   * @return {Ext.Toolbar}
   */

/**
   * grid specific
   * @private
   */

/**
   * grid view config
   * - do not mark records as dirty
   * 
   * @type Object
   */

/**
   * handle attachments like external URLs (COSR)
   *
   * TODO: check if this overwrites existing attachments in some cases
   */

/**
   * handle attachments: attaches message attachments depends on emailForward preference
   * - keeps attachments as they are (emailForward -> message or when the message is draft or Template)
   * - keeps original message/attachments and attach original email as .eml attachment(messageAndAsAttachment)
   * - only attach original email as .eml attachment (onlyAsAttachment)
   *
   * @param {Tine.Felamimail.Model.Message} message
   */

/**
   * handle invitation messages (show top + bottom panels)
   * 
   * @param {Tine.Felamimail.Model.Message} record
   */

/**
   * holds default values for the record
   * @type {Object}
   */

/**
   * if 'account_id' is changed we need to update the signature
   *
   * @param {} combo
   * @param {} record
   * @param {} index
   */

/**
   * in memory msg bus for sync events
   */

/**
   * init
   * @private
   */

/**
   * init account (from) combobox
   *
   * - need to create a new store with an account record for each alias
   */

/**
   * init actions
   */

/**
   * init actions / ctx menu
   * @private
   */

/**
   * init actions with actionToolbar, contextMenu and actionUpdater
   * 
   * @private
   */

/**
   * init attachment grid + add button to toolbar
   */

/**
   * init bottom toolbar (needed for event invitations atm)
   * 
   * TODO add buttons (show header, add to addressbook, create filter, show images ...) here
   */

/**
   * init buttons
   */

/**
   * init cm
   * @private
   */

/**
   * init columns
   */

/**
   * init extra tool tips
   */

/**
   * init folder tree
   */

/**
   * init layout
   */

/**
   * init message grid
   * @private
   */

/**
   * init new folder node
   * 
   * @param {Tine.Felamimail.Model.Folder} newRecord
   */

/**
   * init reason editor
   */

/**
   * init recipients from reply/replyToAll information
   */

/**
   * init record to edit
   * -> we don't have a real record here
   */

/**
   * init single message template (this.tpl)
   * @private
   */

/**
   * init some auto hooks
   */

/**
   * init store
   * @private
   */

/**
   * init template
   * @private
   */

/**
   * init toolbar
   */

/**
   * init top toolbar for opening mails in fmail
   */

/**
   * initialises the filter panel 
   * 
   * @param {Object} config
   */

/**
   * initialize Filemanager email QuickLook
   *
   * @returns {boolean}
   */

/**
   * initialize grid panel hooks
   */

/**
   * initializes the filterPanel, overwrites the superclass method
   */

/**
   * initiates tree context menus
   *
   * @private
   */

/**
   * inits / sets sender of message
   */

/**
   * inits body and attachments from reply/forward/template
   *
   * @param {} message
   */

/**
   * inits this cmp
   * @private
   */

/**
   * inits to/cc/bcc
   */

/**
   * inspectCreateNode
   * 
   * @private
   */

/**
   * is called in accountMode to reset the value
   * @param value
   */

/**
   * is form valid (checks if attachments are still uploading / recipients set)
   *
   * @return {Boolean}
   */

/**
   * is form valid?
   *
   * @return {Boolean}
   */

/**
   * is needed by Tine.widgets.mainscreen.WestPanel to fake container tree panel
   */

/**
   * is this folder an inbox?
   * 
   * @return {Boolean}
   */

/**
   * is this folder the currently selected folder
   * 
   * @return {Boolean}
   */

/**
   * is this folder the system folder?
   *
   * @return {Boolean}
   */

/**
   * json-encoded selection filter and to
   * @type {String} selectionFilter
   */

/**
   * layout stuff
   */

/**
   * load deafault addressbook from contact
   *
   */

/**
   * load email quotas
   *
   */

/**
   * load event handler
   * 
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} records
   * @param {Object} options
   */

/**
   * load grid from saved filter
   * 
   * -> overwritten to allow to dynamically update email filter
   * 
   *  @param {Tine.widgets.persistentfilter.model.PersistentFilter} persistentFilter
   */

/**
   * load vacation record
   *
   */

/**
   * mail(s) got dropped on node
   * 
   * @param {Object} dropEvent
   * @private
   */

/**
   * message compose dlg
   * @type Tine.Felamimail.MessageEditDialog
   */

/**
   * message detail panel
   * 
   * @type Tine.Felamimail.GridDetailsPanel
   * @property detailsPanel
   */

/**
   * message got removed in display dialog
   * 
   * @param {} msgData
   */

/**
   * message is loaded in compose dialog
   *
   * @param dlg
   * @param message
   * @param ticketFn
   */

/**
   * move (folder !== null) or delete selected messages 
   * 
   * @param {Tine.Felamimail.Model.Folder} folder
   * @param {Boolean} toTrash
   * @param {Boolean} keepOriginalMessages
   */

/**
   * move messages handler
   *
   * @return {void}
   */

/**
   * move messages to folder
   *
   * @param {Object} filter filter data
   * @param {String} targetFolderId
   * @param {Boolean} keepOriginalMessages
   * @param {Object} options
   * @return  {Number} Ext.Ajax transaction id
   */

/**
   * move record up or down
   * 
   * @param {String} dir (up|down)
   */

/**
   * move selected messages to given folder
   * 
   * @param {Tine.Felamimail.Model.Folder} folder
   * @param {Boolean} toTrash
   * @param {Boolean} keepOriginalMessages
   */

/**
   * needed to apply second grid state for send folders
   */

/**
   * needed to prevent events in form fields (i.e. migration_approved checkbox)
   * @type boolean
   */

/**
   * no context menu
   * @type Function
   */

/**
   * no path filter for emails!
   */

/**
   * on add contact -> fires addcontacts event and passes rows + type
   * 
   * @param {String} type
   */

/**
   * on add event of store
   * 
   * @param {} store
   * @param {} records
   * @param {} index
   */

/**
   * on append node
   * 
   * render status box
   * 
   * @param {Tine.Felamimail.TreePanel} tree
   * @param {Ext.Tree.TreeNode} node
   * @param {Ext.Tree.TreeNode} appendedNode
   * @param {Number} index
   */

/**
   * on before click handler
   * - accounts are not clickable because fetching all messages of account is too expensive
   * - skip event for folders that are not selectable
   * 
   * @param {Ext.tree.AsyncTreeNode} node
   */

/**
   * on before edit
   * 
   * @param {} o
   */

/**
   * on click for attachment download / compose dlg / edit contact dlg
   *
   * @param {} e
   * @private
   */

/**
   * on click handler
   * 
   * - expand node
   * - update filter toolbar of grid
   * - start check mails delayed task
   * 
   * @param {Ext.tree.AsyncTreeNode} node
   * @private
   */

/**
   * on contact click
   *
   * @param e
   */

/**
   * on folder select handler
   * 
   * @param {Ext.tree.AsyncTreeNode} node
   * @private
   */

/**
   * on key press
   * @param {} e
   * @param {} t
   * @param {} o
   */

/**
   * on keydown 
   * 
   * @param {Event} e
   * 
   * TODO try to prevent TAB key event from inserting a TAB in the editor 
   */

/**
   * on keydown 
   * 
   * @param {Event} e
   */

/**
   * on keyup 
   * 
   * @param {Event} e
   */

/**
   * on load handler of combo store
   * -> add additional record if contact has multiple email addresses
   * 
   * @param {} store
   * @param {} records
   * @param {} options
   */

/**
   * on store load exception
   * 
   * @param {Tine.Tinebase.data.RecordProxy} proxy
   * @param {String} type
   * @param {Object} error
   * @param {Object} options
   * 
   * TODO remove loading class / remove from queriesDone?
   */

/**
   * on update after edit
   * 
   * @param {String} encodedRecordData (json encoded)
   */

/**
   * on update folder
   * 
   * @param {Tine.Felamimail.FolderStore} store
   * @param {Tine.Felamimail.Model.Folder} record
   * @param {String} operation
   */

/**
   * onTriggerClick
   * open ext window with (folder-)select panel that fires event on select
   * 
   * @param e
   */

/**
   * open first file location when file icon is clicked
   */

/**
   * open in Felamimail MessageDisplayDialog
   */

/**
   * options are saved in onAfterEdit
   * 
   * @type Ext.data.Record
   */

/**
   * override default onSelect
   * - set email/name as value
   * 
   * @param {} record
   * @private
   */

/**
   * overwrite template with content
   * 
   * @param {Tine.Felamimail.Model.Message} record
   */

/**
   * overwrite update toolbars function (we don't have record grants yet)
   *
   * @private
   */

/**
   * overwrite update toolbars function (we don't have record grants yet)
   * 
   * @private
   */

/**
   * overwrite update toolbars function (we don't have record grants yet)
   * @private
   */

/**
   * overwrite update toolbars function (we don't have record grants)
   * @private
   */

/**
   * overwrite, just hide the loadMask
   */

/**
   * permanently delete selected messages
   */

/**
   * preform the initial load of grid data
   */

/**
   * print handler
   * 
   * @todo move this to Ext.ux.Printer as iframe driver
   * @param {Tine.Felamimail.GridDetailsPanel} details panel [optional]
   */

/**
   * print preview handler
   * 
   * @param {Tine.Felamimail.GridDetailsPanel} details panel [optional]
   */

/**
   * process spam strategy and refresh grid panel
   *
   * @param option
   */

/**
   * properties from record.json to preserve when editing (see Ext.copyTo for syntax)
   * @type {string}
   */

/**
   * record class
   * @cfg {Tine.Addressbook.Model.Contact} recordClass
   */

/**
   * record class
   * @cfg {Tine.Felamimail.Model.Message} recordClass
   */

/**
   * recursive resets the query and removes all records that match it
   * 
   * @param {String} field
   * @param {String} value
   */

/**
   * refetch message body
   * 
   * @param {Tine.Felamimail.Model.Message} record
   * @param {Function} callback
   */

/**
   * remove deleted folder from the store
   * 
   * @param {Object} folderData
   */

/**
   * rename folder in the store
   * 
   * @param {Object} folderData
   */

/**
   * render type radio buttons in grid
   * 
   * @param {String} type
   * @param {String} value
   * @param {Object} metaData
   * @param {Object} record
   * @param {Number} rowIndex
   * @param {Number} colIndex
   * @param {Store} store
   * @return {String}
   */

/**
   * reply message handler
   * 
   * @param {bool} toAll
   */

/**
   * reply message handler
   */

/**
   * request data
   * 
   * @param {Ext.tree.TreeNode} node
   * @param {Function} callback Function to call after the node has been loaded. The
   * function is passed the TreeNode which was requested to be loaded.
   * @param (Object) scope The cope (this reference) in which the callback is executed.
   * defaults to the loaded TreeNode.
   */

/**
   * resolve recipient filter / queries addressbook
   *
   * @param {String} field to/cc/bcc
   */

/**
   * resolve recipient token
   *
   * default:
   * - when the list email is not empty. it should not be expanded, user should resolve it to members manually
   * - when the list email is empty, it should be resolve to members automatically.
   *
   * mass mailing mode:
   * - all the list email should be removed and expanded to members automatically
   *
   * @param token
   */

/**
   * resolve recipients to token
   * 
   */

/**
   * responsive content Renderer
   *
   * @param {String} folderId
   * @param {Object} metadata
   * @param {Folder|Account} record
   * @return {String}
   */

/**
   * return flag for applying state
   */

/**
   * return mail addresses of given contacts
   *
   * @param records
   */

/**
   * returns a filter plugin to be used in a grid
   * @private
   */

/**
   * returns account and folder globalname
   * 
   * @param {String} folderId
   * @param {Object} metadata
   * @param {Folder|Account} record
   * @return {String}
   */

/**
   * returns active content type
   * 
   * @return {String}
   */

/**
   * returns actual mimeType of the current body property
   *
   * NOTE: This is not the contents of body_content_type!
   *       body_content_type is the type of the original message derrived by the message structure.
   *       But the server transforms the original type into the requested format/display_format.
   */

/**
   * returns array with columns
   * 
   * @return {Array}
   */

/**
   * returns canonical path part
   * @returns {string}
   */

/**
   * returns cm
   * 
   * @private
   */

/**
   * returns column model
   * 
   * @return Ext.grid.ColumnModel
   * @private
   */

/**
   * returns currently selected locations
   */

/**
   * returns details panel
   * 
   * @private
   * @return {Tine.Addressbook.ContactGridDetailsPanel}
   */

/**
   * returns dialog
   *
   * NOTE: when this method gets called, all initalisation is done.
   *
   * @return {Object}
   * @private
   *
   */

/**
   * returns dialog
   *
   * NOTE: when this method gets called, all initialisation is done.
   *
   * @return {Object}
   * @private
   */

/**
   * returns dialog
   *
   * NOTE: when this method gets called, all initialization is done.
   * @private
   */

/**
   * returns dialog
   * 
   * NOTE: when this method gets called, all initalisation is done.
   * 
   * @return {Object}
   * @private
   * 
   */

/**
   * returns dialog
   * 
   * NOTE: when this method gets called, all initialisation is done.
   * 
   * @return {Object}
   * @private
   */

/**
   * returns dialog
   * 
   * NOTE: when this method gets called, all initialization is done.
   * 
   * @return {Object}
   * @private
   */

/**
   * returns icon for message with TINE20 flag
   *  depending on the configured icons and the sender domain
   *
   * @returns {String}
   */

/**
   * returns iconCls of this application
   * 
   * @param {String} target
   * @return {String}
   */

/**
   * returns message passed with config
   *
   * @return {Tine.Felamimail.Model.Message}
   */

/**
   * returns registry of this app
   * 
   * @return {Ext.util.MixedCollection}
   */

/**
   * returns rows context menu
   * 
   * @return {Ext.menu.Menu}
   */

/**
   * returns the mainscreen of this application
   * 
   * @return {Tine.widgets.app.MainScreen}
   */

/**
   * returns title (Email)
   * 
   * @return {String}
   */

/**
   * returns title of this application
   * 
   * @return {String}
   */

/**
   * returns tree node id the given el is child of
   * 
   * @param  {HTMLElement} el
   * @return {String}
   */

/**
   * returns true if a specific feature is enabled for this application
   * 
   * @param {String} featureName
   * @return {Boolean}
   */

/**
   * returns true if current folder needs an update
   */

/**
   * returns true if given record obsoletes this one
   * 
   * NOTE: this does only work for Tine.widgets.grid.GridPanel::onStoreBeforeLoadRecords record comparison
   * 
   * @param {Tine.Tinebase.data.Record} record
   * @return {Boolean}
   */

/**
   * returns true if message is forwarded
   *
   * @return {Boolean}
   */

/**
   * row doubleclick handler
   * 
   * - opens message edit dialog (if draft/template)
   * - opens message display dialog (everything else)
   * 
   * @param {Tine.Felamimail.GridPanel} grid
   */

/**
   * row doubleclick handler
   * 
   * @param {} grid
   * @param {} row
   * @param {} e
   */

/**
   * save message in folder
   *
   * @param {String} folderField
   */

/**
   * save sieve rules
   *
   * @param  {String}     accountId
   * @param  {Array}      rules
   * @param  {Object}     options
   */

/**
   * saves a message into a folder
   * 
   * @param   {Ext.data.Record} record
   * @param   {String} folderName
   * @param   {Object} options
   * @return  {Number} Ext.Ajax transaction id
   * @success {Ext.data.Record}
   */

/**
   * saves a single record
   * 
   * NOTE: Single rule records can't be saved
   * 
   * @param   {Ext.data.Record} record
   * @param   {Object} options
   * @return  {Number} Ext.Ajax transaction id
   * @success {Ext.data.Record}
   */

/**
   * search for contacts as recipients
   */

/**
   * searches all (lightweight) records matching filter
   * 
   * @param   {Object} filter accountId
   * @param   {Object} paging
   * @param   {Object} options
   * @return  {Number} Ext.Ajax transaction id
   * @success {Object} root:[records], totalcount: number
   */

/**
   * select folder event listener
   * 
   * @param {Ext.tree.AsyncTreeNode} node
   */

/**
   * select inbox of account
   * @param {Record} account
   */

/**
   * select the last selected node
   * - expand the recorded expanded node from db
   */

/**
   * set expanded paths
   */

/**
   * set grid to fixed height if it has more than X records
   *  
   * @param {} doLayout
   */

/**
   * set message body: converts newlines, adds quotes
   *
   * @param {Tine.Felamimail.Model.Message} message
   * @param {Tine.Felamimail.Model.Account} account
   * @param {String}                        format
   */

/**
   * set unread class of folder node and parents
   * 
   * @param {Tine.Felamimail.Model.Folder} folder
   * 
   * TODO make it work correctly for parents (use events) and activate again
   */

/**
   * setForwardSubject -> this.subject
   */

/**
   * setReplySubject -> this.subject
   *
   * removes existing prefixes + just adds 'Re: '
   */

/**
   * sets / inits subject
   */

/**
   * sets item
   *
   * @param {Ext.Toolbar} panel toolbar to activate
   * @param {Bool} keep keep panel
   */

/**
   * sets the active content panel
   *
   * @param {Ext.Panel} item Panel to activate
   * @param {Bool} keep keep panel
   */

/**
   * sets the active content type
   *
   * @param {String} contentType to activate
   */

/**
   * sets the active module tree panel
   *
   * @param {Ext.Panel} panel Panel to activate
   * @param {Bool} keep keep panel
   */

/**
   * sets the active tree panel
   *
   * @param {Ext.Panel} panel Panel to activate
   * @param {Bool} keep keep panel
   */

/**
   * sets the conjunction operator of the filtertoolbar to show the correct text for anyof or allof
   */

/**
   * show context menu
   * 
   * @param {Tine.Felamimail.RecipientGrid} grid
   * @param {Number} row
   * @param {Event} e
   */

/**
   * show context menu for folder tree
   * 
   * items:
   * - create folder
   * - rename folder
   * - delete folder
   * - ...
   * 
   * @param {} node
   * @param {} event
   * @private
   */

/**
   * show feedback when message filing has been (un)successful
   *
   * TODO reload grid when request returns?
   */

/**
   * show felamimail credentials dialog
   *
   * @param {Tine.Felamimail.Model.Account} account
   * @param {String} username [optional]
   */

/**
   * show loadMask (loadRecord is false in this dialog)
   * @param {} ct
   * @param {} position
   */

/**
   * show message
   */

/**
   * show notification for new messages
   * 
   * @param {Tine.Felamimail.Model.Folder} record
   */

/**
   * show notification for replaced mail sender
   *
   */

/**
   * show notification with active vacation information
   */

/**
   * shows center panel in mainscreen
   */

/**
   * shows module tree panel in mainscreen
   */

/**
   * shows north panel in mainscreen
   */

/**
   * shows west panel in mainscreen
   */

/**
   * specialkey is pressed in search combo
   * 
   * @param {Combo} combo
   * @param {Event} e
   */

/**
   * start delayed task to init folder store / updateFolderStore
   */

/**
   * start editing (check if message compose dlg is saving/sending first)
   * 
   * @param {} row
   * @param {} col
   */

/**
   * start editing after render
   * @private
   */

/**
   * store has been updated
   * 
   * @param {} store
   * @param {} record
   * @param {} operation
   * @private
   */

/**
   * sync grid with record
   * -> update record to/cc/bcc
   */

/**
   * sync grid with record
   * -> update store
   *
   * @param {Array} types
   * @param {Tine.Felamimail.Model.Message} record
   * @param {Boolean} setHeight
   * @param {Boolean} clearStore
   */

/**
   * template combo select event handler
   *
   * @param {} combo
   * @param {} record
   * @param {} index
   */

/**
   * template field has been selected, check if new vacation message needs to be fetched
   * - do this only if template has already been selected
   */

/**
   * template function for subclasses is called after app activation.
   */

/**
   * template function for subclasses is called after app deactivation.
   */

/**
   * template function for subclasses is called before app activation. Return false to cancel activation
   */

/**
   * template function for subclasses is called before app deactivation. Return false to cancel deactivation
   */

/**
   * template function for subclasses to initialize application
   */

/**
   * template function for subclasses to register app core data
   */

/**
   * test IMAP or SMTP connection
   *
   */

/**
   * the details panel (shows message content)
   * 
   * @private
   */

/**
   * the message record
   * @type Tine.Felamimail.Model.Message
   * @property record
   */

/**
   * the message record with recipients
   * @type Tine.Felamimail.Model.Message
   */

/**
   * this is true if messages are moved/deleted
   * 
   * @type Boolean
   */

/**
   * toggle Request Reading Confirmation
   */

/**
   * toggle flagged status of mail(s)
   * - Flagged/Seen
   *
   * @param {String} flag
   * @param {Boolean} flagged
   */

/**
   * toggle format
   */

/**
   * toggle mass mailing
   *
   * @param {} button
   * @param {} e
   */

/**
   * transaction id of current delete message request
   * @type Number
   */

/**
   * transaction id of current update message cache request
   * @type Number
   */

/**
   * unbindClicks
   *
   * @access public
   */

/**
   * unbindKeys
   *
   * @access public
   */

/**
   * unreadcount in default account inbox
   * @type Number
   */

/**
   * update account store after account record change
   *
   * @param {} account
   * @param {} e
   */

/**
   * update email quotas
   *
   */

/**
   * update email_account type contact addressbook
   *
   */

/**
   * update folder in this store
   * 
   * NOTE: parent_path and path are computed onLoad and must be preserved
   * 
   * @param {Array/Tine.Felamimail.Model.Folder} update
   * @return {Tine.Felamimail.Model.Folder}
   */

/**
   * update message cache of given folder for given execution time and sets the client_access_time
   * 
   * @param   {String} folderId
   * @param   {Number} executionTime (seconds)
   * @return  {Number} Ext.Ajax transaction id
   */

/**
   * update quotaBar / only do it if we have a path filter with a single account id
   * 
   * @param {Record} accountInbox
   */

/**
   * update recipient
   * 
   * @param {Tine.Addressbook.Model.Contact} contact
   * @param {String} typeToSet
   */

/**
   * update type radio buttons dom
   * 
   * @param {Array} records of type Tine.Addressbook.Model.Contact
   * @param {String} type
   */

/**
   * update vacation record
   *
   */

/**
   * updates account status icon in this tree
   * 
   * @param {Tine.Felamimail.Model.Account} account
   */

/**
   * updates compose button
   * 
   * @param {Ext.Action} action
   * @param {Object} grants grants sum of grants
   * @param {Object} records
   */

/**
   * updates context menu
   * 
   * @param {Ext.Action} action
   * @param {Object} grants grants sum of grants
   * @param {Object} records
   */

/**
   * updates folder status icons/info in this tree
   * 
   * @param {Tine.Felamimail.Model.Folder} folder
   */

/**
   * updates signature in mail body
   *
   */

/**
   * updates the given tip
   * @param {Ext.Tooltip} tip
   */

/**
   * upload new file and add to store
   *
   * @param {ux.BrowsePlugin} fileSelector
   * @param {} e
   */

/**
   * use account objects/records in get/setValue
   * 
   * @cfg {Boolean} legacy
   * @legacy
   * 
   * TODO remove this later
   */

/**
   * use beforequery to set query filter
   *
   * @param {Event} qevent
   */

/**
   * use beforequery to set query filter
   * 
   * @param {Event} qevent
   */

/**
   * use default Tpl for default and multi view
   */

/**
   * validate recipient token
   *
   * default validation:
   * - all contacts are valid
   * 
   * validation in mass mailing mode: 
   * - all contacts are valid, but the list contacts should show the tip accordingly
   * 
   * @param token
   */

/**
   * validation error message
   * @type String
   */

/**
   * wait for body content
   * 
   * @param {Tine.Felamimail.Model.Message} record
   *
   * @todo move to Tine.Felamimail.MailDetailsPanel?
   */

/**
   * write number of unread messages in all accounts into title
   * 
   * @param {Number} unreadcount
   */

/**
 * @class Ext.ux.form.HtmlEditor.EndBlockquote
 * @extends Ext.util.Observable
 * 
 * plugin for htmleditor that ends blockquotes on ENTER
 * tested with chrome, sarari, FF4+
 * fallsback for old (non IE) browser which works for easy structures
 * does not work with IE yet
 * 
 * TODO move this to ux dir
 */

/**
 * @class Ext.ux.form.HtmlEditor.SpecialKeys
 * @extends Ext.util.Observable
 * 
 * plugin for htmleditor that fires events for special keys (like CTRL-ENTER and SHIFT-TAB)
 * 
 * TODO move this to ux dir
 */

/**
 * @module Listeners
 *
 */

/**
 * @module componentWrapper
 *
 */

/**
 * @module decorators
 *
 */

/**
 * @module domHelpers
 *
 */

/**
 * @module eventHandlers
 *
 */

/**
 * @module methodWrapper
 *
 */

/**
 * @module store
 *
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.AccountEditDialog
 * @extends     Tine.widgets.dialog.EditDialog
 *
 * <p>Account Edit Dialog</p>
 * <p>
 * </p>
 *
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2009 Metaways Infosystems GmbH (http://www.metaways.de)
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 *
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.AccountEditDialog
 *
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.Application
 * @extends     Tine.Tinebase.Application
 * 
 * <p>Felamimail application obj</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * 
 * @constructor
 * Create a new  Tine.Felamimail.Application
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.AttachmentUploadGrid
 * @extends     Ext.grid.GridPanel
 *
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.ComposeEditor
 * @extends     Ext.form.HtmlEditor
 * 
 * <p>Compose HTML Editor</p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.ComposeEditor
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.ContactSearchCombo
 * @extends     Tine.Addressbook.SearchCombo
 * 
 * <p>Email Search ComboBox</p>
 * <p></p>
 * <pre></pre>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.ContactSearchCombo
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.FilterPanel
 * @extends     Tine.widgets.persistentfilter.PickerPanel
 * 
 * <p>Felamimail Favorites Panel</p>
 * 
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.FilterPanel
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.FolderSelectPanel
 * @extends     Ext.Panel
 * 
 * <p>Account/Folder Tree Panel</p>
 * <p>Tree of Accounts with folders</p>
 * <pre>
 * TODO         show error if no account(s) available
 * TODO         make it possible to preselect folder
 * TODO         use it for folder subscriptions
 * </pre>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.FolderSelectPanel
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.FolderStore
 * @extends     Ext.data.Store
 * 
 * <p>Felamimail folder store</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * 
 * @constructor
 * Create a new  Tine.Felamimail.FolderStore
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.GridDetailsPanel
 * @extends     Tine.widgets.grid.DetailsPanel
 * 
 * <p>Message Grid Details Panel</p>
 * <p>the details panel (shows message content)</p>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.GridDetailsPanel
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.GridPanelHook
 * 
 * <p>Felamimail Gridpanel Hook</p>
 * <p>
 * </p>
 * 
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @constructor
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.MailDetailsPanel
 * @extends     Ext.Panel
 *
 * TODO         replace telephone numbers in emails with 'call contact' link
 * TODO         make only text body scrollable (headers should be always visible)
 * TODO         show image attachments inline
 * TODO         add 'download all' button
 * TODO         'from' to contact: check for duplicates
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.MessageEditDialog
 * @extends     Tine.widgets.dialog.EditDialog
 *
 * <p>Message Compose Dialog</p>
 * <p>This dialog is for composing emails with recipients, body and attachments.
 * you can choose from which account you want to send the mail.</p>
 *
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 *
 * @param       {Object} config
 * @constructor
 * Create a new MessageEditDialog
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.RecipientGrid
 * @extends     Ext.grid.EditorGridPanel
 * 
 * <p>Recipient Grid Panel</p>
 * <p>grid panel for to/cc/bcc recipients</p>
 * <pre>
 * </pre>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.RecipientGrid
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.RecipientPickerDialog
 * @extends     Tine.widgets.dialog.EditDialog
 * 
 * <p>Message Compose Dialog</p>
 * <p>This dialog is for searching contacts in the addressbook and adding them to the recipient list in the email compose dialog.</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new RecipientPickerDialog
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.RecipientPickerFavoritePanel
 * @extends     Ext.tree.TreePanel
 * 
 * <p>PersistentFilter Picker Panel</p>
 * 
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.RecipientPickerFavoritePanel
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.TreeLoader
 * @extends     Tine.widgets.tree.Loader
 * 
 * <p>Felamimail Account/Folder Tree Loader</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.TreeLoader
 * 
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.TreePanel
 * @extends     Ext.tree.TreePanel
 * 
 * <p>Account/Folder Tree Panel</p>
 * <p>Tree of Accounts with folders</p>
 * <pre>
 * low priority:
 * TODO         make inbox/drafts/templates configurable in account
 * TODO         disable delete action in account ctx menu if user has no manage_accounts right
 * </pre>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.TreePanel
 * 
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.sieve.RulesDialog
 * @extends     Tine.widgets.dialog.EditDialog
 * 
 * <p>Sieve Filter Dialog</p>
 * <p>This dialog is for editing sieve filters (rules).</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new RulesDialog
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.sieve.VacationEditDialog
 * @extends     Tine.widgets.dialog.EditDialog
 *
 * <p>Sieve Filter Dialog</p>
 * <p>This dialog is editing sieve filters (vacation and rules).</p>
 * <p>
 * </p>
 *
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 *
 * @param       {Object} config
 * @constructor
 * Create a new VacationEditDialog
 */

/**
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.sieve.VacationPanel
 * @extends     Ext.Panel
 */

/**
 * @namespace   Tine.Felamimail.sieve
 * @class       Tine.Felamimail.sieve.RuleConditionsPanel
 * @extends     Tine.widgets.grid.FilterToolbar
 * 
 * <p>Sieve Filter Conditions Panel</p>
 * <p>
 * mapping when getting filter values:
 *  field       -> test_header or 'size'
 *  operator    -> comperator
 *  value       -> key
 * </p>
 * <p>
 * </p>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new RuleConditionsPanel
 */

/**
 * @namespace   Tine.Felamimail.sieve
 * @class       Tine.Felamimail.sieve.RuleEditDialog
 * @extends     Tine.widgets.dialog.EditDialog
 * 
 * <p>Sieve Filter Dialog</p>
 * <p>This dialog is editing a filter rule.</p>
 * <p>
 * </p>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010 Metaways Infosystems GmbH (http://www.metaways.de)
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * 
 * @param       {Object} config
 * @constructor
 * Create a new RuleEditDialog
 */

/**
 * @namespace   Tine.widgets
 * @class       Tine.widgets.MainScreen
 * @extends     Ext.Panel
 *
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * @namespace   Tine.widgets.container
 * @class       Tine.Felamimail.FolderFilterModel
 * @extends     Tine.widgets.grid.FilterModel
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 */

/**
 * @namespace   Tine.widgets.tags
 * @class       Tine.widgets.tags.TagsMassDetachAction
 * @extends     Ext.Action
 */

/**
 * @namespace Tine.Felamimail
 * @class     Tine.Felamimail.sieve.RulesGridPanel
 * @extends   Tine.widgets.grid.GridPanel
 * Rules Grid Panel <br>
 * 
 * @author      Philipp Schuele <p.schuele@metaways.de>
 */

/**
 * @namespace Tine.Felamimail
 * @class Tine.Felamimail.MainScreen
 * @extends Tine.widgets.MainScreen
 * 
 * MainScreen Definition
 */

/**
 * @namespace Tine.Felamimail
 * @class Tine.Felamimail.folderBackend
 * @extends Tine.Tinebase.data.RecordProxy
 * 
 * Folder Backend
 */

/**
 * @namespace Tine.Felamimail
 * @class Tine.Felamimail.messageBackend
 * @extends Tine.Tinebase.data.RecordProxy
 * 
 * Message Backend
 * 
 * TODO make clear/addFlags send filter as param instead of array of ids
 */

/**
 * @namespace Tine.Felamimail
 * @class Tine.Felamimail.rulesBackend
 * @extends Tine.Tinebase.data.RecordProxy
 * 
 * Rule Backend
 */

/**
 * @namespace Tine.Felamimail
 * @class Tine.Felamimail.vacationBackend
 * @extends Tine.Tinebase.data.RecordProxy
 * 
 * Vacation Backend
 */

/**
 * @namespace Tine.Felamimail.Model
 * @class Tine.Felamimail.Model.Flag
 * @extends Tine.Tinebase.data.Record
 * 
 * Flag Record Definition
 */

/**
 * @namespace Tine.Felamimail.Model
 * @class Tine.Felamimail.Model.Message
 * @extends Tine.Tinebase.data.Record
 * 
 * Message Record Definition
 */

/**
 * @namespace Tine.Felamimail.Model
 * @class Tine.Felamimail.Model.Record
 * @extends Ext.data.Record
 * 
 * Folder Record Definition
 */

/**
 * @namespace Tine.Felamimail.Model
 * @class Tine.Felamimail.Model.Rule
 * @extends Tine.Tinebase.data.Record
 * 
 * Rule Record Definition
 */

/**
 * @namespace Tine.Felamimail.Model
 * @class Tine.Felamimail.Model.Vacation
 * @extends Tine.Tinebase.data.Record
 * 
 * Vacation Record Definition
 */

/**
 * @param config
 * @constructor
 */

/**
 * @param {Function} fileFn
 * @param config
 * @returns {Ext.Action}
 */

/**
 * @singleton
 */

/**
 * @static
 * @private
 */

/**
 * Abstract base class for all Tine applications
 * NOTE: app class for Tinebase app itself is Tine.Tinebase.Application.Tinebase (see bellow)
 * 
 * @namespace   Tine.Tinebase
 * @class       Tine.Tinebase.Application
 * @extends     Ext.util.Observable
 * @consturctor
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 */

/**
 * Column renderer adb preferred_address field
 * @param value
 * @return {*}
 */

/**
 * Contact grid panel
 * 
 * @namespace   Tine.Addressbook
 * @class       Tine.Addressbook.ContactGridPanel
 * @extends     Tine.widgets.grid.GridPanel
 * 
 * <p>Contact Grid Panel</p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @copyright   Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Addressbook.ContactGridPanel
 */

/**
 * Contact grid panel
 * 
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.ContactGridPanel
 * @extends     Tine.Addressbook.ContactGridPanel
 * 
 * <p>Contact Grid Panel</p>
 * <p>
 * </p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2010-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.ContactGridPanel
 */

/**
 * Empty Folder
 */

/**
 * Execute promise which is provided as a separate function in order to make a clean/original promise call.
 * If there was an error, log it and return rejected promise execution so it might be used again for retrial
 *
 * @param {Object} [logger]     Custom logger that can be provided
 * @returns {function(*=): Promise<T | {rejectedPromise: *, error: any, status: string}>}
 */

/**
 * Felamimail Account Edit Popup
 *
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * Felamimail Edit Popup
 *
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * Felamimail Edit Popup
 * 
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * Felamimail FolderSelectPanel Popup
 * 
 * @param   {Object} config
 * @return  {Ext.ux.Window}
 */

/**
 * For provided list of promises and `raceTimeoutInMs` method will execute promises in parallel and wait for the
 * response for certain amount of time. After time is out (based on `raceTimeoutInMs`) caller may decide what response
 * to receive. By default method returns only promises that "won" the timeout race. Otherwise it can return all
 * reflected promises including promises that "lost" the race.
 *
 * @param {Array} listOfPromises                  A list of promises to race against time
 * @param {Number} [raceTimeoutInMs]              The time in milliseconds that each promise will race against
 * @param {String} [raceTimeoutMessage]           A custom message provided for promise which "lost" the race
 * @param {(
 * 'ONLY_RESOLVED' | 'ONLY_WINNER_PROMISES' | 'ALL'
 * )} responseMode                                Different mode will provide different responses,
 *                                                depending on caller requirements.
 * @returns {Promise<any[]>}
 */

/**
 * Message grid panel
 * 
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.GridPanel
 * @extends     Tine.widgets.grid.GridPanel
 * 
 * <p>Message Grid Panel</p>
 * <p><pre>
 * </pre></p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schüle <p.schuele@metaways.de>
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Felamimail.GridPanel
 */

/**
 * Render country name by it's iso code
 *
 * @namespace   Tine.Addressbook
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @singleton
 */

/**
 * Render given MailAddresss
 *
 * @namespace   Tine.Addressbook
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @singleton
 */

/**
 * Render given URL as html
 *
 * @namespace   Tine.Addressbook
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @singleton
 */

/**
 * Render given addresss
 *
 * You need to pass the record and a config to use this renderer.
 * The config contains a mapping, which fields from the record should have which place in the template.
 * Undefined fields won't be rendered, this keeps it well reusable for all address like purposes.
 *
 * @namespace   Tine.Addressbook
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @singleton
 */

/**
 * Render given image
 *
 * @namespace   Tine.Addressbook
 * @author      Michael Spahn <m.spahn@metaways.de>
 * @singleton
 */

/**
 * Render preferred addresss
 *
 * give the preferred address from contact. (street, postalcode and locality)
 * @namespace   Tine.Addressbook
 * @author      Christian Feitl <c.feitl@metaways.de>
 */

/**
 * Returns a process-wide unique identifier.
 */

/**
 * Statically constructs the columns used to represent a contact. Reused by ListMemberGridPanel + ListMemberRoleGridPanel
 */

/**
 * This method resolves all promises without failing, logs an error if there is logger provided and displays a final status of executed promise.
 * It can be "resolved" or "rejected". If "rejected", it also provides a reference to rejected function that returns a promise.
 * The purpose is to continue with the execution of all promises even if some of them were rejected
 *
 * @param {Array} listOfPromises      Array of promises, which are mapped into reflect function
 * @param {Object} [logger]           Custom logger that can be provided
 * @returns {Promise<any[]>}
 */

/**
 * _decorator
 *
 * @access private
 * @param {Function} methodFn The method wrapper to delegate to, based on whether user has specified a scoped decorator or not
 * @param {Array} ...args Remainder of arguments passed in
 * @return {Function} The decorated class or method
 */

/**
 * _isReactKeyDown
 *
 * @access private
 * @param {object} event The possibly synthetic event passed as an argument with
 * the method invocation.
 * @return {boolean}
 */

/**
 * _onClick
 *
 * @access private
 * @param {object} event The click event object
 * @param {object} event.target The DOM node from the click event
 */

/**
 * _onKeyDown: The keydown event callback
 *
 * @access private
 * @param {object} event The keydown event object
 * @param {number} event.which The key code (which) received from the keydown event
 */

/**
 * _shouldConsider: Conditions for proceeding with key event handling
 *
 * @access private
 * @param {object} event The keydown event object
 * @param {object} event.target The node origin of the event
 * @return {boolean} Whether to continue procesing the keydown event
 */

/**
 * activate
 *
 * @access public
 * @param {object} instance Instantiated class that extended React.Component, to be focused to receive keydown events
 */

/**
 * bindFocusables: Find any focusable child elements of the component instance and
 * add an onFocus handler to focus our keydown handlers on the parent component
 * when user keys applies focus to the element.
 *
 * NOTE: One limitation of this right now is that if you tab out of the
 * component, _focusedInstance will still be set until next click or mount or
 * controlled focus.
 *
 * @access public
 * @param {object} instance The key-bound component instance
 * @param {callback} activateOnFocus The fn to fire when element is focused
 */

/**
 * componentWrapper
 *
 * @access public
 * @param {object} WrappedComponent React component class to be wrapped
 * @param {array} [keys] The key(s) bound to the class
 * @return {object} The higher-order function that wraps the decorated class
 */

/**
 * contact selection combo box
 * 
 * @namespace   Tine.Addressbook
 * @class       Tine.Addressbook.SearchCombo
 * @extends     Ext.form.ComboBox
 * 
 * <p>Contact Search Combobox</p>
 * <p><pre>
 * TODO         make this a twin trigger field with 'clear' button?
 * TODO         add switch to filter for expired/enabled/disabled user accounts
 * </pre></p>
 * 
 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * @copyright   Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
 * 
 * @param       {Object} config
 * @constructor
 * Create a new Tine.Addressbook.SearchCombo
 * 
 * TODO         add     forceSelection: true ?
 */

/**
 * content type registry
 *
 * @param {String} appName
 * @param {Collection} contentType
 *   contentType:   {String|Object|Model}
 *   text:          {String}
 *   group:         {String} (optional)
 *   xtype:         {String} (optional)
 */

/**
 * deleteInstance
 *
 * @access public
 * @param {object} target Instantiated class that extended React.Component
 * @return {boolean} The value set.has( target ) would have returned prior to deletion
 */

/**
 * display panel item registry per MIME type
 * 
 * @namespace   Tine.Felamimail
 * @class       Tine.Felamimail.MimeDisplayManager
 * @author      Cornelius Weiss <c.weiss@metaways.de>
 * @singleton
 */

/**
 * findContainerNodes: Called by our click handler to find instances with nodes
 * that are equal to or that contain the click target. Any that pass this test
 * will be recipients of the next keydown event.
 *
 * @access public
 * @param {object} target The click event.target DOM element
 * @return {function} Reducer function
 */

/**
 * folder select trigger field
 * 
 * @namespace   Tine.widgets.container
 * @class       Tine.Felamimail.FolderSelectTriggerField
 * @extends     Ext.form.ComboBox
 * @author      Philipp Schuele <p.schuele@metaways.de>
 * 
 */

/**
 * generic exception handler for felamimail (used by folder and message backends and updateMessageCache)
 * 
 * TODO move all 902 exception handling here!
 * TODO invent requery on 902 with cred. dialog
 * 
 * @param {Tine.Exception|Object} exception
 */

/**
 * get action types for action combo and action type renderer
 * 
 * @param {} app
 * @return {Array}
 */

/**
 * get default data for rules
 * 
 * @return {Object}
 */

/**
 * get default data for vacation
 * 
 * @return {Object}
 */

/**
 * get default message data
 * 
 * @return {Object}
 */

/**
 * get email string (n_fileas <email@host.tld>) from contact
 * 
 * @param {Tine.Addressbook.Model.Contact} contact
 * @return {String}
 */

/**
 * get filtermodel for messages
 * 
 * @namespace Tine.Felamimail.Model
 * @static
 * @return {Object} filterModel definition
 */

/**
 * get flags store
 *
 * @param {Boolean} reload
 * @return {Ext.data.JsonStore}
 */

/**
 * get rule conditions for filter model and condition renderer
 * 
 * @param {} app
 * @return {Array}
 */

/**
 * getBinding
 *
 * @access public
 * @param {object} target Class used as key in dict of key bindings
 * @return {object} The object containing bindings for the given class
 */

/**
 * gets default signature text of given account
 *
 * @param {String|Tine.Felamimail.Model.Account} account
 * @param signatureRecord
 * @return {String}
 */

/**
 * helper for disabled field
 *
 * @param action
 * @param grants
 * @param records
 * @param isFilterSelect
 * @param filteredContainers
 * @returns {*}
 */

/**
 * keydown
 *
 * The main decorator and default export, handles both classes and methods.
 *
 * @access public
 * @param {Array} ...args  All (or no) arguments passed in from decoration
 * @return {Function} The decorated class or method
 */

/**
 * keydownScoped
 *
 * Method decorator that will look for changes to its targeted component's
 * `keydown` props to decide when to trigger, rather than responding directly
 * to keydown events. This lets you specify a @keydown decorated class higher
 * up in the view hierarchy for larger scoping of keydown events, or for
 * programmatically sending keydown events as props into the components in order
 * to trigger decorated methods with matching keys.
 *
 * @access public
 * @param {Array} ...args  All (or no) arguments passed in from decoration
 * @return {Function} The decorated class or method
 */

/**
 * methodWrapper
 *
 * @access public
 * @param {object} args All arguments necessary for wrapping method
 * @param {object} args.target The decorated class
 * @param {object} args.descriptor Method descriptor
 * @param {array} args.keys The array of keys bound to the given method
 * @return {object} The method descriptor
 */

/**
 * noopDecorator
 *
 * @access private
 * @return {undefined} Returns `undefined` so that the original undecorated instance/method is used
 */

/**
 * onMount
 *
 * @access public
 */

/**
 * onUnmount
 *
 * @access public
 */

/**
 * plugin to insert additional registered items into a container
 *
 * @namespace   Ext.ux
 * @class       Ext.ux.ItemRegistry
 * @autor       Cornelius Weiss <c.weiss@metaways.de>
 * @license     BSD, MIT and GPL
 *
 * @example
// register 'additional item' for myDialog
Ext.ux.ItemRegistry.registerItem('myDialog', 'add-item-xtype', 20);

// in myDialog use itemRegistyPlugin
myDialog = Ext.extend(Ext.Container, {
    ...
    plugins: [{
        ptype: 'ux.itemregistry',
        key:   'myDialog'
    }]
})
 */

/**
 * private
 *
 */

/**
 * public
 *
 */

/**
 * quicklook panel file action for attachments
 */

/**
 * registers an item for a given key
 * @static
 * 
 * @param {String|Ext.Component|Object} key
 * @param {String/Constructor/Object} item
 * @param {Number} pos (optional)
 */

/**
 * setBinding
 *
 * @access public
 * @param {object} args All arguments necessary to set the binding
 * @param {array} args.keys Key codes that should trigger the fn
 * @param {function} args.fn The callback to be triggered when given keys are pressed
 * @param {object} args.target The decorated class
 */

/**
 * sortByDOMPosition: Called by our click handler to sort a list of instances
 * according to least -> most nested. This is so that if multiple keybound
 * instances have nodes that are ancestors of the click target, they will be
 * sorted to let the instance closest to the click target get first dibs on the
 * next key down event.
 */

/**
 * tid renderer
 * 
 * @private
 * @return {String} HTML
 */

/***/

/*, mapFn, thisArg */

/*use SoftQuota*/

/*{
            // spacer
            columnWidth: 0.1,
            layout: 'fit',
            title: '',
            items: []
        }, */

//                

//                this.fireEvent('specialkey', this, e);

//                unreadChildren.push(folderId);

//                unreadChildren.remove(folderId);

//            // need to create a copy of the array here (and make sure it is unique)

//            hidden: true,

//            if (isUnread || hasUnreadChildren) {

//            if (value == '') {

//            items: []

//            parentFolder.set('unread_children', unreadChildren);

//            this.setUnreadClass(parentFolder.id);

//            var unreadChildren = Ext.unique(parentFolder.get('unread_children'));

//            { id: 'role', header: i18n._('Job Role'), dataIndex: 'role' },

//            { id: 'room', header: i18n._('Room'), dataIndex: 'room' },

//            }

//            } else {

//         callback: this.onAreaLockChange.createDelegate(this)

//         channel: "areaLocks",

//         topic: areaLock + '.*',

//        if (parentFolder) {

//        this.tbar = new Ext.Toolbar({

//        var parentFolder = this.app.getFolderStore().getParent(folder);

//        }

//        });

//     // @todo handle exception?

//     Tine.Tinebase.areaLocks.unlock(areaLock);

//     Tine.log.error('Could not create centerPanel "Tine.' + this.app.appName + '.' + contentType + suffix + '"');

//     Tine.log.error(e.stack ? e.stack : e);

//     this.postalSubscriptions.push(postal.subscribe({

//     this[contentType + suffix] = new Ext.Panel({html: 'ERROR'});

//     }));

//    initTopToolbar: function() {

//    loadRecord: false,

//    },

//  do not show exclamation mark for timeouts and connection losses

// 'nativeEvent' + type === 'keydown')

// (or just inspect nextProps.keydown.event).

// *Fix* Overridding the onRender method, in order to

// - hide from email + name columns from grid

// - show to column in grid

// -> improve this with a callback fn or something like that / unread count should be updated when the messages become visible, too

// -> open new Tine.Tinebase.widgets.dialog.PasswordDialog to set imap password field

// /accountid/folderid/...

// 1 hour

// 1. Let C be the this value.

// 10. Let lenValue be Get(items, "length").

// 11. Let len be ToLength(lenValue).

// 13. If IsConstructor(C) is true, then

// 13. a. Let A be the result of calling the [[Construct]] internal method 

// 14. a. Else, Let A be ArrayCreate(len).

// 18. Let putStatus be Put(A, "length", len, true).

// 2 minutes

// 2. Let items be ToObject(arrayLike).

// 20. Return A.

// 3. ReturnIfAbrupt(items).

// 3rd party modules

// 4. If mapfn is undefined, then let mapping be false.

// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.

// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.

// 5. else

// @TODO centralize breakpoints / have more breakpoints

// @TODO get dataurl of tine20logo

// @TODO validate parameters according to docs

// @TODO: select this suggestion!

// @keydownScoped to bind the duplicate keys in your child components

// @todo add loadMask? move loadMask from GridDetailsPanel here?

// @todo make this work again - move Tine.Felamimail.GridDetailsPanel.refetchBody here?

// @todo needed?

// @todo: Wouldn't it be cool, if this could be managed by the modelconfig as well?

// According to config, resolve the given fields from record

// Add uppercase versions of keys above for backwards compatibility

// CONCATENATED MODULE: ../../Felamimail/js/AttachmentFileAction.js

// CONCATENATED MODULE: ../../Felamimail/js/GridPanel.js

// CONCATENATED MODULE: ../../Felamimail/js/MailDetailsPanel.js

// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js

// CONCATENATED MODULE: ./node_modules/keydown/src/decorators/class_decorator.js

// CONCATENATED MODULE: ./node_modules/keydown/src/decorators/index.js

// CONCATENATED MODULE: ./node_modules/keydown/src/decorators/method_decorator.js

// CONCATENATED MODULE: ./node_modules/keydown/src/event_handlers.js

// CONCATENATED MODULE: ./node_modules/keydown/src/lib/dom_helpers.js

// CONCATENATED MODULE: ./node_modules/keydown/src/lib/keys.js

// CONCATENATED MODULE: ./node_modules/keydown/src/lib/listeners.js

// CONCATENATED MODULE: ./node_modules/keydown/src/lib/parse_keys.js

// CONCATENATED MODULE: ./node_modules/keydown/src/lib/uuid.js

// CONCATENATED MODULE: ./node_modules/keydown/src/store.js

// CONCATENATED MODULE: ./ux/form/FieldTriggerPlugin.js

// Child items are stretched to full width

// Chrome, Safari, FF4+

// Counter being incremented. JS is single-threaded, so it'll Just Work™.

// Country code to country name

// Custom rendering Template

// ESM COMPAT FLAG

// EXPORTS

// EXTERNAL MODULE: ./node_modules/keydown/src/lib/array.from.js

// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js

// EXTERNAL MODULE: ./util/waitFor.es6.js

// EXTERNAL MODULE: ./widgets/form/RecordEditFieldTriggerPlugin.js

// Exports

// Felamimail_Exception_IMAP

// Felamimail_Exception_IMAPFolderNotFound

// Felamimail_Exception_IMAPInvalidCredentials

// Felamimail_Exception_IMAPMessageNotFound

// Felamimail_Exception_IMAPServiceUnavailable

// Felamimail_Exception_SMTP

// Felamimail_Exception_Sieve

// Felamimail_Exception_SievePutScriptFail

// For browsers that do no support `event.key`, we test against a list of characters

// For old IE

// If filemanager attachments are possible check if passwords are required to enter

// If url is already wrapped in quotes, remove them

// JS only - contains node data if opened from Filemanager

// Modern browsers implement `key`, so if `key` is length 1, we have a match. e.g. 'a' for the

// Module

// NOTE cweiss 2010-06-15 this has to be precomputed on server side!

// NOTE: 'this' is moduleTreePanel here (no scope provided)

// NOTE: Flags from the server might be outdated, so we skip them

// NOTE: Server would spoil MIME structure with attachments

// NOTE: a lot of models don't have a default favorite defined...

// NOTE: due to the action updater this action is bound the the adb grid only!

// NOTE: if affected messages is decoded, we need to fetch the originals out of our store

// NOTE: in some wired cases the state is 0 - and the user has no option to resize it

// NOTE: initial loading is done by tree selection

// NOTE: it should be enough to manage on contentType level?

// NOTE: needed so ADMIN API's are used

// NOTE: runs in the scope of QuickLookPanel

// NOTE: scope has to be first item in listeners! @see Ext.ux.WindowFactory

// NOTE: signature is always in html, nl2br here would cause duplicate linebreaks!

// NOTE: we need at least one character in the newText to move cursor in

// NOTE: we need to reload store as selection model is confused otherwise

// NOTE: we sync message here as we have a promise at hand and onRecordUpdate is done before validation

// Production steps of ECMA-262, Edition 6, 22.1.2.1

// Search Lists and Contacts

// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from

// See https://drafts.csswg.org/css-values-3/#urls

// Should url be wrapped?

// Special case to return head of iframe instead of iframe itself

// Static Methods

// TODO     think about that -> when we deactivate the top toolbar, we lose the dropzone for files!

// TODO add email validator?

// TODO add this information to attachment(s) + flags and remove this

// TODO always add date items? check capabilities here / pass it in registry?

// TODO fix layout (equal width of input boxes)!

// TODO generalize this

// TODO improve accuracy of scrolling

// TODO make this work for attachment mails

// TODO move to a messageData object

// TODO reactivate when account becomes available as sometimes this stays deactivated

// TODO reload account root node

// TODO should ESC close the compose window if search combo is already empty?

// TODO somehow we have two <div class="preview-panel-felamimail"> -> we need to fix that and get the first element found

// TODO try to add a spacer/margin between the two input fields

// TODO use Tine.Filemanager.Model.Node or generic File model?

// TODO use another loader/store for subscriptions

// TODO: Need better, more complete, and more methodical key definitions

// Take up all *remaining* vertical space

// This will throw an exception if access to iframe is blocked

// Tine.Tinebase.areaLocks.registerMaskEl(this.app.appName, this.getEl());

// _('GENDER_Message')

// _.each(Tine.Tinebase.areaLocks.getLocks(this.app.appName), (areaLock) => {

// a key, or '2' for the 2 key. All other non-printable characters have names, e.g. 'Enter' or 'Backspace'.

// a quick hack to prevent duplicated popupwindow

// abort preloading/old actions and force fresh fetch

// according to instance activation (ascending)

// account node should not trigger click event but still need to be expanded

// account object

// account record

// action should always have account record

// add account nodes

// add additional action arguments

// add file upload button to toolbar

// add identities / aliases to store (for systemaccounts)

// add listeners

// add new resolved records to store

// add newline above new appended element

// add save favorites button to toolbar if favoritesPanel exists

// add this binding of keys and method to the target's bindings

// add to scrollmanager

// add unreadcount/progress/tooltip

// addMailFromRecord can be defined in config

// all mounted instances that have keybindings

// allow to configure defaults from outside

// always add own address so send message can be decrypted

// always copy/clone record because it can't exist in 2 different stores

// always disabled for non-system accounts

// always disabled for system accounts

// always remove old signature and replace new signature if found , it might be in the middle of the message

// apply to record for disableFormFields()

// as soon as we get a folder with status != complete we need to trigger checkmail soon!

// attach fm nodes only with download grant

// attachment

// auto file if original_message (from forwared/reply) was filed

// auto node expand check (only for non-account nodes)

// autoRefresh is done via onUpdateFolderStore

// autodelete draft when message is send

// binding system. if it's anything else, just pass through.

// bodyContent = this.appendSignatureHTML(format, newPosition, resolvedSignature);

// call Felamimail.getFolderStatus() with ids of outdated folders -> update folder store on success

// call parent::initComponent

// call update folder cache

// cancel old request first

// check account personal namespace -> disable 'add folder' if namespace is other than root

// check defaults if key is missing

// check folder to determine if mail should be opened in compose dlg

// check for incompletes

// check for outdated

// check if felamimail is installed and user has run right and wants to use felamimail in adb

// check if folder is in filter or allinboxes are selected and updated folder is an inbox

// check if inboxes need updates

// check if upload or fm node

// check migration_approved

// check suggestions (file_location) for reply/forward

// check the first argument to see if it's a user-supplied keycode or array

// clear gird selection on favorite change, module change, container change?

// clear query to query server again and reload subfolders

// client only {@see Tine.Felamimail.folderBackend#updateMessageCache}

// collect and ignore existing records

// companyEl

// condition from filterPanel

// console.info(path.join('/'))

// contains invitation event record

// create statusEl on the fly

// create store (get from initial registry data)

// current selection has highest prio!

// cut from cursor to end of the document

// decorated method), wrap these lifecycle methods.

// default mainscreen route

// delete

// deleting and then adding the instance(s) has the effect of sorting the set

// details panel vs. messageDisplayDialog

// determine the next level of folders that is not fetched

// dict for class prototypes => bindings

// disable filter rules/vacation if no sieve hostname is set

// disable filterToolBar

// disable this check as records are only deleted locally

// do nothing - no grid

// do request

// does nothing

// don't use this -> register from server only

// drag n dropfrom

// due to cross-origin restrictions

// effectively deactivate keydown handling by capping the set of instances

// external URL with COSR header enabled

// extuxclearabletextfield would be better, but breaks the layout big tim

// file_location means message reference is already filed (global registry)

// filter out other user accounts / edit from admin module

// finally load the record into the form

// finally select the selected node, as filtertrigger clears all selections

// find first account that has unfetched folders

// find the correct target

// fire it again here the method would trigger twice. see https://github.com/glortho/react-keydown/issues/38

// fixed dimension, thus ignoring the flex option

// fixme : how to deal with preserve_format = true && format = text/html && message.get('body_content_type') = text/plain ?

// fixme: messageId might be filemanager node id

// flag for whether click listener has been bound to document

// flag for whether keydown listener has been bound to document

// flags

// flat design

// fn keys

// folder not found -> remove folder from store and tree panel

// for Tine.Felamimail.Model.Account see hack in Felamimail.initAccountModel

// for testing purposes

// forcing blur of quickadd grids

// format of the received message. this is the format to preserve

// found a filter

// from an actual onKeyDown binding (as identified by react's addition of

// ftb.defaultFilter = isSentFolder ? 'to_list' : 'query';

// get account sent folder config

// get active node

// get aliases / forwards

// get filterToolbar

// get folder store

// get header/comperator translation

// get next free id

// get only max 50 folders at once

// get parent, update and call recursivly

// gettext('GENDER_Folder')

// gettext('GENDER_Message')

// give 5 times more before timeout

// give static item pos to existing items

// grid specific

// grr. onRecordLoad hides loadMask

// handle shared account updates in felamimail

// here we loose record.json data from old record! -> update existing record? vs. have preserveJSON props? // not a problem?

// hide all columns except name/company/email/email_home (?)

// highlight all the resolved records in UI

// i18n._('INBOX') i18n._('Drafts') i18n._('Sent') i18n._('Templates') i18n._('Junk') i18n._('Trash')

// i18n._('None')

// iconCls: fileTarget.model.getIconCls(),

// if (!contentType) return;

// if (exception.code == 404) {

// if account type == system disable most of the input fields

// if code == 925 (Felamimail_Exception_PasswordMissing)

// if no components were found as ancestors of the event target,

// if no folder is given, see if there is a folder to check in the folderstore

// if our first argument is a keydown event it is being handled by our

// if the existing signature is unchanged, it should be removed here

// if the load is cancelled, make sure we notify

// if the test argument is not an object or function, it is user-supplied

// if this is given, we load the record from a node

// if this is true, add top toolbar with actions to open mail in message display dialog

// if we deleted account, remove it from account store

// if we haven't already created a binding for this class (via another

// import React from 'react';

// import ReactDOM from 'react-dom';

// import a list of modules into the list

// in case of filterPanel

// in mass mailing mode, list should be valid to be displayed in searchContactCombo,

// increase timeout as this can take a longer (1 minute)

// increase timeout as this can take a longer (5 minutes)

// init context menu

// init drop zone

// init felamimail specific actions

// init selection model (multiselect)

// init tree loader

// initial tagging actions from parent

// initialised component

// insert item 

// insert paragraph for new text and move cursor in

// interrupt process flow till dialog is rendered

// istanbul ignore if

// istanbul ignore next

// it is only allowed to create user (external) accounts here

// it should be enough to replace only 2 or more spaces

// jump to subject if we are in the last row, and it is empty OR TAB was pressed

// just show message box for system accounts

// key hat / -> find item defined by first part and register item,regItem,possuffix -> return

// key-nav

// keybound component can respond to a given key code. to get around this,

// keycodes. else there are no arguments and it's just the wrapped class

// kill x-scrollers

// lasy wait for selection change

// layout manager won't consider this field to be of

// legacy

// legacy for reload action

// legacy handling:...

// let me = this;

// list without email and emails should be ignored

// load sieve notification emails

// local modules

// loop account folders and find the next folder path that hasn't been queried and has children

// loop through instances in reverse activation order so that most

// make sure accountStore is initialised

// make sure we get the attachment caches

// make sure, our handler is called just before the request is sent

// mark messages in UI and add to edit buffer

// mark send folders cache status incomplete

// mass mailing info text

// mass mailing mode should always expand the list

// message content is text and account format non-text

// message file info text

// messageId:partId

// method decorators without keycode (which) arguments are not allowed.

// might happen with keyNav in preview panel

// mime type is always multipart/alternative

// model generics

// move

// multiple different account ids found!

// nameEl

// need to defer the notification because the new messages are not shown yet 

// need to set data.id as well to make sure we don't get any duplicates here

// need to sync once again to make sure we have the correct recipients

// needed for refresh after file messages

// ngettext('Attachment', 'Attachments', n);

// ngettext('Flag list', 'Flag lists', n);

// ngettext('Flag', 'Flags', n);

// ngettext('Folder', 'Folders', n);

// ngettext('Message', 'Messages', n);

// ngettext('Rule', 'Rules', n);

// ngettext('Vacation', 'Vacations', n);

// ngettext('record list', 'record lists', n);

// no account found, might happen for .eml emails

// no exact matches are necessary - use the same regex as in \Tinebase_Mail::EMAIL_ADDRESS_CONTAINED_REGEXP

// node core modules

// node is not yet rendered -> reload parent

// noop, mostly suppressing error here https://github.com/glortho/react-keydown/issues/76

// not implemented @see \Felamimail_Controller_Message_File::fileAttachments

// not implemented yet

// not implemented yet                           

// not longer needed as the query filter now contains 'to' as well

// not yet

// nothing to update

// of C with an argument list containing the single item len.

// of keycodes, or if it's the wrapped class or method

// only add to combo if the account has email send grant

// only available for composing messages

// only enable some fields

// only fm files can be system links

// only refresh if 1 or no messages are selected

// or component

// password entered

// paste rest of document 

// prefill attachmentCache, all attachments cache got saved the first time, to filemanager_attachmentcache

// prepare message for forwarding in Tine.Felamimail.MessageEditDialog.handleAttachmentsOfExistingMessage

// preserve space for triggers

// prevent loading non existing remote record

// prevent long input

// private

// proxy method in order to use @keydown as filter for keydown events coming

// put filter into to, cc or bcc of record and the loading be handled by resolveRecipientFilter

// query store again (it should have the new folders now) and call callback function to add nodes

// receivedDate

// recently activated instance gets first dibs on event

// recipient

// recipientGrid should have 1 empty item by default

// refresh is explicit

// register actions in updater

// register in toolbar + contextmenu

// regularly fill attachmentCache

// reload all folders of account and try to select inbox

// reload store otherwise the recipients will not be updated

// reload tree node + remove all folders of this account from store ?

// remove delete + save actions as this makes no sense if opened from another app

// remove message from store and select next message

// remove own email and all non-email strings/objects from to/cc

// remove part id if set (that is the case in message/rfc822 attachments)

// reply-to from account or email

// reset scroller

// resolve recipients

// return <WrappedComponent {...this.props} keydown={this.state} />;

// return the decorator function, which on the next call will look for

// return the first unselected row as nextRecord

// return the list of modules as css string

// return when matching keybinding is found - i.e. only one

// run default updater

// run every 5 minutes

// save selected record for usage in onAfterEdit

// save state

// scope a common ancestor component class with @keydown and use

// search contacts if all pages are selected (filter select)

// select default favorite

// select next message (or previous if it was the last or BACKSPACE)

// self callback when body needs to be (re) fetched

// sender

// set defaults

// set format to message body format if fetch fails

// set ftb filters according to tree selection

// set the root node

// should be sorted as int

// should resolve recipients here , save data

// shouldn't this be done by the gird itself?

// show headers

// show only first condition

// show standard folders icons 

// singleSelect: true,

// skip events to prevent gird reloads on message fetch

// some eyecandy

// sometimes the height is negative, fix this here

// sometimes there is bad timing and we do not have the attachments available -> refetch body

// subject

// super( props );

// switch all msgs to one state -> toogle most of them

// switch context

// the conflict case : we want to show text/html but we also want to preserve format as text/plain

// the node that we are done

// the presence of a method name to determine if this is a wrapped method

// this is a little bit clunky but seems to be required to prevent record loading in AccountEditDialog

// this is needed to prevent grid reloads while messages are moved or deleted

// this is relayed by the contact search combo

// this should not be shown for messages that have been marked "unread" by another client

// this.getLoadMask().hide();

// this.initTopToolbar();

// this.record.id is not the original messageId, we can not get attachment from this record

// this.recordProxy = Tine.Addressbook.contactBackend;

// this.refetchBody(this.record, this.onClick.createDelegate(this, [e]));

// to make sure we have all recipients (for example when composing from addressbook with "all pages" filter)

// to simulate a keypress, set the event and then clear it in the callback

// token with emails should be collected and resolved to list members

// translations for system folders:

// trick onPrint/onPrintPreview

// try account

// try to get first account in store

// try {

// uncheck saveToAllRecipients if any recipient is unchecked

// unread icon

// unset the height and width property, so that the

// unused fn

// update inboxes more often than other folders

// update path filter

// update paths in node

// update progress

// update record recipient fields

// update reply-to

// update sieve notification emails

// update title on keyup event

// update tree node + store

// update unread count of target folder (only when moving)

// update unread count of trash folder (only needed for spam Strategy)

// update unreadcount

// update unreadcount + visibity

// use account_id here because that simplifies the adding of new records with the search comboboxes

// use first OR panel in case of filterPanel

// user presses cancel in dialog => allow to submit again or edit mail and so on!

// wait ace editor

// wait cycle

// we already whitelist shortcuts with ctrl modifiers so if we were to

// we don't delete messages, we move them to trash

// we don't set constrain here because user should be able to select both folder and file as target

// we don't want appending folder effects

// we don't want to update the preview panel on context menu

// we follow the account compose_format when fetch msg failed

// we might get the recipient token from server

// we need regexp here because query returns all records with path that begins with the value string otherwise

// we need this for adding folders to account (root level)

// we need to call doQuery fn from store to transparently do async request

// we need to decode the exception first

// westPanelToolbar.show();

// with `null`.

// }

// } catch (e) {

// } else {

// });

//@TODO: remove old url from popstate. its ugly!

//TODO: bcc only store email in \Zend_Mail::addBcc($email), do we want to change it ?

//TODO: content_type should not be experimental anymore

//Tine.Tinebase.configManager.get('registerMailToHandler', 'Felamimail');

//attachment data only accept folder node as location

//console.log('update disabled');

//draft folder show totalcount instead  

//extends React.Component {

//fixme: attachment cache created from Filemanager_Model_Node has size 0

//give mailvelope some seconds to load

//id: 'west',

//keyring.setLogo('data:image/png;base64,iVBORS==', 3)

//node.getUI().removeClass("x-tree-node-loading");

//only test connection for external user account

//overwrite custom states

//private

//register actions in updater

//requiredGrant: 'addGrant',

//return;

//select the previous row before the first selected one, if user select till the last row

//show load mask

//showTopToolbar: false,

//skip non tinebase-contact-link target

//sort by suggestion.type so file_location record survives deduplication

//spam strategy will execute move message , ham will remain in current folder

//test connection

//use Imap username if not set

//var node = options.params.path
