Home | Stories | Reviews | Treo™ Store | Accessories | Software | Discussion | Mobile | About | Search

 
 
InnoCase II Seidio InnoCase II for Treo Pro
Just $29.95
Cruiser Bluetooth Car Kit Speakerphone Jabra Cruiser Bluetooth Car Kit Speakerphone
Just $89.95
Innocell 3500mAh Extended Battery Seidio Innocell 3500mAh Extended Battery for Treo Pro
Just $69.95
 Pen Stylus  (3-Pack) SPE Pen Stylus for Treo 650
Just $7.95
 
Old 08/05/2009, 11:29 PM   #1 (permalink)
Member
 
Join Date: Jun 2009
Posts: 205
Thanks: 1
Thanked 62 Times in 35 Posts
Default Adding Delete All to Email App

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.js
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 10:01 PM.
Lclarkjr is offline   Reply With Quote
Old 08/06/2009, 10:52 AM   #2 (permalink)
Member
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 2 Times in 1 Post
Default Thanks

Thanks, but where do we type all of that? How do we get to the code?
Anada is offline   Reply With Quote
Old 08/06/2009, 11:17 AM   #3 (permalink)
Member
 
Join Date: Jun 2009
Posts: 166
Thanks: 5
Thanked 3 Times in 3 Posts
Default

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
chefjabril11 is offline   Reply With Quote
Old 08/06/2009, 11:27 AM   #4 (permalink)
Member
 
Join Date: Jun 2009
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.js
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.
panda6 is offline   Reply With Quote
Old 08/06/2009, 11:31 AM   #5 (permalink)
Member
 
jwdesselle's Avatar
 
Join Date: Feb 2009
Location: Baton Rouge, LA
Posts: 242
Thanks: 81
Thanked 41 Times in 28 Posts
Default

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?
jwdesselle is offline   Reply With Quote
Old 08/06/2009, 12:05 PM   #6 (permalink)
Member
 
Kyusaku's Avatar
 
Join Date: Apr 2007
Posts: 930
Thanks: 57
Thanked 109 Times in 73 Posts
Default

it'd be great if someone could add this to the webos-internals patches.
Kyusaku is offline   Reply With Quote
Old 08/06/2009, 12:12 PM   #7 (permalink)
Member
 
Join Date: Jun 2009
Posts: 166
Thanks: 5
Thanked 3 Times in 3 Posts
Default

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.js
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!!!
chefjabril11 is offline   Reply With Quote
Old 08/06/2009, 01:14 PM   #8 (permalink)
Member
 
Join Date: Oct 2003
Posts: 95
Thanks: 18
Thanked 4 Times in 4 Posts
Default

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.
Nesta is offline   Reply With Quote
Old 10/03/2009, 10:03 PM   #9 (permalink)
Member
 
Join Date: Jun 2009
Posts: 205
Thanks: 1
Thanked 62 Times in 35 Posts
Default

Verified to work with WebOS 1.2 and 1.2.1
Lclarkjr is offline   Reply With Quote
Old 10/18/2009, 01:30 AM   #10 (permalink)
Member
 
Join Date: Jun 2009
Posts: 205
Thanks: 1
Thanked 62 Times in 35 Posts
Default

This has now been combined with the Read All feature and is a patch named Read All Delete All. It is available in Preware.
Lclarkjr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

~


All times are GMT -4. The time now is 08:39 AM.

Creating smartphone communities
Android Central - Android reviews, news and forums Crackberry - Blackberry news, reviews and community TiPb - iPhone news, accessory reviews & forums
Pre Central - Palm Pre Review, News and Community Treo Central - Treo & Centro News and Forums WMExperts - Windows Mobile Reviews & News

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
 
 

Copyright ©1999- TreoCentral. All rights reserved : Terms of Use : Privacy Policy

TREO and TreoCentral are trademarks or registered trademarks of palm, Inc. in the United States and other countries;
the TreoCentral mark and domain name are used under license from palm, Inc.
The views expressed on this website are solely those of the proprietor, or
contributors to the site, and do not necessarily reflect the views of palm, Inc.

Explore More: Crackberry | WMExperts | the iPhone Blog | Android Central | Smartphone Experts Combined Forums