Commit 3820172c0244b6caafd348111940c8b905b8ec65

  • avatar
  • egaudet
  • Sat Oct 03 02:13:21 CEST 2009
Updated patches to 1.2.0, removed obsolete bookmark patch
  
11diff --git a/usr/palm/applications/com.palm.app.email/app/models/Email.js b/usr/palm/applications/com.palm.app.email/app/models/Email.js
2index a42803b..d7ba7e7 100644
2index 5063cd5..ef728ed 100644
33--- a/usr/palm/applications/com.palm.app.email/app/models/Email.js
44+++ b/usr/palm/applications/com.palm.app.email/app/models/Email.js
5@@ -438,7 +438,7 @@ Email.setReplied = function(messageId, value) {
5@@ -458,7 +458,7 @@ Email.setReplied = function(messageId, value) {
66 }
77
8 Email.kSignaturePlaceholder = "<br><br><span id='signature'></span>";
8 Email.kSignaturePlaceholder = "<span style='font-family:Prelude, Verdana, san-serif;'><br><br></span><span id='signature'></span>";
99-Email.kReplyForwardSetupElems = "<span style='color:navy'>" + Email.kSignaturePlaceholder + "<hr align='left' style='width:75%'/>";
1010+Email.kReplyForwardSetupElems = "<span style='color:black'>" + Email.kSignaturePlaceholder + "<hr align='left' style='width:75%'/>";
1111
  
11diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2index f343ce2..e34708a 100644
2index ee479ac..f02e1cd 100644
33--- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
44+++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5@@ -2266,7 +2266,7 @@ updateClockEveryMinute: function() {
6 date.setHours(12);
5@@ -2337,7 +2337,7 @@ updateClockEveryMinute: function() {
76 }
8 }
7 }
8 format = format.replace(/\s?a\s?/,"");
99- $('clock').innerHTML = Mojo.Format.formatDate(date, {time: format});
1010+ $('clock').innerHTML = Mojo.Format.formatDate(date, {date:'short',time: format});
1111 $('today').innerHTML = Mojo.Format.formatDate(date,{date:'short'});
  
