Updated adv app launch cfg patch
[webos-internals:modifications.git] / app-launcher / app-launcher-advanced-configuration-for-app-launcher.patch
1 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
3 @@ -33,6 +33,16 @@
4                 
5                 this.getBuildName();
6                                                 
7 +               // Subscribe to the Quick Launch Bar prererences
8 +               this.quickLaunchCfg = null;
9 +
10 +               this.getPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice', {
11 +                       method: 'getPreferences', parameters: {"keys":["quickLaunchCfg"],"subscribe": true},
12 +                       onSuccess: function(payload) {
13 +                               if((payload != undefined) && (payload.quickLaunchCfg != undefined))
14 +                                       this.quickLaunchCfg = payload.quickLaunchCfg;
15 +                               }.bind(this) });
16 +               
17                 // Initialize the Battery Power Nofication and get the initial value
18                 this.initOnServerStart("com.palm.power", this.powerInitialize.bind(this), this.powerDeInit.bind(this));
19                 
20 @@ -316,6 +326,11 @@
21                 $('carrier').show();
22                 this.foregroundAppID=null;
23         }
24 +
25 +       if((this.quickLaunchCfg) && (this.quickLaunchCfg.mode == "hidden")) {
26 +               this.controller.serviceRequest('palm://com.palm.systemmanager', {
27 +                       method: 'systemUi', parameters: {"quicklaunch": false} });
28 +       }
29  },
30  
31  updatePhoneAppName: function(){
32 --- .orig/usr/lib/luna/system/luna-applauncher/app/controllers/global-search-assistant.js
33 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/global-search-assistant.js
34 @@ -212,6 +212,10 @@
35                         this.launcherHiddenAtFirstKeydown = true;
36                 }
37                 
38 +               this.viewMenuState = this.launcherAssistant.viewMenuModel.visible;
39 +               this.launcherAssistant.viewMenuModel.visible = false;
40 +               this.controller.modelChanged(this.launcherAssistant.viewMenuModel, this);
41 +               
42                 // save the launchers scroller states
43                 this.controller.hideWidgetContainer(this.controller.getSceneScroller());
44                 this.controller.get('launcher-main').hide();
45 @@ -237,6 +241,9 @@
46                         return;
47                 }
48                 
49 +               this.launcherAssistant.viewMenuModel.visible = this.viewMenuState;
50 +               this.controller.modelChanged(this.launcherAssistant.viewMenuModel, this);
51 +               
52                 // restore the launchers scroller states
53                 this.controller.get('global-search-main').addClassName('offscreen');
54                 this.controller.get('launcher-main').show();
55 @@ -249,9 +256,6 @@
56                         SystemManagerService.showLauncher(false);
57                         this.launcherHiddenAtFirstKeydown = false;
58                 }
59 -               else {
60 -                       SystemManagerService.showQuickLaunch(true);
61 -               }
62                 
63                 this.galInit();
64         },
65 @@ -265,15 +269,13 @@
66         },
67         
68         onKeyDown: function(event) {
69 -               
70 -               this.searchField.mojo.focus();
71  
72                 // block key events from global search
73 -               if (!this.searchEnabled) {
74 -                       event.stop();
75 +               if (!this.searchEnabled)
76                         return;
77 -               }
78                 
79 +               this.searchField.mojo.focus();
80 +
81                 // track whether we should hide the launcher when exiting global search
82                 if (this.searchTerm.length === 0 && !Mojo.Controller.stageController.isActiveAndHasScenes()) {                  
83                         this.launcherHiddenAtFirstKeydown = true;
84 @@ -283,10 +285,8 @@
85         onKeyUp: function(event) {
86                 
87                 // block key events from global search
88 -               if (!this.searchEnabled) {
89 -                       event.stop();
90 +               if (!this.searchEnabled)
91                         return;
92 -               }
93         
94                 // first key no longer being held
95                 this.searchPressHoldTerm = "";
96 @@ -299,6 +299,10 @@
97         
98         onKeyPress: function(event) {
99                 
100 +               // block key events from global search
101 +               if (!this.searchEnabled)
102 +                       return;
103 +                               
104                 if(this.searchPressHoldTerm && this.searchPressHoldTerm.length > 0 && event.keyCode != this.searchPressHoldTerm.charCodeAt(0)) {
105                 // first key no longer being held
106              this.searchPressHoldTerm = "";
107 @@ -310,8 +314,7 @@
108          } 
109  
110                 // block key events from global search and from repeating until the first key has been processed
111 -               if (!this.searchEnabled || 
112 -                       this.searchPressHoldTerm.length !== 0 ||
113 +               if (this.searchPressHoldTerm.length !== 0 ||
114                         (event.keyCode === Mojo.Char.spaceBar && !this.searchActive)) {
115                         
116                         event.stop();
117 @@ -341,6 +344,10 @@
118         
119         onSearchTermChanged: function(event) {
120                 
121 +               // block key events from global search
122 +               if (!this.searchEnabled)
123 +                       return;
124 +               
125                 if (event.originalEvent && event.originalEvent.keyCode === Mojo.Char.enter) {
126                         if (this.currentFilter.length > 0) {
127                                 // i'm feeling lucky
128 --- .orig/usr/lib/luna/system/luna-applauncher/app/controllers/reorder-controller.js
129 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/reorder-controller.js
130 @@ -239,6 +239,10 @@
131                 for (var i = 0, len = this.appDivs.length; i < len; ++i) {
132                         
133                         var pos = this.launcherAssistant.calculateAppPosition(i);
134 +                       
135 +                       if(this.launcherAssistant.appLauncherCfg.header)
136 +                               pos.top = pos.top + 50;
137 +                       
138                         var item = new Element('div', {'class': 'droppable'});
139                         item.style.left = pos.left+'px';
140                         item.style.top = pos.top+'px';
141 @@ -314,7 +318,10 @@
142         
143         _startCyclePage: function(direction) {
144                 if (!this.pagingTimer && !this.pagingAnimating) {
145 -                       this.pagingTimer = this._cyclePage.bind(this, direction).delay(this.kHorizontalPageTimeout);
146 +                       if(this.launcherAssistant.appLauncherCfg.wrap)
147 +                               this.pagingTimer = this._cyclePage.bind(this, direction).delay(this.kHorizontalPageTimeout * 2);
148 +                       else
149 +                               this.pagingTimer = this._cyclePage.bind(this, direction).delay(this.kHorizontalPageTimeout);
150                         
151                         Mojo.listen($('launcher_root'), Mojo.Event.scrollStarting, this.scrollerListenerHandler);
152                 }
153 @@ -427,15 +434,37 @@
154         _cyclePage: function(direction) {
155                 
156                 var canPage = false;
157 +               var snapIndex = 0;
158 +
159                 if (direction == -1 && this.activePage.previous() !== null) {
160                         this.previousPage = this.activePage;
161                         this.activePage = this.activePage.previous();
162                         canPage = true;
163 +                       snapIndex = this.launcherAssistant.activePageIndex + direction;
164 +               }
165 +               else if (direction == -1 && this.activePage.previous() == null) {
166 +                       if(this.launcherAssistant.appLauncherCfg.wrap) {
167 +                               this.previousPage = this.activePage;
168 +                               while(this.activePage.next() !== null)
169 +                                       this.activePage = this.activePage.next();
170 +                               canPage = true;
171 +                               snapIndex = this.launcherAssistant.pagesModel.getNumPages() - 1;
172 +                       }
173                 }
174                 else if (direction == 1 && this.activePage.next() !== null) {
175                         this.previousPage = this.activePage;
176                         this.activePage = this.activePage.next();
177                         canPage = true;
178 +                       snapIndex = this.launcherAssistant.activePageIndex + direction;
179 +               }
180 +               else if (direction == 1 && this.activePage.next() == null) {
181 +                       if(this.launcherAssistant.appLauncherCfg.wrap) {
182 +                               this.previousPage = this.activePage;
183 +                               while(this.activePage.previous() !== null)
184 +                                       this.activePage = this.activePage.previous();
185 +                               canPage = true;
186 +                               snapIndex = 0;
187 +                       }
188                 }
189             
190                 if (canPage) {
191 @@ -446,7 +475,16 @@
192                         this.activePage.show();
193                         
194                         this.pagingAnimating = true;
195 -                       $('launcher_root').mojo.setSnapIndex(this.launcherAssistant.activePageIndex + direction, true);
196 +                       
197 +                       this.launcherAssistant.changePage(snapIndex, true);
198 +                       
199 +                       if(this.launcherAssistant.appLauncherCfg.wrap) {
200 +                               this.launcherAssistant.onPageChange({value: snapIndex});
201 +                               
202 +                               this.pagingAnimating = false;
203 +                               var previousPageIndex = this.launcherAssistant.getPageIndex(this.previousPage);
204 +                               this._pagingComplete(previousPageIndex, this.launcherAssistant.activePageIndex);
205 +                       }
206                 }
207         },
208         
209 --- .orig/usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
210 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/launcher-assistant.js
211 @@ -8,7 +8,7 @@
212          * hardcoding the quick launch height until we can find a better way. 
213          * This value = ql graphic height - the offset from the top (small fade area)
214          */
215 -       kQuickLaunchHeight: 67,
216 +       kQuickLaunchHeight: 0,
217         
218         kPageIndicatorSpacing: 6,       /* spacing between each page indicator */
219         kPageMargin: 10, /* 10 pixel margin on each side of a page */
220 @@ -23,11 +23,26 @@
221                 visible: true,
222                 label: $L('Launcher'),
223          items: [
224 -                       /*{ label: $L('New page'), command: 'newpage' },
225 -                       { label: $L('Delete page'), command: 'deletepage' },*/
226                         Mojo.Menu.editItem,
227 -                       { label: $L('List Apps...'), command: 'listapps' },
228 -                       { label: $L('Default Applications'), command: 'defaultapps'},
229 +                       { label: $L('App Launcher'),
230 +                               items: [
231 +                                       { label: $L('Enter Edit Mode'), command: 'toggleedit' },
232 +                                       { label: $L('Show Page Header'), command: 'toggleheader' },
233 +                                       { label: $L('Use Tabs for Pages'), command: 'togglevisual' },
234 +                                       { label: $L('Set As Default Page'), command: 'togglepage' },
235 +                                       { label: $L('Enable Position Reset'), command: 'togglereset' },
236 +                                       { label: $L('Enable Page Wrapping'), command: 'togglewrap' }
237 +                               ]
238 +                       },
239 +                       { label: $L('Quick Launch Bar'), 
240 +                               items: [
241 +                                       { label: $L('Always Visible'), command: 'qlvisible', disabled: false },
242 +                                       { label: $L('Always Hidden'), command: 'qlhidden', disabled: false },
243 +                                       { label: $L('Hide in Launcher'), command: 'qlmixed', disabled: false }
244 +                               ]
245 +                       },
246 +                       { label: $L('List All Applications'), command: 'listapps' },
247 +                       { label: $L('Default Applications'), command: 'defaultapps' },
248                         Mojo.Menu.helpItem
249                 ]
250      },
251 @@ -59,12 +74,57 @@
252                 
253                 this.dragStartHandler = this.onDragStart.bindAsEventListener(this);
254                 this.launchApp = this.launchApp.bind(this);
255 +
256 +               this.pageText = "";
257 +               this.renaming = false;
258 +
259 +               this.activePageIndex = 0;
260 +               
261 +               this.pagingAnimating = false;
262 +               
263 +               this.appLauncherCfg = {header: false, reset: false, wrap: false, page: "default", pages: [], hidden: [], visual: "name"};
264 +               
265 +               this.quickLaunchCfg = {mode: "visible"};
266         },
267         
268         setup: function() {
269                 
270 +               this.getPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
271 +                       method: 'getPreferences', parameters: {subscribe: false, keys: ['appLauncherCfg', 'quickLaunchCfg']},
272 +                       onSuccess: this.handlePreferences.bind(this) });
273 +
274 +               this.viewMenuModel = {visible: false, items: []};
275 +
276 +               this.controller.setupWidget(Mojo.Menu.viewMenu, {spacerHeight: 0, menuClass: 'no-fade'},
277 +                       this.viewMenuModel);
278 +
279 +               this.commandMenuModel = {visible: false, items: [
280 +                       {items: [
281 +                               { icon: "new", command: "addnewpage"},
282 +                               { icon: 'delete', command: 'deletepage'}
283 +                       ]},
284 +                       {label: "Rename", command: "renamepage", width: 100},
285 +                       {items: [
286 +                               { icon: "back", command: "movepageleft"},
287 +                               { icon: 'forward', command: 'movepageright'}
288 +                       ]} ]};
289 +
290 +               this.controller.setupWidget(Mojo.Menu.commandMenu, {spacerHeight: 0, menuClass: 'no-fade'},
291 +                       this.commandMenuModel);
292 +
293 +               Mojo.listen(this.controller.document, Mojo.Event.activate, this.onActivate.bindAsEventListener(this));
294                 Mojo.listen(this.controller.document, Mojo.Event.deactivate, this.onDeactivate.bindAsEventListener(this));
295                 Mojo.listen(this.controller.window, 'resize', this.onResize.bindAsEventListener(this));
296 +
297 +               this.launcherTapHandler = this.handleLauncherTap.bindAsEventListener(this);
298 +               Mojo.listen($('launcher_root'), Mojo.Event.tap, this.launcherTapHandler);
299 +
300 +               this.headerTapHandler = this.handleHeaderTap.bindAsEventListener(this);
301 +               Mojo.listen($('page_header'), Mojo.Event.tap, this.headerTapHandler);
302 +               
303 +               this.appRenameHandler = this.handleAppRename.bindAsEventListener(this);
304 +               
305 +               this.pageRenameHandler = this.handlePageRename.bindAsEventListener(this);
306                 
307                 this.pagesModel = new LauncherPages({
308                                 onPagesLoaded: this.buildPages.bind(this),
309 @@ -82,12 +142,20 @@
310                 Mojo.Controller.stageController.focused = false;
311                 
312                 this.controller.setupWidget('launcher_root', undefined, this.launcherRootModel);
313 -               
314 +
315                 this.reorderController = new ReorderController(this, this.onReorderFinished.bind(this));
316 -               Mojo.listen($('launcher_root'), Mojo.Event.propertyChange, this.onPageChange.bindAsEventListener(this));
317                 
318 -               this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems:true}, this.appMenuModel);
319 +               this.pageChangeHandler = this.onPageChange.bindAsEventListener(this);
320 +               Mojo.listen($('launcher_root'), Mojo.Event.propertyChange, this.pageChangeHandler);
321 +               
322 +               this.scrollStartingHandler = this.scrollStarting.bindAsEventListener(this);
323  
324 +               this.controller.setupWidget(Mojo.Menu.appMenu, {omitDefaultItems:true}, this.appMenuModel);
325 +               
326 +               this.pageNameModel = { value: this.pageText };
327 +               
328 +               this.controller.setupWidget('page_text', {disabled: false, changeOnKeyPress: true}, this.pageNameModel);
329 +               
330                 // pre-calculate commonly used measurements
331                 this.kPageWidth = $('launcher_root').getWidth();
332                 this.kPageWidthNoMargin = (this.kPageWidth - this.kPageMargin * 2);
333 @@ -121,23 +189,80 @@
334                                 case 'defaultapps':
335                                         ApplicationService.launch(this.deviceInfo.id, this.deviceInfo.defaultAppParams);
336                                         break;
337 -                               /*
338 -                               case 'newpage':
339 -                                       if (this.pageDivs.length < 10) {
340 -                                               this.insertPage(this.activePageIndex, true);
341 +                               case 'qlvisible':
342 +                                       this.setupQuickLaunch("visible");
343 +                                       break;
344 +                               case 'qlhidden':
345 +                                       this.setupQuickLaunch("hidden");
346 +                                       break;
347 +                               case 'qlmixed':
348 +                                       this.setupQuickLaunch("mixed");
349 +                                       break;
350 +                               case 'addnewpage':
351 +                                       if (this.pageDivs.length < 16) {
352 +                                               this.insertPage(this.pageDivs.length, true);
353                                         }
354                                         break;
355                                 case 'deletepage':
356                                         if (this.pageDivs.length > 1) {
357 -                                               this.deletePage(this.activePageIndex);
358 -                                               if (this.activePageIndex >= this.pageDivs.length) {
359 -                                                       this.activePageIndex = this.pageDivs.length - 1;
360 -                                               }
361 +                                               this.confirmDelete();
362                                         }
363                                         break;
364 -                               */
365 +                               case 'renamepage':
366 +                                       this.startPageRename();
367 +                                       break;
368 +                               case 'movepageleft':
369 +                                       this.movePage("left");
370 +                                       break;
371 +                               case 'movepageright':
372 +                                       this.movePage("right");
373 +                                       break;                                  
374 +                               case 'toggleedit':
375 +                                       this.setupAppLauncher(event, "edit");
376 +                                       break;
377 +                               case 'toggleheader':
378 +                                       this.setupAppLauncher(event, "header");
379 +                                       break;
380 +                               case 'togglevisual':
381 +                                       this.setupAppLauncher(event, "visual");
382 +                                       break;
383 +                               case 'togglepage':
384 +                                       this.setupAppLauncher(event, "page");
385 +                                       break;
386 +                               case 'togglewrap':
387 +                                       this.setupAppLauncher(event, "wrap");
388 +                                       break;
389 +                               case 'togglereset':
390 +                                       this.setupAppLauncher(event, "reset");
391 +                                       break;
392 +                               case 'showpagemenu':
393 +                                       this.tabPageSelect(event);
394 +                                       break;
395 +                               case 'selectpage1':
396 +                                       this.tabPageSelect(event, 0);
397 +                                       break;
398 +                               case 'selectpage2':
399 +                                       this.tabPageSelect(event, 1);
400 +                                       break;
401 +                               case 'selectpage3':
402 +                                       this.tabPageSelect(event, 2);
403 +                                       break;
404 +                               case 'selectpage4':
405 +                                       this.tabPageSelect(event, 3);
406 +                                       break;
407 +                               case 'selectpage5':
408 +                                       this.tabPageSelect(event, 4);
409 +                                       break;
410                         }
411                 }
412 +               else if(event.type == Mojo.Event.forward) {
413 +                       if(!this.appLauncherCfg.header)
414 +                               this.controller.get('page_header').style.display = "block";
415 +       
416 +                       var chooseCallback = this.jumpToPage.bind(this);
417 +
418 +                       this.showPageMenus(false, "Jump to Page:", chooseCallback);
419 +               }                       
420                 else if (event.type === Mojo.Event.commandEnable) {
421                         switch (event.command) {
422                                 case Mojo.Menu.copyCmd:
423 @@ -157,11 +282,743 @@
424                         }
425                 }
426         },
427 +       
428 +       handlePreferences: function(payload) {
429 +               if(payload != undefined) {
430 +                       if(payload.appLauncherCfg != undefined)
431 +                               this.appLauncherCfg = payload.appLauncherCfg;
432 +                       
433 +                       if(payload.quickLaunchCfg != undefined)
434 +                               this.quickLaunchCfg = payload.quickLaunchCfg;
435 +               }
436 +               
437 +               this.updateAppLauncher(true);
438 +               this.updateQuickLaunch(true);
439 +               
440 +               this.getPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
441 +                       method: 'getPreferences', parameters: {subscribe: true, keys: ['appLauncherCfg']},
442 +                       onSuccess: this.handlePreferencesUpdate.bind(this) });
443 +       },
444 +
445 +       handlePreferencesUpdate: function(payload) {
446 +               var oldHidden = [];
447 +               
448 +               if((this.appLauncherCfg) && (this.appLauncherCfg.hidden))
449 +                       oldHidden = this.appLauncherCfg.hidden;
450 +       
451 +               if((payload != undefined) && (payload.appLauncherCfg != undefined))
452 +                       this.appLauncherCfg = payload.appLauncherCfg;
453 +               
454 +               for(var i = 0; i < oldHidden.length; i++) {
455 +                       if(this.appLauncherCfg.hidden.indexOf(oldHidden[i]) == -1) {
456 +                               var location = {page: 0, position: 0};
457 +                       
458 +                               for (var j=0, numPages=this.pagesModel.getNumPages(); j<numPages; j++) {
459 +                                       var page = this.pagesModel.getPage(j);
460 +               
461 +                                       location.page = j;
462 +                                       
463 +                                       for (var k=0; k<page.length; k++) {
464 +                                               var appInfo = this.pagesModel.getAppInfo(page[k]);
465 +
466 +                                               if(appInfo.launchPointId == oldHidden[i]) {
467 +                                                       location.position = k;
468 +                                                       this.insertApp(location, appInfo);
469 +                                               }
470 +                                       }
471 +                               }
472 +                       }
473 +               }
474 +       },
475 +       
476 +       setupAppLauncher: function(event, option) {
477 +               if(option == "edit") {
478 +                       var chooseCallback = this.selectPage.bind(this);
479 +               
480 +                       this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
481 +               }
482 +               else {
483 +                       if(option == "header") {
484 +                               if(this.appLauncherCfg.header)
485 +                                       this.appLauncherCfg.header = false;
486 +                               else
487 +                                       this.appLauncherCfg.header = true;
488 +                       }
489 +                       else if(option == "visual") {
490 +                               if(this.appLauncherCfg.visual == "tabs")
491 +                                       this.appLauncherCfg.visual = "name";
492 +                               else
493 +                                       this.appLauncherCfg.visual = "tabs";
494 +                       }
495 +                       else if(option == "page") {
496 +                               if(this.appLauncherCfg.page == "default")
497 +                                       this.appLauncherCfg.page = this.activePageIndex;
498 +                               else
499 +                                       this.appLauncherCfg.page = "default";
500 +                       }
501 +                       else if(option == "reset") {
502 +                               if(this.appLauncherCfg.reset)
503 +                                       this.appLauncherCfg.reset = false;
504 +                               else
505 +                                       this.appLauncherCfg.reset = true;
506 +                       }
507 +                       else if(option == "wrap") {
508 +                               if(this.appLauncherCfg.wrap)
509 +                                       this.appLauncherCfg.wrap = false;
510 +                               else
511 +                                       this.appLauncherCfg.wrap = true;
512 +                       }
513 +
514 +                       this.updateAppLauncher();
515 +               
516 +                       if(this.setPreferencesRequest)
517 +                               this.setPreferencesRequest.cancel();
518 +               
519 +                       this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
520 +                               method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
521 +               }
522 +       },
523 +       
524 +       setupQuickLaunch: function(mode) {
525 +               this.quickLaunchCfg.mode = mode;
526 +
527 +               this.updateQuickLaunch(false);
528 +               
529 +               if(this.setPreferencesRequest)
530 +                       this.setPreferencesRequest.cancel();
531 +                       
532 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
533 +                       method: 'setPreferences', parameters: {'quickLaunchCfg': this.quickLaunchCfg} });
534 +       },
535 +
536 +       updateAppLauncher: function(init) {
537 +               if(this.appLauncherCfg.header) {
538 +                       this.appMenuModel.items[1].items[1].label = "Hide Page Header";
539 +
540 +                       if(this.appLauncherCfg.visual == "tabs") {
541 +                               this.appMenuModel.items[1].items[2].label = "Use Name For Pages";
542 +
543 +                               this.controller.get('page_header').style.display = "none";
544 +                               this.controller.get('page_name').style.display = "none";
545 +
546 +                               this.viewMenuModel.visible = true;
547 +                       }
548 +                       else {
549 +                               this.appMenuModel.items[1].items[2].label = "Use Tabs For Pages";
550 +
551 +                               this.controller.get('page_header').style.display = "block";
552 +                               this.controller.get('page_name').style.display = "block";
553 +                       
554 +                               this.viewMenuModel.visible = false;
555 +                       }
556 +
557 +                       this.updatePageTabs();
558 +                       this.updatePageHeader();
559 +
560 +                       this.controller.modelChanged(this.viewMenuModel, this);
561 +               }
562 +               else {
563 +                       this.appMenuModel.items[1].items[1].label = "Show Page Header";
564 +
565 +                       this.controller.get('page_header').style.display = "none";
566 +                       this.controller.get('page_name').style.display = "none";
567 +                       
568 +                       this.viewMenuModel.visible = false;
569 +                       this.controller.modelChanged(this.viewMenuModel, this);
570 +               }
571 +
572 +               if(this.appLauncherCfg.page != "default")
573 +                       this.appMenuModel.items[1].items[3].label = "Unset Default Page";
574 +               else 
575 +                       this.appMenuModel.items[1].items[3].label = "Set As Default Page";
576 +
577 +               if(this.appLauncherCfg.reset)
578 +                       this.appMenuModel.items[1].items[4].label = "Disable Position Reset";
579 +               else 
580 +                       this.appMenuModel.items[1].items[4].label = "Enable Position Reset";
581 +
582 +               if(this.appLauncherCfg.wrap) {
583 +                       this.appMenuModel.items[1].items[5].label = "Disable Page Wrapping";
584 +                       
585 +                       Mojo.listen($('launcher_root'), Mojo.Event.scrollStarting, this.scrollStartingHandler);
586 +               }
587 +               else {
588 +                       this.appMenuModel.items[1].items[5].label = "Enable Page Wrapping";
589 +                       
590 +                       Mojo.stopListening($('launcher_root'), Mojo.Event.scrollStarting, this.scrollStartingHandler);
591 +               }
592 +
593 +               for(var i = 0; i < this.pageDivs.length; i++)
594 +                       this.updatePageLayout(i, 0);
595 +       },
596 +
597 +       updateQuickLaunch: function(init) {
598 +               this.appMenuModel.items[2].items[0].disabled = false;
599 +               this.appMenuModel.items[2].items[1].disabled = false;
600 +               this.appMenuModel.items[2].items[2].disabled = false;
601 +
602 +               if(this.quickLaunchCfg.mode == "visible") {
603 +                       this.appMenuModel.items[2].items[0].disabled = true;
604 +                       SystemManagerService.showQuickLaunch(true);
605 +                       this.kQuickLaunchHeight = 67;
606 +               }       
607 +               else if(this.quickLaunchCfg.mode == "hidden") {
608 +                       this.appMenuModel.items[2].items[1].disabled = true;
609 +                       SystemManagerService.showQuickLaunch(false);
610 +                       this.kQuickLaunchHeight = 0;
611 +               }       
612 +               else if(this.quickLaunchCfg.mode == "mixed") {
613 +                       this.appMenuModel.items[2].items[2].disabled = true;
614 +                       SystemManagerService.showQuickLaunch(init);
615 +                       this.kQuickLaunchHeight = 0;
616 +               }
617 +
618 +               this.adjustLayout();
619 +       },
620 +
621 +       updatePageHeader: function() {
622 +               if((this.appLauncherCfg.header) && (this.appLauncherCfg.visual != "tabs")) {
623 +                       var pageName = this.getPageName(this.activePageIndex);
624 +                       
625 +                       this.controller.get('page_name').update(pageName);
626 +
627 +                       this.controller.get('page_header').style.display = "block";
628 +                       this.controller.get('page_text').style.display = "none";
629 +                       this.controller.get('page_name').style.display = "block";
630 +               }
631 +       },
632 +       
633 +       updatePageTabs: function() {
634 +               if((this.appLauncherCfg.header) && (this.appLauncherCfg.visual == "tabs")) {
635 +                       this.viewMenuModel.visible = true;
636 +
637 +                       var tabs = [];
638 +                       var size = 325 / this.pageDivs.length;
639 +                       
640 +                       if(this.pageDivs.length > 5) {
641 +                               tabs.push({label: "#1", command: "selectpage1"});
642 +                               tabs.push({label: "#2", command: "selectpage2"});
643 +                               tabs.push({label: "Menu", command: "showpagemenu"});
644 +                               tabs.push({label: "#3", command: "selectpage3"});
645 +                               tabs.push({label: "#4", command: "selectpage4"});
646 +                       }
647 +                       else {
648 +                               for(var i = 0; i < this.pageDivs.length; i++) {
649 +                                       tabs.push({label: "#" + (i + 1), command: "selectpage" + (i + 1), width: size});
650 +                               }
651 +                       }
652 +               
653 +                       this.viewMenuModel.items.clear();
654 +                       this.viewMenuModel.items.push({items: []}, {items:¬†tabs}, {items: []});
655 +                       this.controller.modelChanged(this.viewMenuModel);
656 +               }
657 +       },
658 +       
659 +       tabPageSelect: function(event, index) {
660 +               if((event.originalEvent.up) && ( event.originalEvent.up.altKey || event.originalEvent.up.metaKey )) {
661 +                       if((this.pageDivs.length <= 5) || (index == undefined)) {               
662 +                               var chooseCallback = this.selectPage.bind(this);
663 +
664 +                               this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
665 +                       }
666 +                       else if(index + 4 < this.pageDivs.length) {
667 +                               this.changePage(index + 4, true);
668 +                       }       
669 +               }
670 +               else {
671 +                       var chooseCallback = this.jumpToPage.bind(this);
672 +               
673 +                       if(index == undefined)
674 +                               this.showPageMenus(false, null, chooseCallback);
675 +                       else
676 +                               this.changePage(index, true);
677 +               }
678 +       },
679                 
680 +       handleLauncherTap: function(event) {
681 +               if((event.up) && ( event.up.altKey || event.up.metaKey )) {
682 +                       if(!this.appLauncherCfg.header)
683 +                               this.controller.get('page_header').style.display = "block";
684 +       
685 +                       var chooseCallback = this.selectPage.bind(this);
686 +
687 +                       this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
688 +               }
689 +               else {
690 +                       if(event.count == 2) {
691 +                               if(!this.appLauncherCfg.header)
692 +                                       this.controller.get('page_header').style.display = "block";
693 +       
694 +                               var chooseCallback = this.jumpToPage.bind(this);
695 +
696 +                               this.showPageMenus(false, "Jump to Page:", chooseCallback);
697 +                       }
698 +               }
699 +       },
700 +       
701 +       handleHeaderTap: function(event) {
702 +               if((event.up) && ( event.up.altKey || event.up.metaKey )) {
703 +                       var chooseCallback = this.selectPage.bind(this);
704 +
705 +                       this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
706 +               }
707 +               else {
708 +                       var chooseCallback = this.jumpToPage.bind(this);
709 +
710 +                       this.showPageMenus(false, "Jump to Page:", chooseCallback);
711 +               }
712 +       },
713 +       
714 +       startAppRename: function(appInfo) {
715 +               Mojo.stopListening($('page_header'), Mojo.Event.tap, this.headerTapHandler);
716 +
717 +               Mojo.listen($('page_text'), Mojo.Event.propertyChange, this.appRenameHandler);
718 +               
719 +               if((this.appLauncherCfg.header) && (this.appLauncherCfg.visual == "tabs")) {
720 +                       this.viewMenuModel.visible = false;
721 +                       this.controller.modelChanged(this.viewMenuModel, this);
722 +               }
723 +
724 +               this.controller.get('page_header').style.display = "block";
725 +               this.controller.get('page_name').style.display = "none";
726 +               this.controller.get('page_text').style.display = "block";
727 +
728 +               if((this.appLauncherCfg.names) && (this.appLauncherCfg.names[appInfo.launchPointId] != undefined))
729 +                       this.pageNameModel.value = this.appLauncherCfg.names[appInfo.launchPointId];
730 +               else
731 +                       this.pageNameModel.value = appInfo.title;
732 +               
733 +               this.pageNameModel.id = appInfo.launchPointId;
734 +                       
735 +               this.controller.modelChanged(this.pageNameModel);                       
736 +                               
737 +               var curPos = this.pageNameModel.value.length;
738 +                       
739 +               this.controller.get('page_text').mojo.setCursorPosition(curPos, curPos);
740 +               this.controller.get('page_text').mojo.focus();
741 +       },
742 +       
743 +       startPageRename: function(refresh) {
744 +               this.globalSearchAssistant.enable(false);
745 +       
746 +               if((!refresh) && (this.renaming)) {
747 +                       this.handlePageRename();
748 +               }
749 +               else {  
750 +                       this.renaming = true;
751 +
752 +                       Mojo.listen($('page_text'), Mojo.Event.propertyChange, this.pageRenameHandler);
753 +
754 +                       if(!refresh) {
755 +                               this.commandMenuModel.items[1].label = "Done";
756 +                               this.controller.modelChanged(this.commandMenuModel);
757 +
758 +                               this.pageNameModel.value = this.getPageName(this.activePageIndex);
759 +                               this.controller.modelChanged(this.pageNameModel);
760 +                       }
761 +
762 +                       this.controller.get('page_name').style.display = "none";
763 +                       this.controller.get('page_text').style.display = "block";
764 +                       
765 +                       var curPos = this.pageNameModel.value.length;
766 +                       
767 +                       this.controller.get('page_text').mojo.setCursorPosition(curPos, curPos);
768 +                       this.controller.get('page_text').mojo.focus();
769 +               }
770 +       },
771 +       
772 +       handleAppRename: function(event) {
773 +               if((!event) || (Mojo.Char.isEnterKey(event.originalEvent.keyCode))) {
774 +                       Mojo.listen($('page_header'), Mojo.Event.tap, this.headerTapHandler);
775 +
776 +                       Mojo.stopListening($('page_text'), Mojo.Event.propertyChange, this.appRenameHandler);
777 +
778 +                       this.controller.get('page_header').style.display = "none";
779 +                       this.controller.get('page_text').style.display = "none";
780 +               
781 +                       if(this.appLauncherCfg.header) {
782 +                               if(this.appLauncherCfg.visual == "tabs") {
783 +                                       this.viewMenuModel.visible = true;
784 +                                       this.controller.modelChanged(this.viewMenuModel, this);
785 +                               }
786 +                               else {
787 +                                       this.controller.get('page_header').style.display = "block";
788 +                                       this.controller.get('page_name').style.display = "block";
789 +                               }
790 +                       }
791 +
792 +                       var element = $(this.pageNameModel.id);
793 +
794 +                       if (element) {
795 +                               if(!this.appLauncherCfg.names) 
796 +                                       this.appLauncherCfg.names = {};
797 +                       
798 +                               this.appLauncherCfg.names[this.pageNameModel.id] = this.pageNameModel.value.escapeHTML();
799 +
800 +                               var elm = element.down('.name');
801 +                               
802 +                               elm.innerHTML = this.pageNameModel.value;
803 +                       }
804 +
805 +                       this.globalSearchAssistant.enable(true);
806 +
807 +                       if(this.setPreferencesRequest)
808 +                               this.setPreferencesRequest.cancel();
809 +               
810 +                       this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
811 +                               method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
812 +               }       
813 +       },
814 +       
815 +       handlePageRename: function(event) {
816 +               if((!event) || (Mojo.Char.isEnterKey(event.originalEvent.keyCode))) {
817 +                       this.renaming = false;
818 +
819 +                       Mojo.stopListening($('page_text'), Mojo.Event.propertyChange, this.pageRenameHandler);
820 +
821 +                       this.setPageName(this.activePageIndex, this.pageNameModel.value);
822 +
823 +                       this.controller.get('page_name').style.display = "block";
824 +                       this.controller.get('page_text').style.display = "none";
825 +
826 +                       this.selectPage(this.activePageIndex);
827 +
828 +                       this.commandMenuModel.items[1].label = "Rename";
829 +                       this.controller.modelChanged(this.commandMenuModel);
830 +
831 +                       if(this.setPreferencesRequest)
832 +                               this.setPreferencesRequest.cancel();
833 +       
834 +                       this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
835 +                               method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
836 +               }
837 +       },
838 +
839 +       selectPage: function(index) {
840 +               if((index == undefined) && (!this.renaming))
841 +                       this.hidePageMenus();
842 +               else {
843 +                       if(index != undefined) {
844 +                               if(this.renaming)
845 +                                       this.handlePageRename();
846 +
847 +                               this.changePage(index, true);
848 +
849 +                               var chooseCallback = this.selectPage.bind(this);
850 +                       
851 +                               this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
852 +                       }
853 +                       else
854 +                               setTimeout(this.hideSymbolMenu.bind(this), 5);
855 +               }
856 +       },
857 +
858 +       hideSymbolMenu: function() {
859 +               var chooseCallback = this.selectPage.bind(this);
860 +               
861 +               this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
862 +
863 +               if(this.renaming)
864 +                       this.startPageRename(true);
865 +       },
866 +
867 +       jumpToPage: function(index) {
868 +               if(index == undefined) {
869 +                       this.hidePageMenus();
870 +               }
871 +               else {
872 +                       this.changePage(index, true);
873 +                       
874 +                       this.hidePageMenus();           
875 +               }
876 +       },
877 +       
878 +       movePage: function(direction) {
879 +               if(direction == "left") {
880 +                       var newIndex = parseInt(this.activePageIndex) - 1;
881 +                       
882 +                       if(newIndex < 0)
883 +                               return;
884 +               }
885 +               else if(direction == "right") {
886 +                       var newIndex = parseInt(this.activePageIndex) + 1;
887 +
888 +                       if(newIndex == this.pageDivs.length)
889 +                               return;
890 +               }
891 +       
892 +               if(this.appLauncherCfg.page != "default") {
893 +                       if(this.appLauncherCfg.page == this.activePageIndex)
894 +                               this.appLauncherCfg.page = newIndex;                    
895 +               }
896 +               
897 +               var oldIndex = parseInt(this.activePageIndex);
898 +
899 +               var tmp = this.appLauncherCfg.pages.splice(oldIndex,1);
900 +
901 +               this.appLauncherCfg.pages.splice(newIndex,0,tmp[0]);
902 +
903 +               this.pagesModel.switchPages(oldIndex, newIndex);
904 +
905 +               this.pagesModel.save();
906 +                                               
907 +               var apps1 = this.getAppContainer(oldIndex).select('.app');
908 +               var apps2 = this.getAppContainer(newIndex).select('.app');
909 +
910 +               var container1 = this.getAppContainer(oldIndex);
911 +               var container2 = this.getAppContainer(newIndex);
912 +
913 +               apps1.each(function(app) {
914 +                       container1.removeChild(app);
915 +                       container2.appendChild(app);
916 +               }.bind(this));
917 +
918 +               apps2.each(function(app) {
919 +                       container2.removeChild(app);
920 +                       container1.appendChild(app);
921 +               }.bind(this));
922 +
923 +               if (apps1.length > 0)
924 +                       this.updatePageLayout(oldIndex, apps1.length);
925 +
926 +               if (apps2.length > 0)
927 +                       this.updatePageLayout(newIndex, apps2.length);
928 +
929 +               this.selectPage(newIndex);
930 +               
931 +               if(this.setPreferencesRequest)
932 +                       this.setPreferencesRequest.cancel();
933 +               
934 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
935 +                       method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
936 +       },
937 +       
938 +       movePageApp: function(appInfo, index) {
939 +               if(index == undefined) {
940 +                       this.hidePageMenus();
941 +                       return;
942 +               }
943 +
944 +               if(this.pageDivs[index] != undefined) {
945 +                       var from = this.pagesModel.findApplication(appInfo.launchPointId);
946 +                       var to = {page: parseInt(index), position: -1};
947 +
948 +                       this.moveApp(appInfo.launchPointId, to);
949 +                       this.pagesModel.moveApplication(from, to);
950 +
951 +                       this.pagesModel.save();
952 +               }
953 +
954 +               this.hidePageMenus();
955 +       },
956 +
957 +       changePage: function(index, animate) {
958 +               if(this.appLauncherCfg.reset) {
959 +                       var scroller = this.getPageScroller(this.activePageIndex);
960 +                       
961 +                       if (scroller && scroller.mojo) { scroller.mojo.revealTop(); }
962 +               }
963 +               
964 +               if(this.activePageIndex != index) {
965 +                       this.activePageIndex = index;
966 +                       
967 +                       if(this.appLauncherCfg.wrap)
968 +                               $('launcher_root').mojo.scrollTo((index) * -this.kPageWidth, undefined, false, true);
969 +                       else {
970 +                               $('launcher_root').mojo.setSnapIndex(parseInt(index), animate);
971 +                       }
972 +               }
973 +       },
974 +
975 +       showPageMenus: function(viewMenu, menuTitle, chooseCallback) {
976 +               Mojo.stopListening($('launcher_root'), Mojo.Event.propertyChange, this.pageChangeHandler);
977 +
978 +               if(menuTitle)
979 +                       Mojo.stopListening($('page_header'), Mojo.Event.tap, this.headerTapHandler);
980 +                                       
981 +               this.globalSearchAssistant.enable(false);
982 +
983 +               var pageItems = [];
984 +
985 +               for(var i = 0; i < this.pageDivs.length; i++) {
986 +                       var pageName = this.getPageName(i);
987 +                       
988 +                       pageItems.push({command: i, label: pageName, chosen: (i == this.activePageIndex)});
989 +               }
990 +
991 +               if(viewMenu)
992 +                       var menuClass = "pageMenu";
993 +               else
994 +                       var menuClass = "jumpMenu";
995 +
996 +               this.controller.popupSubmenu({
997 +                       popupClass: menuClass,
998 +                       scrimClass: "pageMenuScrim",
999 +                       manualPlacement: true,
1000 +
1001 +                       items: pageItems,
1002 +
1003 +                       onChoose: chooseCallback
1004 +               });
1005 +
1006 +               if(menuTitle) {
1007 +                       if((this.appLauncherCfg.header) && (this.appLauncherCfg.visual == "tabs")) {
1008 +                               this.viewMenuModel.visible = false;
1009 +                               this.controller.modelChanged(this.viewMenuModel, this);
1010 +                       }
1011 +               
1012 +                       if((viewMenu) || (this.appLauncherCfg.header)) {
1013 +                               this.controller.get('page_header').style.display = "block";
1014 +                       }
1015 +
1016 +                       this.controller.get('page_text').style.display = "none";
1017 +                       this.controller.get('page_name').style.display = "block";
1018 +
1019 +                       this.controller.get('page_name').update(menuTitle);
1020 +               }
1021 +               
1022 +               if(this.quickLaunchCfg.mode == "visible") {
1023 +                       SystemManagerService.showQuickLaunch(false);
1024 +                       this.kQuickLaunchHeight = 0;
1025 +                       this.adjustLayout();
1026 +               }
1027 +
1028 +               if(viewMenu) {
1029 +                       this.commandMenuModel.visible = true;
1030 +                       this.controller.modelChanged(this.commandMenuModel);
1031 +               }
1032 +       },
1033 +       
1034 +       hidePageMenus: function() {
1035 +               Mojo.listen($('page_header'), Mojo.Event.tap, this.headerTapHandler);
1036 +
1037 +               Mojo.listen($('launcher_root'), Mojo.Event.propertyChange, this.pageChangeHandler);
1038 +
1039 +               this.globalSearchAssistant.enable(true);
1040 +
1041 +               this.controller.get('page_header').style.display = "none";
1042 +               this.controller.get('page_name').style.display = "none";
1043 +
1044 +               this.updatePageHeader();
1045 +               this.updatePageTabs();
1046 +
1047 +               this.updatePageIndicators();
1048 +               
1049 +               this.commandMenuModel.visible = false;
1050 +               this.controller.modelChanged(this.commandMenuModel);
1051 +               
1052 +               if(this.quickLaunchCfg.mode == "visible") {
1053 +                       SystemManagerService.showQuickLaunch(true);
1054 +                       this.kQuickLaunchHeight = 67;
1055 +                       this.adjustLayout();
1056 +               }
1057 +       },
1058 +
1059 +       getPageName: function(index) {
1060 +               if(this.appLauncherCfg.pages[parseInt(index)] == undefined)
1061 +                       this.appLauncherCfg.pages[parseInt(index)] = "Launcher Page " + (parseInt(index) + 1);
1062 +
1063 +               return this.appLauncherCfg.pages[parseInt(index)];
1064 +       },
1065 +
1066 +       setPageName: function(index, pageName) {
1067 +               if((pageName.length > 0) &&¬†(pageName.split(' ').join('').length > 0))
1068 +                       this.appLauncherCfg.pages[parseInt(index)] = this.pageNameModel.value;
1069 +               else
1070 +                       this.appLauncherCfg.pages[parseInt(index)] = "Launcher Page " + (parseInt(index) + 1);
1071 +       },
1072 +
1073 +       confirmDelete: function() {
1074 +               var apps = this.getAppContainer(this.activePageIndex).select('.app');
1075 +       
1076 +               if(apps.length == 0)
1077 +                       this.deletePage(this.activePageIndex);
1078 +               else {
1079 +                       this.controller.showAlertDialog({
1080 +                               title: "Delete Launcher Page",
1081 +                               message: "Are you sure that you want to delete the current launcher page?",
1082 +                               choices:[
1083 +                                       {label:'Delete', value:"delete", type:'negative'},
1084 +                                       {label:'Cancel', value:"cancel", type:'default'}],
1085 +                               preventCancel: false,
1086 +                               allowHTMLMessage: false,
1087 +                               onChoose: function(value) {
1088 +                                       if(value == "delete")
1089 +                                       this.deletePage(this.activePageIndex);
1090 +
1091 +                                       var chooseCallback = this.selectPage.bind(this);
1092 +
1093 +                                       this.showPageMenus(true, "Edit Launcher Page:", chooseCallback);
1094 +                               }.bind(this)});
1095 +
1096 +                       SystemManagerService.showQuickLaunch(false);
1097 +               }
1098 +       },
1099 +
1100 +       scrollStarting: function(event) {
1101 +               event.scroller.addListener(this);
1102 +       },
1103 +       
1104 +       moved: function(scrollEnded, position) {
1105 +               if(scrollEnded) {
1106 +                       this.pagingAnimating = false;
1107 +               }
1108 +               else {
1109 +                       this.pagingAnimating = true;
1110 +                       
1111 +                       if(this.appLauncherCfg.reset) {
1112 +                               var scroller = this.getPageScroller(this.activePageIndex);
1113 +
1114 +                               if(scroller && scroller.mojo) { scroller.mojo.revealTop(); }
1115 +                       }
1116 +
1117 +                       if(Math.abs(position.x) > ((this.pageDivs.length - 1) * this.kPageWidth))
1118 +                               $('launcher_root').mojo.scrollTo(0, undefined, false, true);
1119 +                       else if(position.x > 0 )
1120 +                               $('launcher_root').mojo.scrollTo((this.pageDivs.length - 1) * -this.kPageWidth , undefined, false, true);
1121 +                       else if( this.activePageIndex * -this.kPageWidth > position.x )
1122 +                               $('launcher_root').mojo.scrollTo( (this.activePageIndex + 1) * -this.kPageWidth, undefined, false, true);
1123 +                       else if( this.activePageIndex * -this.kPageWidth < position.x )
1124 +                               $('launcher_root').mojo.scrollTo( (this.activePageIndex - 1) * -this.kPageWidth, undefined, false, true);
1125 +               }
1126 +               
1127 +               this.activePageIndex = Math.abs($('launcher_root').mojo.getScrollPosition().left) / this.kPageWidth;
1128 +                       
1129 +               this.updatePageHeader();
1130 +               this.updatePageIndicators();
1131 +       },      
1132 +
1133         /* keep track of which page we are on */
1134         onPageChange: function(event) {
1135 -               this.activePageIndex = event.value;
1136 -               this.updatePageIndicators();
1137 +               if(this.appLauncherCfg.reset) {
1138 +                       var scroller = this.getPageScroller(this.activePageIndex);
1139 +
1140 +                       if (scroller && scroller.mojo) { scroller.mojo.revealTop(); }
1141 +               }
1142 +
1143 +               if((!this.appLauncherCfg.wrap) || (this.reorderController.reordering)) {
1144 +                       this.activePageIndex = event.value;
1145 +                                       
1146 +                       this.updatePageHeader();
1147 +                       this.updatePageIndicators();
1148 +               }
1149 +       },
1150 +
1151 +       /* hide quick launch */
1152 +       onActivate: function(event) {
1153 +
1154 +               if(this.appLauncherCfg.page != "default") {
1155 +                       this.changePage(this.appLauncherCfg.page, false);
1156 +
1157 +                       this.updatePageHeader();
1158 +                       this.updatePageIndicators();
1159 +               }
1160 +               
1161 +               if(this.quickLaunchCfg.mode != "visible") {
1162 +                       SystemManagerService.showQuickLaunch(false);
1163 +                       this.kQuickLaunchHeight = 0;
1164 +                       this.adjustLayout();
1165 +               }
1166         },
1167         
1168         /* clean and hide global search */
1169 @@ -174,8 +1031,19 @@
1170                 if (this.appDialog) {
1171                         this.appDialog.mojo.close();
1172                 }
1173 +
1174 +               if(this.appLauncherCfg.page != "default") {
1175 +                       this.changePage(this.appLauncherCfg.page, false);
1176 +
1177 +                       this.updatePageHeader();
1178 +                       this.updatePageIndicators();
1179 +               }
1180                 
1181 -               SystemManagerService.showQuickLaunch(true);
1182 +               if(this.quickLaunchCfg.mode != "hidden") {
1183 +                       SystemManagerService.showQuickLaunch(true);
1184 +                       this.kQuickLaunchHeight = 67;
1185 +                       this.adjustLayout();
1186 +               }
1187                 
1188                 this.launchRequest = undefined;
1189         },
1190 @@ -202,12 +1070,12 @@
1191         
1192         /* helper to consolidate all the places accessing these types of elements */
1193         getAppContainer: function(pageIndex) {
1194 -               Mojo.assert(this.pageDivs.length > pageIndex, "Attempting to access invalid page #{page}", {page: pageIndex});
1195 +               Mojo.assert(this.pageDivs.length >= pageIndex, "Attempting to access invalid page #{page}", {page: pageIndex});
1196                 return this.pageDivs[pageIndex].down('.page_scroller_container');
1197         },
1198         
1199         getPageScroller: function(pageIndex) {
1200 -               Mojo.assert(this.pageDivs.length > pageIndex, "Attempting to access invalid page #{page}", {page: pageIndex});
1201 +               Mojo.assert(this.pageDivs.length >= pageIndex, "Attempting to access invalid page #{page}", {page: pageIndex});
1202                 return this.pageDivs[pageIndex].down('.page_scroller');
1203         },
1204         
1205 @@ -255,15 +1123,59 @@
1206                 
1207                 // tell our scroller widget that it has a new page element to snap
1208                 this.updatePageSnappingPoints();
1209 +
1210 +               if(createPage) {
1211 +                       this.appLauncherCfg.pages.splice(newPageIndex, 0, "Launcher Page " + (parseInt(newPageIndex) + 1));
1212 +
1213 +                       this.changePage(newPageIndex, true);
1214 +                       
1215 +                       var chooseCallback = this.selectPage.bind(this);
1216 +
1217 +                       this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
1218 +                       
1219 +                       if(this.setPreferencesRequest)
1220 +                               this.setPreferencesRequest.cancel();
1221 +               
1222 +                       this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1223 +                               method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
1224 +               }
1225         },
1226         
1227         deletePage: function(pageIndex) {
1228 +
1229                 // move all apps still on page[pageIndex] to the previous/next page  
1230                 var moveIndex = (pageIndex == 0 ? 1 : pageIndex-1);
1231                 if (!this.pagesModel.removePage(pageIndex, moveIndex)) {
1232                         return false;
1233                 }
1234                 
1235 +               // Weird problem in changePage / setsnapindex, no page change when index 0
1236 +
1237 +               if(this.pageDivs.length == 2) {
1238 +                       this.activePageIndex = 0;
1239 +                       $('launcher_root').mojo.scrollTo(0, undefined, true, false);
1240 +               }
1241 +               else {
1242 +                       // snap to a valid location
1243 +                       if(pageIndex >= this.pageDivs.length - 1)
1244 +                               this.changePage(this.pageDivs.length - 2, true);
1245 +                       else
1246 +                               this.changePage(pageIndex, true);
1247 +               }
1248 +               
1249 +               if(this.appLauncherCfg.page != "default") {
1250 +                       if(this.appLauncherCfg.page == pageIndex)
1251 +                               this.setupAppLauncher(null, "page");
1252 +               }
1253 +
1254 +               this.appLauncherCfg.pages.splice(pageIndex,1);
1255 +
1256 +               if(this.setPreferencesRequest)
1257 +                       this.setPreferencesRequest.cancel();
1258 +               
1259 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1260 +                       method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
1261 +
1262                 // move appDivs over to their new home
1263                 var apps = this.getAppContainer(pageIndex).select('.app');
1264                 var startIndex = apps.length;
1265 @@ -284,7 +1196,7 @@
1266                 if (scroller) {
1267                         this.controller.setupWidget(scroller.id, undefined, undefined);
1268                 }
1269 -               
1270 +                               
1271                 // remove the page div
1272                 this.pageDivs[pageIndex].remove();
1273                 this.pageDivs = $$('.launcher_page');
1274 @@ -294,17 +1206,13 @@
1275                 for (var i=pageIndex; i<this.pageDivs.length; i++) {
1276                         this.pageDivs[i].style.left = (this.kPageWidth*i)+'px';
1277                 }
1278 -               
1279 +
1280                 // remove the pages indicator
1281                 this.deletePageIndicator();
1282                 
1283 -               // snap to a valid location
1284 -               if (pageIndex >= this.pageDivs.length) {
1285 -                       $('launcher_root').mojo.setSnapIndex(this.pageDivs.length-1, true);
1286 -               }
1287 -               else {
1288 -                       $('launcher_root').mojo.setSnapIndex(pageIndex, true);
1289 -               }
1290 +               var chooseCallback = this.selectPage.bind(this);
1291 +
1292 +               this.showPageMenus(true, "Edit Launcher Pages:", chooseCallback);
1293                 
1294                 this.updatePageSnappingPoints();
1295         },
1296 @@ -348,6 +1256,15 @@
1297                         // stash the application's data in the element
1298                         newAppDiv._info = newAppInfo;
1299  
1300 +                       // set the application name if renamed
1301 +                       elm = newAppDiv.down('.name');
1302 +
1303 +                       if((elm) && (this.appLauncherCfg.names) && 
1304 +                               (this.appLauncherCfg.names[newAppInfo.launchPointId] != undefined))
1305 +                       {
1306 +                               elm.innerHTML = this.appLauncherCfg.names[newAppInfo.launchPointId];
1307 +                       }                       
1308 +
1309                         this._updateBadge(newAppDiv, newAppInfo);
1310                 
1311                         /* adjust page position and height */
1312 @@ -435,21 +1352,27 @@
1313                 if (elm) {
1314                         var newTitle = "";
1315                         if (newAppInfo.update && newAppInfo.update.title) {
1316 -                               newTitle = newAppInfo.update.title.escapeHTML();
1317 +                               if((this.appLauncherCfg.names) && (this.appLauncherCfg.names[newAppInfo.update.launchPointId] != undefined))
1318 +                                       newTitle = this.appLauncherCfg.names[newAppInfo.update.launchPointId];
1319 +                               else
1320 +                                       newTitle = newAppInfo.update.title.escapeHTML();
1321                                 if (newTitle !== elm.innerHTML) {
1322                                         Mojo.Log.info("Updating title of app div, old: %d | new: %d", elm.innerHTML, newTitle);
1323                                         elm.innerHTML = newTitle;
1324                                 }
1325                         }
1326                         else if (newAppInfo.title) {
1327 -                               newTitle = newAppInfo.title.escapeHTML();
1328 +                               if((this.appLauncherCfg.names) && (this.appLauncherCfg.names[newAppInfo.launchPointId] != undefined))
1329 +                                       newTitle = this.appLauncherCfg.names[newAppInfo.launchPointId]; 
1330 +                               else            
1331 +                                       newTitle = newAppInfo.title.escapeHTML();
1332                                 if (elm.innerHTML !== newTitle) {
1333                                         Mojo.Log.info("Updating title of app div, old: %d | new: %d", elm.innerHTML, newTitle);
1334                                         elm.innerHTML = newTitle;
1335                                 }
1336                         }
1337                 }
1338 -
1339 +               
1340                 this._updateBadge(element, newAppInfo);
1341         },
1342  
1343 @@ -514,6 +1437,10 @@
1344                 for (var i=offset, len = children.length; i<len; i++) {
1345                         var item = children[i];
1346                         var appPos = this.calculateAppPosition(i);
1347 +                       
1348 +                       if(this.appLauncherCfg.header)
1349 +                               appPos.top = appPos.top + 50;
1350 +                       
1351                         if (animate) {
1352                                 LauncherAnimation.animateApp(item, appPos);
1353                         } else {
1354 @@ -577,17 +1504,54 @@
1355                                 return;
1356                         }
1357                 }
1358 +
1359 +               if(this.quickLaunchCfg.mode == "visible") {
1360 +                       SystemManagerService.showQuickLaunch(false);
1361 +                       this.kQuickLaunchHeight = 0;
1362 +                       this.adjustLayout();
1363 +               }
1364                 
1365 -               SystemManagerService.showQuickLaunch(false);
1366                 this.globalSearchAssistant.enable(false);
1367                 
1368                 var appInfoAssistant = new AppInfoAssistant(appInfo,
1369                                                                                                         this.controller,
1370 -                                                                                                       function() {
1371 +                                                                                                       function(appInfo, action) {
1372                                                                                                                 this.appDialog = undefined;
1373 -                                                                                                               SystemManagerService.showQuickLaunch(true);
1374 -                                                                                                               this.globalSearchAssistant.enable(true);
1375 -                                                                                                       }.bind(this));
1376 +                                                                                                               if(this.quickLaunchCfg.mode == "visible") {
1377 +                                                                                                                       SystemManagerService.showQuickLaunch(true);
1378 +                                                                                                                       this.kQuickLaunchHeight = 67;
1379 +                                                                                                                       this.adjustLayout();
1380 +                                                                                                               }
1381 +                                                                                                               if(action == "move") { 
1382 +                                                                                                                       if(!this.appLauncherCfg.header)
1383 +                                                                                                                               this.controller.get('page_header').style.display = "block";
1384 +                                                                                                                       
1385 +                                                                                                                       var chooseCallback = this.movePageApp.bind(this, appInfo);
1386 +                                                                                                                       
1387 +                                                                                                                       this.showPageMenus(false, "Move Application:", chooseCallback);
1388 +                                                                                                               }
1389 +                                                                                                               else if(action == "hide") {
1390 +                                                                                                                       if(!this.appLauncherCfg.hidden)
1391 +                                                                                                                               this.appLauncherCfg.hidden = [];
1392 +                                                                                                                               
1393 +                                                                                                                       this.appLauncherCfg.hidden.push(appInfo.launchPointId);
1394 +                                                                                                                       
1395 +                                                                                                                       this.globalSearchAssistant.enable(true);
1396 +                                                                                                                       
1397 +                                                                                                                       this.deleteApp(appInfo.launchPointId, true);
1398 +                                                                                                                       
1399 +                                                                                                                       if(this.setPreferencesRequest)
1400 +                                                                                                                               this.setPreferencesRequest.cancel();
1401 +
1402 +                                                                                                                       this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1403 +                                                                                                                               method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
1404 +                                                                                                               }
1405 +                                                                                                               else if(action == "rename") {
1406 +                                                                                                                       this.startAppRename(appInfo);
1407 +                                                                                                               }
1408 +                                                                                                               else
1409 +                                                                                                                       this.globalSearchAssistant.enable(true);
1410 +                                                                                                       }.bind(this, appInfo));
1411  
1412                 this.appDialog = this.controller.showDialog({
1413                                                         template: 'launcher/dialogs/app-info',
1414 @@ -601,23 +1565,54 @@
1415                 this.globalSearchAssistant.enable(false);
1416                 
1417                 this.deleteAllPages();
1418 -               
1419 +
1420 +               var allApps = [];
1421 +                                       
1422                 var location = {page: 0, position: 0};
1423                 for (var i=0, numPages=this.pagesModel.getNumPages(); i<numPages; i++) {
1424                         // create a new page
1425                         this.insertPage(i);
1426 +
1427 +                       var skip = 0;
1428                         
1429                         // insert all the applications for this page into the page container
1430                         var page = this.pagesModel.getPage(i);
1431                         location.page = i;
1432                         for (var j=0; j<page.length; j++) {
1433 -                               location.position = j;
1434 -                               this.insertApp(location, this.pagesModel.getAppInfo(page[j]));
1435 +                               var appInfo = this.pagesModel.getAppInfo(page[j]);
1436 +                       
1437 +                               allApps.push(appInfo.launchPointId);
1438 +                       
1439 +                               if(this.appLauncherCfg.hidden) {
1440 +                                       if(this.appLauncherCfg.hidden.indexOf(appInfo.launchPointId) != -1) {
1441 +                                               skip++;
1442 +                                               continue;
1443 +                                       }
1444 +                               }
1445 +                       
1446 +                               location.position = j - skip;
1447 +                               this.insertApp(location, appInfo);
1448 +                       }
1449 +               }
1450 +
1451 +               if(this.appLauncherCfg.names) {
1452 +                       for(var key in this.appLauncherCfg.names) {
1453 +                               if(allApps.indexOf(key) == -1)
1454 +                                       delete this.appLauncherCfg.names[key];
1455                         }
1456                 }
1457                 
1458 +               if(this.setPreferencesRequest)
1459 +                       this.setPreferencesRequest.cancel();
1460 +       
1461 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1462 +                       method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });
1463 +               
1464                 this.globalSearchAssistant.enable(true);
1465  
1466 +               if((this.appLauncherCfg.header) && (this.appLauncherCfg.visual == "tabs"))
1467 +                       this.updatePageTabs();
1468 +
1469                 PalmSystem.launcherReady();
1470         },
1471         
1472 @@ -720,7 +1715,7 @@
1473         onAppTapped: function(event) {
1474                 var target = event.currentTarget;
1475                 var appInfo = target._info;
1476 -               if (event.up && event.up.altKey) {
1477 +               if (event.up && event.up.altKey || event.up && event.up.metaKey) {
1478                         // open app-info dialog
1479                         this.showAppInfoMenu(appInfo);
1480                 } else if (!this.launchRequest) { // are we already trying to launch something?
1481 --- .orig/usr/lib/luna/system/luna-applauncher/app/views/launcher/launcher-scene.html
1482 +++ /usr/lib/luna/system/luna-applauncher/app/views/launcher/launcher-scene.html
1483 @@ -17,7 +17,11 @@
1484                 <div class="palm-header-spacer strut"></div>\r
1485         </div>\r
1486         \r
1487 -       <div id="launcher-main">\r
1488 +       <div id="launcher-main">
1489 +               <div id="page_header" style="display: none;" class="palm-header center" x-mojo-touch-feedback="immediate">
1490 +                       <div id="page_name" style="display: block;">Launcher Page</div>
1491 +                       <div id="page_text" style="display: none;" x-mojo-element="TextField"></div>
1492 +               </div>
1493                 <div id="launcher_root" x-mojo-element="Scroller">\r
1494                         <div id="pages_container"></div>\r
1495                 </div>\r
1496 --- .orig/usr/lib/luna/system/luna-applauncher/app/controllers/app-info-assistant.js
1497 +++ /usr/lib/luna/system/luna-applauncher/app/controllers/app-info-assistant.js
1498 @@ -7,7 +7,12 @@
1499                 this.isDynamic = this.isDynamicLaunchPoint(this.appInfo);
1500                 this.closeCallback = closeCallback;
1501  
1502 -               this.onDone = this.onDone.bind(this);
1503 +               this.action = "";
1504 +
1505 +               this.onRename = this.onDone.bind(this, "rename");
1506 +               this.onHide = this.onDone.bind(this, "hide");
1507 +               this.onMove = this.onDone.bind(this, "move");
1508 +               this.onDone = this.onDone.bind(this, "done");
1509         },
1510         
1511         setup: function(widget) {
1512 @@ -86,7 +91,9 @@
1513         
1514         setupButtons: function() {
1515                 
1516 -               var doneModel = {buttonLabel: $L('Done')}
1517 +               var renameModel = {buttonLabel: $L('Rename')}
1518 +               var hideModel = {buttonLabel: $L('Hide')}
1519 +               var moveModel = {buttonLabel: $L('Move')}               
1520                 
1521                 if (this.appInfo.removable) {
1522                         
1523 @@ -97,19 +104,33 @@
1524                                 disabled: false
1525                         };
1526                         
1527 +                       if(this.isDynamic) 
1528 +                               this.sceneController.get('hide-btn').hide();
1529 +                       
1530                         this.sceneController.setupWidget('delete-btn', {type: Mojo.Widget.activityButton}, this.deleteModel);
1531                         this.sceneController.listen('delete-btn', Mojo.Event.tap, this.onDelete.bindAsEventListener(this));
1532                         this.sceneController.get('delete-btn').show();
1533 -                       
1534 -                       // done button
1535 -                       doneModel.buttonClass = 'dismiss';
1536 -                       
1537 +
1538 +                       // rename button
1539 +                       renameModel.buttonClass = 'dismiss';
1540 +
1541 +                       // hide button
1542 +                       hideModel.buttonClass = 'dismiss';
1543 +
1544 +                       // mode button
1545 +                       moveModel.buttonClass = 'dismiss';
1546                 } else {
1547                         this.sceneController.get('delete-btn').hide();
1548                 }
1549 +
1550 +               this.sceneController.setupWidget('rename-btn', undefined, renameModel);
1551 +               this.sceneController.listen('rename-btn', Mojo.Event.tap, this.onRename);
1552 +
1553 +               this.sceneController.setupWidget('hide-btn', undefined, hideModel);
1554 +               this.sceneController.listen('hide-btn', Mojo.Event.tap, this.onHide);
1555                 
1556 -               this.sceneController.setupWidget('done-btn', undefined, doneModel);
1557 -               this.sceneController.listen('done-btn', Mojo.Event.tap, this.onDone);
1558 +               this.sceneController.setupWidget('move-btn', undefined, moveModel);
1559 +               this.sceneController.listen('move-btn', Mojo.Event.tap, this.onMove);
1560         },
1561  
1562         isDynamicLaunchPoint: function(appInfo) {
1563 @@ -136,7 +157,9 @@
1564                 }
1565         },
1566  
1567 -       onDone: function() {
1568 +       onDone: function(action) {
1569 +               this.action = action;
1570 +               
1571                 var deleteBtn = this.sceneController.get('delete-btn');
1572                 if (deleteBtn && deleteBtn.mojo && deleteBtn.mojo.deactivate) {
1573                         deleteBtn.mojo.deactivate();
1574 @@ -163,6 +186,6 @@
1575                         this.appSizeRequest.cancel();
1576                         this.appSizeRequest = undefined;
1577                 }
1578 -               this.closeCallback();
1579 +               this.closeCallback(this.action);
1580         }
1581  });
1582 --- .orig/usr/lib/luna/system/luna-applauncher/app/views/launcher/dialogs/app-info.html
1583 +++ /usr/lib/luna/system/luna-applauncher/app/views/launcher/dialogs/app-info.html
1584 @@ -9,5 +9,7 @@
1585  <div class="palm-dialog-separator"></div>
1586  <div class="palm-dialog-buttons">
1587         <div id='delete-btn' x-mojo-element="Button"></div>     
1588 -       <div id='done-btn' x-mojo-element="Button"></div>
1589 +       <div id='rename-btn' x-mojo-element="Button"></div>
1590 +       <div id='hide-btn' x-mojo-element="Button"></div>
1591 +       <div id='move-btn' x-mojo-element="Button"></div>
1592  </div>
1593 --- .orig/usr/lib/luna/system/luna-applauncher/app/models/launcher-pages.js
1594 +++ /usr/lib/luna/system/luna-applauncher/app/models/launcher-pages.js
1595 @@ -4,7 +4,7 @@
1596  var LauncherPages = Class.create({
1597         kDepotOptions: {version: 1, name: 'paged_launcher_apps'},
1598         kDepotDataKey: "Pages",
1599 -       kMaxPages: 10,
1600 +       kMaxPages: 16,
1601         
1602         initialize: function(callbacks) {
1603                 
1604 @@ -240,6 +240,12 @@
1605                 return true;
1606         },
1607         
1608 +       switchPages: function(firstIndex, secondIndex) {
1609 +               var page = this._storedPages.splice(firstIndex, 1);
1610 +
1611 +               this._storedPages.splice(secondIndex, 0, page[0]);
1612 +       },
1613 +       
1614         getNumPages: function() {
1615                 return this._storedPages.length;
1616         },
1617 --- .orig/usr/lib/luna/system/luna-applauncher/stylesheets/launcher.css
1618 +++ /usr/lib/luna/system/luna-applauncher/stylesheets/launcher.css
1619 @@ -342,3 +342,87 @@
1620         text-overflow: ellipsis;
1621         white-space: nowrap;
1622  }
1623 +
1624 +/* page names element */
1625 +
1626 +#page_text {
1627 +       min-width: 100%;
1628 +       width: 100%;
1629 +}
1630 +                                                                                                               
1631 +#page_text input {
1632 +       min-width: 100%;
1633 +       font-weight: bold;
1634 +       height: 46px;
1635 +       outline: none;
1636 +       background: none;
1637 +       border-width: 0 0 0 0;
1638 +       font-size: 16px;
1639 +       line-height: 22px;
1640 +       color: white;
1641 +       margin: 0 16px 0 0px;
1642 +       padding: 0;
1643 +       text-align: center;
1644 +}
1645 +
1646 +.jumpMenu {
1647 +       position: fixed;
1648 +       top: 28px;
1649 +       width:300px;
1650 +       left: 10px;
1651 +       z-index: 32;
1652 +}
1653 +
1654 +.pageMenu {
1655 +       position: fixed;
1656 +       top: 28px;
1657 +       width:300px;
1658 +       left: 10px;
1659 +       z-index: 32;
1660 +       max-height: 340px;
1661 +}
1662 +
1663 +.pageMenu .palm-popup-content .palm-list {
1664 +       max-height: 340px;
1665 +}
1666 +
1667 +.jumpMenu .palm-popup-content,
1668 +.pageMenu .palm-popup-content {
1669 +       margin: 12px 8px 10px 8px;
1670 +}
1671 +
1672 +.jumpMenu .palm-popup-content .palm-list .chosen .title,
1673 +.pageMenu .palm-popup-content .palm-list .chosen .title {
1674 +
1675 +       font-weight: bold;
1676 +}
1677 +
1678 +.jumpMenu .palm-popup-content .palm-list .title,
1679 +.pageMenu .palm-popup-content .palm-list .title {
1680 +       line-height: 42px;
1681 +       min-height: 46px;
1682 +       font-size: 18px;
1683 +       text-align: center;
1684 +       margin:0px;
1685 +       padding:0px;
1686 +}
1687 +
1688 +.jumpMenu .palm-popup-content .chosen .popup-item-checkmark,
1689 +.pageMenu .palm-popup-content .chosen .popup-item-checkmark {
1690 +  display: none;
1691 +}
1692 +
1693 +.jumpMenu .palm-popup-content .palm-list .palm-row,
1694 +.pageMenu .palm-popup-content .palm-list .palm-row {
1695 +       line-height: 42px;
1696 +       min-height: 46px;
1697 +       max-height: 46px;
1698 +       margin:0px;
1699 +       padding:0px;
1700 +}
1701 +
1702 +.pageMenuScrim {
1703 +       background: transparent;
1704 +       z-index: 10;
1705 +}
1706 +
1707 --- .orig/usr/palm/applications/com.palm.app.deviceinfo/app/controllers/app-info-assistant.js
1708 +++ /usr/palm/applications/com.palm.app.deviceinfo/app/controllers/app-info-assistant.js
1709 @@ -69,22 +69,55 @@
1710                         this.controller.setupWidget('delete-btn', deleteAttrs, deleteModel);
1711                         this.controller.listen('delete-btn', Mojo.Event.tap, this.onDelete.bindAsEventListener(this));  
1712                         this.controller.get('delete-btn').show();
1713 -                       // done button is light
1714 -                       var doneModel = {
1715 -                               buttonLabel: $L('Done'),
1716 +                       // show button is light
1717 +                       var showModel = {
1718 +                               buttonLabel: $L('Show'),
1719                                 buttonClass: 'dismiss'
1720                         };
1721                 } else {
1722                         // hide 
1723                         this.controller.get('delete-btn').hide();
1724                         // done button is dark by default
1725 -                       var doneModel = {
1726 -                               buttonLabel: $L('Done')
1727 +                       var showModel = {
1728 +                               buttonLabel: $L('Show')
1729                         };
1730                 }       
1731  
1732 -               this.controller.setupWidget('done-btn', undefined, doneModel);
1733 -               this.controller.listen('done-btn', Mojo.Event.tap, this.close.bindAsEventListener(this));
1734 +               this.controller.get('show-btn').hide();
1735 +
1736 +               this.controller.setupWidget('show-btn', undefined, showModel);
1737 +               this.controller.listen('show-btn', Mojo.Event.tap, this.onShow.bindAsEventListener(this));
1738 +               
1739 +               this.getPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1740 +                       method: 'getPreferences', parameters: {subscribe: false, keys: ['appLauncherCfg']},
1741 +                       onSuccess: this.handlePreferences.bind(this) });
1742 +       },
1743 +
1744 +       handlePreferences: function(payload) {
1745 +               if(payload != undefined) {
1746 +                       if(payload.appLauncherCfg != undefined) {
1747 +                               this.appLauncherCfg = payload.appLauncherCfg;
1748 +                       
1749 +                               if(payload.appLauncherCfg.hidden) {
1750 +                                       if(payload.appLauncherCfg.hidden.indexOf(this.app.launchPointId) != -1)
1751 +                                               this.controller.get('show-btn').show();
1752 +                               }
1753 +                       }
1754 +               }
1755 +       },
1756 +       
1757 +       onShow: function() {
1758 +               var index = this.appLauncherCfg.hidden.indexOf(this.app.launchPointId);
1759 +               
1760 +               this.appLauncherCfg.hidden.splice(index, 1);
1761 +               
1762 +               if(this.setPreferencesRequest)
1763 +                       this.setPreferencesRequest.cancel();
1764 +       
1765 +               this.setPreferencesRequest = new Mojo.Service.Request('palm://com.palm.systemservice/', {
1766 +                       method: 'setPreferences', parameters: {'appLauncherCfg': this.appLauncherCfg} });               
1767 +       
1768 +               this.close();
1769         },
1770         
1771         onDelete: function() {
1772 --- .orig/usr/palm/applications/com.palm.app.deviceinfo/app/views/more/dialogs/app-info.html
1773 +++ /usr/palm/applications/com.palm.app.deviceinfo/app/views/more/dialogs/app-info.html
1774 @@ -9,5 +9,5 @@
1775  <div class="palm-dialog-separator"></div>
1776  <div class="palm-dialog-buttons">
1777         <div id='delete-btn' x-mojo-element="Button"></div>     
1778 -       <div id='done-btn' x-mojo-element="Button"></div>
1779 -</div>
1780 \ No newline at end of file
1781 +       <div id='show-btn' x-mojo-element="Button"></div>
1782 +</div>