<commit_before>/**
 * @license
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
EMail.ATTACHMENTS.tableLabel = '<img src="images/paperclip.gif">';

var metricsSrv = {
  send: function(){},
  sendEvent: function() {},
  sendAppView: function(){},
  sendException:function(){},
  sendSocial: function(){},
  sendTiming: function(){},
  set: function(){},
  startTiming: function() {
    return { send: function() {} };
  }
};

var menu = ToolbarView.create({
  horizontal: false,
});
menu.addActions(FOAM([
   {
      model_: 'Action',
      name: 'newWindow',
      help: 'Open a new Saturn Mail client.',
      action: function () {
         launchController();
      }
   },
   {
      model_: 'Action',
      name: 'syncConfig',
      help: 'View and/or update configuration.',
      action: function () {
         openSettings();
      }
   },
   {
      model_: 'Action',
      name: 'contacts',
      help: 'Manage contacts.',
      action: function () {
         console.log('contacts');
         launchContactController();
      }
   },
   {
      model_: 'Action',
      name: 'labels',
      help: 'Manage labels.',
      action: function () {
         console.log('labels');
      }
   }
]));

openComposeView = function(email) {
  aseq(arequire('QuickEMailView'),
    arequire('QuickCompose'),
    arequire('LinkView'),
    arequire('RichTextView'),
    arequire('ContactListTileView'),
    arequire('AutocompleteListView'))(function() {
      var compose = QuickCompose.create({
        email: email,
        isFull: true,
      });
      stack.pushView(compose);
  });
}

var actions = FOAM([
   {
      model_: 'Action',
      name: 'compose',
      label: '',
      help: 'Compose a new email.',
      action: function () {
        var email = EMail.create({
          from: ME,
        id: Math.floor(Math.random() * 0xffffff).toVarintString()
        });
        openComposeView(email);
      }
   }
]).concat(Conversation.actions.filter(function(a) { return a.name !== "open"; }));

actions[0].iconUrl = 'images/pencil.png';

EMail.REPLY.iconUrl = 'images/reply.svg';
EMail.REPLY_ALL.iconUrl = 'images/reply_all.svg';
EMail.FORWARD.iconUrl = 'images/forward.svg';
EMail.STAR.iconUrl = 'images/star_full_large.svg';
EMail.ARCHIVE.iconUrl = 'images/archive.svg';
EMail.SPAM.iconUrl = 'data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="21px" height="21px" viewBox="0 0 21 21" overflow="visible" enable-background="new 0 0 21 21" xml:space="preserve"><defs></defs><polygon points="7.101,17 3,12.899 3,7.1 7.101,3 12.899,3 17,7.1 17,12.899 12.899,17 "/><circle fill="#F2F2F2" cx="10" cy="12.999" r="1.05"/><polygon fill="#F2F2F2" points="9,6 11,6 10.65,11 9.35,11 "/><rect opacity="0" fill="#4387FD" width="21" height="21"/></svg>';
EMail.TRASH.iconUrl = 'data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="21px" height="21px" viewBox="0 0 21 21" overflow="visible" enable-background="new 0 0 21 21" xml:space="preserve"><defs></defs><polygon points="11.997,4 11.997,3 8.003,3 8.003,4 4,4 4,6 16,6 16,4 "/><rect x="5" y="7" width="10" height="11"/><rect opacity="0" fill="#4387FD" width="21" height="21"/></svg>';

actions.forEach(function(a) { a.showLabel = false; });


/** Modify the default QueryParser so that label ids are looked up in the EMailLabels DAO. **/
var queryParser = {
  __proto__: QueryParserFactory(EMail),<commit_msg>Fix compose view to fill in the from value of the composed message.<commit_after>/**
 * @license
 * Copyright 2012 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
EMail.ATTACHMENTS.tableLabel = '<img src="images/paperclip.gif">';

var metricsSrv = {
  send: function(){},
  sendEvent: function() {},
  sendAppView: function(){},
  sendException:function(){},
  sendSocial: function(){},
  sendTiming: function(){},
  set: function(){},
  startTiming: function() {
    return { send: function() {} };
  }
};

var menu = ToolbarView.create({
  horizontal: false,
});
menu.addActions(FOAM([
   {
      model_: 'Action',
      name: 'newWindow',
      help: 'Open a new Saturn Mail client.',
      action: function () {
         launchController();
      }
   },
   {
      model_: 'Action',
      name: 'syncConfig',
      help: 'View and/or update configuration.',
      action: function () {
         openSettings();
      }
   },
   {
      model_: 'Action',
      name: 'contacts',
      help: 'Manage contacts.',
      action: function () {
         console.log('contacts');
         launchContactController();
      }
   },
   {
      model_: 'Action',
      name: 'labels',
      help: 'Manage labels.',
      action: function () {
         console.log('labels');
      }
   }
]));

openComposeView = function(email) {
  aseq(arequire('QuickEMailView'),
    arequire('QuickCompose'),
    arequire('LinkView'),
    arequire('RichTextView'),
    arequire('ContactListTileView'),
    arequire('AutocompleteListView'))(function() {
      var compose = QuickCompose.create({
        email: email,
        userInfo: userInfo,
        isFull: true,
      });
      stack.pushView(compose);
  });
}

var actions = FOAM([
   {
      model_: 'Action',
      name: 'compose',
      label: '',
      help: 'Compose a new email.',
      action: function () {
        var id = Math.floor(Math.random() * 0xffffff).toVarintString();
        var email = EMail.create({
          from: userInfo.email,
          id: id,
          convId: id
        });
        openComposeView(email);
      }
   }
]).concat(Conversation.actions.filter(function(a) { return a.name !== "open"; }));

actions[0].iconUrl = 'images/pencil.png';

EMail.REPLY.iconUrl = 'images/reply.svg';
EMail.REPLY_ALL.iconUrl = 'images/reply_all.svg';
EMail.FORWARD.iconUrl = 'images/forward.svg';
EMail.STAR.iconUrl = 'images/star_full_large.svg';
EMail.ARCHIVE.iconUrl = 'images/archive.svg';
EMail.SPAM.iconUrl = 'data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="21px" height="21px" viewBox="0 0 21 21" overflow="visible" enable-background="new 0 0 21 21" xml:space="preserve"><defs></defs><polygon points="7.101,17 3,12.899 3,7.1 7.101,3 12.899,3 17,7.1 17,12.899 12.899,17 "/><circle fill="#F2F2F2" cx="10" cy="12.999" r="1.05"/><polygon fill="#F2F2F2" points="9,6 11,6 10.65,11 9.35,11 "/><rect opacity="0" fill="#4387FD" width="21" height="21"/></svg>';
EMail.TRASH.iconUrl = 'data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" x="0px" y="0px" width="21px" height="21px" viewBox="0 0 21 21" overflow="visible" enable-background="new 0 0 21 21" xml:space="preserve"><defs></defs><polygon points="11.997,4 11.997,3 8.003,3 8.003,4 4,4 4,6 16,6 16,4 "/><rect x="5" y="7" width="10" height="11"/><rect opacity="0" fill="#4387FD" width="21" height="21"/></svg>';

actions.forEach(function(a) { a.showLabel = false; });


/** Modify the default QueryParser so that label ids are looked up in the EMailLabels DAO. **/
var queryParser = {
  __proto__: QueryParserFactory(EMail),
{'fraction_non_alphanumeric': 0.17243388092741466, 'fraction_numerical': 0.04846790166608412, 'mean_word_length': 3.4685059864653827, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1307439', 'n_tokens_mistral': 3126, 'n_tokens_neox': 2860, 'n_words': 664}