1This patch modifies the messaging app to play a specified
2tone (rather than the default alerts tone) when a new message
3is received. If none is specified, it will play the default
4tone. This patch should be used in conjunction with either
5message-tone-sounds-and-alerts.patch or with the
6MyNotifications homebrew application.
7Index: /usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
8===================================================================
9--- .orig/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
10+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
11@@ -53,6 +53,19 @@ NotificationAssistant.prototype.sendNoti
1diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
2index 1692085..998dfdc 100644
3--- a/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
4+++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
5@@ -51,6 +51,19 @@ NotificationAssistant.prototype.sendNotification = function(notificationType, re
126 }
137 };
148
2222 /*
2323 * <ReminderCode>
2424 */
25@@ -142,7 +155,7 @@ NotificationAssistant.prototype.consider
25@@ -140,7 +153,7 @@ NotificationAssistant.prototype.considerForNotification = function(notificationD
2626
2727 // check if we should only play a sound (when you are already in a chat & a new message comes in)
2828 if(notificationData.get('playSoundOnly') && this.Messaging.messagingPrefs.enableNotificationSound) {
3131 return; // don't display any visual notification
3232 }
3333
34@@ -178,10 +191,10 @@ NotificationAssistant.prototype.sendClas
34@@ -176,10 +189,10 @@ NotificationAssistant.prototype.sendClass0PopupAlert = function(notificationData
3535
3636 notificationData.set('alertTitle',alertTitle);
3737 this.class0AlertData.list.push(notificationData);
4444 var class0Stage = this.controller.getStageController(Class0AlertStageName);
4545
4646 if(class0Stage) {
47@@ -190,6 +203,8 @@ NotificationAssistant.prototype.renderCl
47@@ -188,6 +201,8 @@ NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound) {
4848 var soundClass = 'none';
4949 if(playSound) {
5050 soundClass = 'alerts';
5353 }
5454
5555 var pushClass0AlertScene = function(stageController) {
56@@ -200,7 +215,8 @@ NotificationAssistant.prototype.renderCl
56@@ -198,7 +213,8 @@ NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound) {
5757 name: Class0AlertStageName,
5858 lightweight: true,
5959 height: 300,
6363 }, pushClass0AlertScene, 'popupalert');
6464 }
6565
66@@ -252,8 +268,6 @@ NotificationAssistant.prototype.sendNewM
66@@ -253,8 +269,6 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
6767 var bannerParams = {
6868 messageText: notificationText
6969 };
7070- if (this.Messaging.messagingPrefs.enableNotificationSound)
7171- bannerParams.soundClass = "alerts";
7272 var bannerLaunchParams = {
73 chatThreadId: notificationData.get('chatThreadId'),
73 chatThreadId: chatThreadId,
7474 clearBanner: true
75@@ -261,10 +275,14 @@ NotificationAssistant.prototype.sendNewM
75@@ -262,10 +276,14 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
7676
7777 if (this.Messaging.DisplayState.isDisplayOn()) {
7878 Mojo.Log.info("notificationAssistant - executing full banner notification");
79- this.controller.showBanner(bannerParams, bannerLaunchParams, 'chat');
8079+ if (this.Messaging.messagingPrefs.enableNotificationSound) {
8180+ bannerParams.soundClass = "alerts";
8281+ MessagingMojoService.getMessagetone(this.doBanner.bind(this,bannerParams,bannerLaunchParams,'chat'));
8382+ } else
84+ this.controller.showBanner(bannerParams, bannerLaunchParams, 'chat');
83 this.controller.showBanner(bannerParams, bannerLaunchParams, 'chat');
8584 } else if (this.Messaging.messagingPrefs.enableNotificationSound) {
8685 Mojo.Log.info("notificationAssistant - playing sound notification only");
8786- this.controller.playSoundNotification('alerts','');
8888 }
8989
9090 // Store the data so it can be used in the dashboard
91@@ -314,14 +332,9 @@ NotificationAssistant.prototype.sendNewM
91@@ -324,14 +342,14 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
9292 // delay creating the dashboard window for the case where the banner is clicked on
9393 // to take you to the chat view. This will likely result in the dashboard data
9494 // being cleared. If the dashboard data is empty, we do not need to create the dashboard.
9595- if (this.Messaging.DisplayState.isDisplayOn()) {
96- if (!this.isNewMessageDashboardPending) {
97- this.isNewMessageDashboardPending = true;
98- createDashboard.delay(5);
99- }
100-
96+ //if (this.Messaging.DisplayState.isDisplayOn()) {
97 if (!this.isNewMessageDashboardPending) {
98 this.isNewMessageDashboardPending = true;
99 createDashboard.delay(5);
100 }
101101- } else {
102102- createDashboard(); // if the screen is off, create the dashboard right away
103+ if (!this.isNewMessageDashboardPending) {
104+ this.isNewMessageDashboardPending = true;
105+ createDashboard.delay(5);
106 }
103- }
104+ // } else {
105+ // createDashboard(); // if the screen is off, create the dashboard right away
106+ // }
107107 }
108108 };
109Index: /usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
110===================================================================
111--- .orig/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
112+++ /usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
109
110diff --git a/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js b/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
111index 808aaa7..862d04c 100644
112--- a/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
113+++ b/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
113114@@ -9,6 +9,16 @@ var MessagingMojoService = {
114115 telephonyIdentifier: 'palm://com.palm.telephony',
115116 systemManagerIdentifier: 'palm://com.palm.systemmanager',
  
1Patch the musicplayer application to record a bookmark when pausing, changing tracks, or exiting the app.
2
3You can return to the bookmark by hitting "next" while playing a song, assuming you are before the bookmark.
4
5Bookmarks will be displayed in the playlist screen as a red line.
6
7Tested-On: 1.1
8
9see: http://predev.wikidot.com/bookmarking-mediaplayer for more info
10Index: /usr/palm/applications/com.palm.app.musicplayer/app/controllers/localnowplaying-assistant.js
11===================================================================
12--- .orig/usr/palm/applications/com.palm.app.musicplayer/app/controllers/localnowplaying-assistant.js
13+++ /usr/palm/applications/com.palm.app.musicplayer/app/controllers/localnowplaying-assistant.js
14@@ -360,8 +360,12 @@ var LocalnowplayingAssistant = Class.cre
15 this._updateXOfYHeader();
16 }.bind(this));
17 } else if (message == this.musicPlayer.MESSAGE_PAUSE) {
18+ // drnull - update the bookmark line when pausing for feedback
19+ this._updateBookmarkLine();
20 this.showPlay();
21 } else if (message == this.musicPlayer.MESSAGE_PLAY) {
22+ // drnull - update the bookmark line when pausing for feedback
23+ this._updateBookmarkLine();
24 this.showPause();
25 } else if (message == this.musicPlayer.MESSAGE_PLAYLIST_ENDED) {
26 this.showPlay();
27@@ -986,6 +990,9 @@ var LocalnowplayingAssistant = Class.cre
28 this.nextSong();
29 } else if (event.command == "prev"){
30 this.prevSong();
31+ // drnull - a little bit hacky, but if you hit prev, it could
32+ // create a new bookmark where you were, so update here
33+ this._updateBookmarkLine();
34 } else if (event.command == "pause"){
35 this.showPlay();
36 this.pause();
37@@ -1395,6 +1402,9 @@ var LocalnowplayingAssistant = Class.cre
38 //oldSongDiv.setAttribute ("class", oldSongItem.playingStatus); // done by markitemsPlayed
39 oldSongDiv.down('.elapsed').innerHTML = "00:00";
40 oldSongDiv.down('.progress-bar').style.width = 0;
41+ // drnull
42+ // make the line for non-active songs thinner
43+ if (oldSongDiv.down('.bookmark-line').style.width == "2px") oldSongDiv.down('.bookmark-line').style.width = "1px";
44 }
45 }
46
47@@ -1568,6 +1578,24 @@ var LocalnowplayingAssistant = Class.cre
48 },
49
50 /**
51+ * drnull - added to support the bookmark line
52+ * Fetch the bookmark line div.
53+ */
54+ _getCurrentSongBookmarkLineDiv: function(){
55+ var result = null;
56+
57+ if (this.controller.get('song_list') && this.displayedSong) {
58+ var bookmarkDiv = this.controller.get('song_list').select('[x-mojo-media-songid="' + this.displayedSong.songID + '"]')[0];
59+ if (bookmarkDiv) {
60+ result = bookmarkDiv.down('.bookmark-line');
61+ }
62+ }
63+
64+ return result;
65+ },
66+
67+
68+ /**
69 * Format the duration into a displayable string.
70 *
71 * @param {Object} secs
72@@ -1657,6 +1685,30 @@ var LocalnowplayingAssistant = Class.cre
73 _updateProgressBar: function(percentage){
74 this._getCurrentSongProgressBarDiv().style.width = percentage + "%";
75 },
76+
77+ /**
78+ * drnull - added to support the bookmark line
79+ */
80+ _updateBookmarkLine: function(){
81+ var div=this._getCurrentSongBookmarkLineDiv();
82+ if (div) {
83+ if (this.musicPlayer.hasBookmark()) {
84+ var secs = 0;
85+ if (this.musicPlayer.audioPlayer.duration){
86+ secs = this.musicPlayer.audioPlayer.duration;
87+ } else if (this.musicPlayer.getCurrentSong().songDuration) {
88+ secs = this.musicPlayer.getCurrentSong().songDuration;
89+ }
90+ var left = Math.max(0, 100*this.musicPlayer.getBookmarkTime()/secs - 1);
91+ div.style.left = left + "%";
92+ div.style.width = "2px";
93+ }
94+ } else {
95+ Mojo.Log.error("couldn't find bookmark div, trying again in a bit...");
96+ // call back later if we couldn't find the div
97+ setTimeout(this._updateBookmarkLine.bind(this), 500);
98+ }
99+ },
100
101 refreshAppMenu: function(){
102 var menuModel = this._appMenuModel;
103Index: /usr/palm/applications/com.palm.app.musicplayer/app/views/localnowplaying/listitem.html
104===================================================================
105--- .orig/usr/palm/applications/com.palm.app.musicplayer/app/views/localnowplaying/listitem.html
106+++ /usr/palm/applications/com.palm.app.musicplayer/app/views/localnowplaying/listitem.html
107@@ -3,6 +3,7 @@
108 <div class="#{playingStatus}" x-mojo-media-songid="#{songID}">
109
110 <div class="progress-bar" style="width: #{songCompletedPercentage}%"></div>
111+ <div class="bookmark-line" style="width: #{bookmarkWidth}; left: #{bookmarkPercentage}%"></div>
112 <div class="progress-bar-background"></div>
113
114 <div class="now-playing-list title truncating-text">#{songName}</div>
115Index: /usr/palm/applications/com.palm.app.musicplayer/scripts/MusicPlayer.js
116===================================================================
117--- .orig/usr/palm/applications/com.palm.app.musicplayer/scripts/MusicPlayer.js
118+++ /usr/palm/applications/com.palm.app.musicplayer/scripts/MusicPlayer.js
119@@ -49,6 +49,9 @@ var musicPlayerSingleton = (function(){
120 },
121
122 stop: function(){
123+ // drnull
124+ // save current position before leaving
125+ this.setBookmark();
126 if (!this.stopped){
127 }
128
129@@ -188,7 +191,8 @@ var musicPlayerSingleton = (function(){
130 },
131
132 pause: function(){
133-
134+ // drnull
135+ this.setBookmark();
136 if (this.audioPlayer.networkState != HTMLMediaElement.LOADING)
137 this.audioPlayer.pause();
138 else
139@@ -363,6 +367,14 @@ var musicPlayerSingleton = (function(){
140 Mojo.Log.info ("current song: " + currentSongNum)
141 Mojo.Log.info ("num songs: " + this.getNumSongs())
142
143+ // drnull
144+ // if we hit "next" but we are not up to the bookmarked time yet, go ahead and jump to it
145+ if (this.hasBookmark() && this.audioPlayer.currentTime+1 < this.getBookmarkTime()) {
146+ this.gotoBookmark();
147+ } else {
148+ //drnull
149+ //save current position before jumping to new song
150+ this.setBookmark();
151 if (currentSongNum == this.getNumSongs() - 1 &&
152 this.getRepeatMode() != this.playlist.REPEAT_MODE_ALL) {
153 // if the playlist is over
154@@ -376,6 +388,7 @@ var musicPlayerSingleton = (function(){
155 else
156 this.app.handleNextSong(playlistEnded, doNotSwitchSongs, this._doNextSong.bind(this));
157 }
158+ }
159
160
161 return true;
162@@ -403,6 +416,9 @@ var musicPlayerSingleton = (function(){
163
164 if ((this.audioPlayer.currentTime > 4 && !force) ||
165 (currentSongNum == 0 && this.getRepeatMode() != this.playlist.REPEAT_MODE_ALL)) {
166+ // drnull
167+ // if we are going back to the beginning, set a bookmark first
168+ this.setBookmark();
169 this.audioPlayer.currentTime = 0;
170 }
171 else if (currentSongNum == 0 &&
172@@ -479,6 +495,10 @@ var musicPlayerSingleton = (function(){
173 },
174
175 jumpToSong: function(songNum, callback, doNotStartPlaying){
176+ // drnull
177+ // save current position before jumping to new song
178+ this.setBookmark();
179+
180
181 this.playlist.setSong(songNum, function(){
182 this._openCurrentSong(this.isPlaying, doNotStartPlaying);
183@@ -489,6 +509,99 @@ var musicPlayerSingleton = (function(){
184
185 },
186
187+ /**
188+ * drnull
189+ * Save the current play position in the song
190+ */
191+ setBookmark: function() {
192+ var cookie = this._bookmarkCookie();
193+ if (cookie && this.audioPlayer.currentTime > 15) {
194+ Mojo.Log.error("setBookmark:", this.playlist.getCurrentSong().songID, "-", this.playlist.getCurrentSong().songName, ": bookmark=", this.audioPlayer.currentTime);
195+ cookie.put(this.audioPlayer.currentTime + " " + Math.max(0, 100*this.audioPlayer.currentTime/this.audioPlayer.duration-1));
196+ }
197+ },
198+
199+ /**
200+ * drnull
201+ * goto the bookmark stored in a cookie if available
202+ */
203+ gotoBookmark: function() {
204+ var bookmarkTime = this.getBookmarkTime();
205+ if (bookmarkTime > 0) {
206+ if (this.audioPlayer.duration < bookmarkTime) {
207+ this.audioPlayer.currentTime = this.audioPlayer.duration;
208+ } else {
209+ this.audioPlayer.currentTime = bookmarkTime;
210+ }
211+
212+ Mojo.Log.error("gotoBookmark:", this.playlist.getCurrentSong().songID, "-", this.playlist.getCurrentSong().songName, ": bookmark=", bookmarkTime);
213+ }
214+ },
215+
216+ /**
217+ * drnull
218+ * find out if this song has a bookmark cookie
219+ */
220+ hasBookmark: function(id) {
221+ var hasCookie = false;
222+ var cookie = this._bookmarkCookie(id);
223+ if (cookie) {
224+ if (cookie.get() != null) hasCookie = true;
225+ }
226+ return hasCookie;
227+ },
228+
229+ /**
230+ * drnull
231+ * get the bookmark time index for this song
232+ */
233+ getBookmarkTime: function(id) {
234+ var cookie = this._bookmarkCookie(id);
235+ var index = 0;
236+ if (cookie) {
237+ value = cookie.get();
238+ if (value) {
239+ arr = new String(value).split(" ");
240+ index = arr[0];
241+ if (index == null) index = 0;
242+ }
243+ }
244+ return index;
245+ },
246+
247+ /**
248+ * drnull
249+ * get the bookmark percent for this song
250+ */
251+ getBookmarkPercentage: function(id) {
252+ var cookie = this._bookmarkCookie(id);
253+ var index = 0;
254+ if (cookie) {
255+ value = cookie.get();
256+ if (value) {
257+ arr = new String(value).split(" ");
258+ index = arr[1];
259+ if (index == null) index = 0;
260+ }
261+ }
262+ return index;
263+ },
264+
265+ /**
266+ * drnull
267+ * single point of access to the cookie
268+ */
269+ _bookmarkCookie: function(id) {
270+ var cookie = null;
271+ var songID = id;
272+ if (songID == null && this.playlist && this.playlist.getCurrentSong())
273+ songID = this.playlist.getCurrentSong().songID;
274+ if (songID != null) {
275+ cookie = new Mojo.Model.Cookie("com.palm.app.musicplayer.bookmark.song"+songID);
276+ }
277+ return cookie;
278+ },
279+
280 /**
281 * Toggle the reor mode on/off.
282 */
283Index: /usr/palm/applications/com.palm.app.musicplayer/scripts/ReorderablePlaylist.js
284===================================================================
285--- .orig/usr/palm/applications/com.palm.app.musicplayer/scripts/ReorderablePlaylist.js
286+++ /usr/palm/applications/com.palm.app.musicplayer/scripts/ReorderablePlaylist.js
287@@ -116,6 +116,14 @@ var ReorderablePlaylist = Class.create({
288
289 song.playingStatus = this._playingStatus (songNum);
290 song.songNum = songNum;
291+ //drnull
292+ if (this.musicPlayer.hasBookmark(song.songID)) {
293+ song.bookmarkPercentage = this.musicPlayer.getBookmarkPercentage(song.songID);
294+ song.bookmarkWidth = "1px";
295+ } else {
296+ song.bookmarkPercentage = "0";
297+ song.bookmarkWidth = "0px";
298+ }
299
300 if (songNum == this.getCurrentSongNum()){
301 var currentTime = Math.floor(this.musicPlayer.audioPlayer.currentTime);
302Index: /usr/palm/applications/com.palm.app.musicplayer/stylesheets/music-player.css
303===================================================================
304--- .orig/usr/palm/applications/com.palm.app.musicplayer/stylesheets/music-player.css
305+++ /usr/palm/applications/com.palm.app.musicplayer/stylesheets/music-player.css
306@@ -741,6 +741,9 @@ img.album-art {
307 .palm-reorder-element .active .progress-bar {
308 display: none;
309 }
310+.palm-reorder-element .bookmark-line {
311+ display: none;
312+}
313
314 .active .progress-bar-background {
315 position: absolute;
316@@ -749,6 +752,16 @@ img.album-art {
317 border-width: 15px 15px 11px 15px;
318 -webkit-border-image: url(../images/download-background.png) 15 15 11 15 stretch stretch;
319 -webkit-box-sizing: border-box;
320+ z-index: -3;
321+}
322+
323+.bookmark-line {
324+ position: absolute;
325+ height: 58px;
326+ left: 0%;
327+ width: 0px;
328+ color: red;
329+ background-color: red;
330 z-index: -2;
331 }
332