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