Results 1 to 10 of 10
  1.    #1  
    Updated for significant performance improvement.

    Verified to work with WebOS 1.2 and 1.2.1

    This will add a button at the bottom of the screen with a trashcan icon between the Compose and Refresh buttons. Selecting the button will delete all email items in the list after prompting the user for confirmation.

    I am deliberately not using line numbers to minimize the need for updates as new WebOS releases come out.

    Open:
    Code:
    sudo vi /usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.jsjsjs
    Find the setup function and modify the cmdMenuModel items, replace the
    Code:
    {},
    with
    Code:
    {label:$L('Delete All'), icon:'delete', command:'deleteall'},
    Find the handleCommand function and add the following case statement:

    Code:
    case 'deleteall':
    	this.handleDeleteAll();
    	break;
    Now add the following three functions:
    Code:
      handleDeleteAllResponse: function (event) {
            //check to see if there are more items to delete.
            this.deleteAll();
      },
    
      deleteAll: function(){
      
      	var count = this.emailListElement.mojo.getLength();
    
            var id;
    
            if(count > 0)
            {
                    var i;
    
                    //Since the list is loaded dynamically we may have the count of all emails but not all of the data
                    //So start with count and work backward with error handling
                    //When reach 0 trigger at least one more pass after data has had a chance to refresh
                    for(i=count-1; i>=0; i--)
                    {
                            var item = this.emailListElement.mojo.getNodeByIndex(i);
    
                            if(item !== undefined)
                            {
                                    id = item.id;
    
                                    if(id)
                                    {
                                            if(i==0)
                                            {
                                                    this.controller.serviceRequest(Email.identifier, {
                                                            method: 'setDeleted',
                                                            parameters: {'message':id, 'value': true },
                                                            onSuccess: this.handleDeleteAllResponse.bind(this),
                                                            onFailure: this.handleDeleteAllResponse.bind(this)
                                                            });
                                            }
                                            else
                                            {
                                                    this.controller.serviceRequest(Email.identifier, {
                                                            method: 'setDeleted',
                                                            parameters: {'message':id, 'value': true },
                                                            onSuccess: undefined,
                                                            onFailure: undefined
                                                            });
                                            }
                                    }//if(id)
                            }//if item !== undefined
                            else
                            {
                                    if(i==0)
                                    {
                                            //item was undefined probably because it is currently marked for delete
                                            this.deleteAll();
                                    }
                            }
                    }//for
            }//count > 0
      },
    
      handleDeleteAll: function (event) {
       	
    	var totalCount = 0;
    	
    	totalCount = this.emailListElement.mojo.getLength();
    	
    	this.controller.showAlertDialog({
                                 onChoose: function(value) {
      	                              		if(value == 'yes') {
    							//Delete all items in this folder
    							this.deleteAll();
    	                        	        	}
    						},
    	                                	title: '<b>' + $L('Delete All') + '</b>',
                          				message: $L('Are you sure you want to delete all ') + "<b>" + totalCount + "</b>" + $L(' items in this folder?'),
                           				choices: [
                                   				{label:$L('Yes'), value:'yes', type:'affirmative'},
                                        			{label:$L('No'), value:'no', type:'alert'}
                                                     	]
                    			});
      },
    Last edited by Lclarkjr; 10/03/2009 at 08:01 PM.
  2. #2  
    Thanks, but where do we type all of that? How do we get to the code?
  3. #3  
    im kinda confused, not with the code part, but i have a rooted pre but when i put the first line in it says that "permission denied",

    i know that i have to log in, i did that at the beginning but i don't know how to do it now,

    can someone please help me with loging in to the pre
  4. #4  
    Where are you "putting in the first line"?

    Typing that as-is won't work, you need to open the file in a text editor. Lclarkjr was only telling you the filename, not giving you a command to open the file.

    Code:
    sudo vi /usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.jsjsjs
    Read up on editing in vi, or look up instructions to install an easier editor like nano or pico.

    You will probably also have to remount the filesystem as read/write.
  5. #5  
    It would be awesome if someone could create an App that did this same thing. I could root my Pre and get it done, but don't feel like having to re-do all the rooting/changing after an OS Update, so I haven't rooted.

    Any one want to grab this one?
  6. #6  
    it'd be great if someone could add this to the webos-internals patches.
  7. #7  
    Quote Originally Posted by panda6 View Post
    Where are you "putting in the first line"?

    Typing that as-is won't work, you need to open the file in a text editor. Lclarkjr was only telling you the filename, not giving you a command to open the file.

    Code:
    sudo vi /usr/palm/applications/com.palm.app.email/app/controllers/list-assistant.jsjsjs
    Read up on editing in vi, or look up instructions to install an easier editor like nano or pico.

    You will probably also have to remount the filesystem as read/write.
    ok thanks!!!
  8. Nesta's Avatar
    Posts
    134 Posts
    Global Posts
    139 Global Posts
    #8  
    Quote Originally Posted by jwdesselle View Post
    It would be awesome if someone could create an App that did this same thing. I could root my Pre and get it done, but don't feel like having to re-do all the rooting/changing after an OS Update, so I haven't rooted.

    Any one want to grab this one?
    I second that.
  9.    #9  
    Verified to work with WebOS 1.2 and 1.2.1
  10.    #10  
    This has now been combined with the Read All feature and is a patch named Read All Delete All. It is available in Preware.

Tags for this Thread

Posting Permissions