Set Email as High Priority & Discard Message

From WebOS Internals
Revision as of 20:00, 1 November 2009 by Mamouton (talk | contribs)
Jump to: navigation, search

I really don't like using the menu options. After seeing Jason's move folder patch, I started thinking how can I move the High Priority and Discard message to the bottom.

Always make a backup copy.

cd /usr/palm/applications/com.palm.app.email/app/controllers/ 
cp compose-assistant.js compose-assistant.js.bak
vi compose-assistant.js

Around line 82 you will see

this.cmdMenuModel = {
				visible: true,
				menuClass: 'palm-white',
				items: [
					{label:$L('Attach'), icon:'attach', command:'attach'},
					{label:('Send'), icon:'send', command:'send'}
				]}; 

add the lines

 
                                        {label:$L('Priority'), icon:'priority', command:'priority'},
					{label:$L('Delete'),icon:'delete', command:'cancel'}, 

to make it look like this

 this.cmdMenuModel = {
				visible: true,
				menuClass: 'palm-white',
				items: [
					{label:$L('Attach'), icon:'attach', command:'attach'},
					{label:$L('Priority'), icon:'priority', command:'priority'},
					{label:$L('Delete'),icon:'delete', command:'cancel'},
					{label:('Send'), icon:'send', command:'send'}
				]}; 

Update: Added discard message confirmation popup and removed the items from menu.

Around line 89 you will see

this.appMenuModel = {
				visible:true,
				items: [
					this.priorityFlagMenuItem,
					{label:$L('Discard Message'), command:'cancel'},
					{label:$L('Save as Draft'),   command:'save', disabledProperty:true }
				]};

Comment out the this priority and discard message, it should look like this

this.appMenuModel = {
				visible:true,
				items: [
					//this.priorityFlagMenuItem,
					//{label:$L('Discard Message'), command:'cancel'},
					{label:$L('Save as Draft'),   command:'save', disabledProperty:true }
				]};

Around line 238 you will see

                                       case 'cancel':
					this.cancelCompose();
					break;

change it to

                                case 'cancel':
				this.controller.showAlertDialog({
			        onChoose: function(value) {if (value == 'yes'){this.cancelCompose();}},
				title: $L("Discard this Draft?"),
				message: $L("This cannot be undone"),
				choices:[
					{label:$L('Yes'), value:"yes", type:'negative'},  
					{label:$L("No"), value:"no", type: 'dismiss'}
						]
				});
                                break;

Special Thanks to Jason on Precentral for the realization that menu items could be moved and the creator of the Read All Delete All patch for the icons.

Special Thanks to Tibfib for his creation of the discard message confirmation and removing the menu items.