--- /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js.org Sun Nov 7 12:33:49 2010
+++ /usr/palm/applications/com.palm.app.messaging/app/controllers/chatview-assistant.js Thu Nov 11 15:45:36 2010
@@ -1980,6 +1980,9 @@
var needToInstantiateButtons = false;
var today = Date.now();
var d = new Date();
+ var today_year = d.getFullYear();
+ var today_month = d.getMonth();
+ var today_date = d.getDate();
var prevAddress = "";
for (var i = 0; i < stuff.length; i++) {
var delayed = {};
@@ -2016,23 +2019,34 @@
prevAddress = MessagingUtils.formatPhoneNumber(remoteAddr);
msg.dividerAddress = prevAddress; // this used to use msg.timeStamp - changed 2008-11-05
}
- msg.niceDate = BucketDateFormatter.getDateBucket(d, true, true);
-
+
+ msg.time = Mojo.Format.formatDate(d, {'time': 'short'});
+
+ var d_year = d.getFullYear();
+ var d_month = d.getMonth();
+ var d_date = d.getDate();
+
+ if (d_year != today_year) {
+ msg.date = Mojo.Format.formatDate(d, 'd MMM yyyy');
+ } else if (d_month != today_month || Math.abs(d_date - today_date) > 7) {
+ msg.date = Mojo.Format.formatDate(d, 'd MMM');
+ } else if (d_date != today_date) {
+ msg.date = Mojo.Format.formatDate(d, 'EEE');
+ } else {
+ msg.date = $L('Today');
+ }
+
// divider hack - round to the nearest 5 minutes
// we have to do this because the list divider implementation does not allow a divider
// to have knowledge about other dividers
var deviceTimeStampMinutes = d.getMinutes();
- d.setMinutes((deviceTimeStampMinutes - (deviceTimeStampMinutes % 5)));
+ d.setMinutes((deviceTimeStampMinutes - (deviceTimeStampMinutes % 60)));
d.setSeconds(0);
// Do this to prevent the divider from showing up if an address isn't available.
if (prevAddress) {
this.dividerAddress = prevAddress;
}
- if (msg.locked !== true) {
- msg.dividerLabel = msg.transportClass + BucketDateFormatter.getDateBucket(d, true, true) + this.dividerAddress;
- }else if(i>1){
- msg.dividerLabel = stuff[i-1].dividerLabel;
- }
+ msg.dividerLabel = msg.transportClass + d + this.dividerAddress;
// HACK: Always display the message sent time for GCF
// When this is fixed, it should use 'timestamp' instead of 'localTimestamp'
@@ -2398,6 +2412,8 @@
this.handleMessageErrorPopup(results[0]);
}
});
+ } else if (value === 'show-message-info') {
+ this.showMessageInfo(messageId);
}
},
@@ -2462,6 +2478,8 @@
this.handleMessageErrorPopup(results[0]);
}
});
+ } else if (value === 'show-message-info') {
+ this.showMessageInfo(paramsIn.messageId);
}
},
@@ -2519,6 +2537,7 @@
popupItems = [{label: $L(deliveryReceiptMsg), command: '', disabled: true}];
}
popupItems = popupItems.concat([
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
{label: $L('Copy Text'), command: 'copy-cmd'},
@@ -2577,6 +2596,7 @@
params.filePath = mmsTarget.getAttribute('originalSrc');
params.mediaIndex = mmsTarget.getAttribute('mediaIndex');
popupItems = popupItems.concat([
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('View'), command: 'view-image-cmd'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
@@ -2603,6 +2623,7 @@
params.fileName = mmsTarget.getAttribute('fileInfo');
popupItems = popupItems.concat([
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('Play'), command: 'play-video-cmd'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
@@ -2627,6 +2648,7 @@
params.filePath = mmsTarget.getAttribute('filePath');
popupItems = popupItems.concat([
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('Add to Contacts'), command: 'add-contact-cmd'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
@@ -2655,6 +2677,7 @@
onChoose: this.handleContextMenuSelectMms.bind(this, params),
placeNear: mmsTarget,
items: [
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('Add to Calendar'), command: 'add-calendar-cmd'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
@@ -2707,6 +2730,7 @@
}
popupItems = popupItems.concat([
+ {label: $L('Info'), command: 'show-message-info'},
{label: $L('Forward'), command: 'forward-cmd'},
{label: $L('Forward Via Email'), command: 'forward-as-email-cmd'},
{label: $L('Copy Text'), command: 'copy-text-cmd'},
@@ -2721,6 +2745,37 @@
placeNear: eventTarget.target,
items: popupItems
});
+ },
+
+ /**
+ * Show info about the message
+ *
+ * @param {Object} messsageId
+ */
+ showMessageInfo: function(messageId) {
+ var future = MessagingDB.Messages.get(messageId);
+ future.then(this, function() {
+ var results = future.result ? future.result.results : [];
+ var msg = results[0];
+ var d = new Date(msg.localTimestamp);
+
+ var localTs = Mojo.Format.formatDate(d, {'time': 'medium'});
+ var localDate = Mojo.Format.formatDate(d, {'date': 'medium'});
+ var address = MessagingUtils.formatPhoneNumber(this.getAddressFromMsg(msg));
+ var from = new Template($L("From: #{address}")).evaluate({ address: address });
+
+ if (msg.folder === MessagingDB.Messages.Folders.OUTBOX) {
+ from = $L("To:") + " " + address;
+ }
+
+ this.controller.showAlertDialog({
+ onChoose: function(whatever) {},
+ title: "Info",
+ message: from + "
" + $L("Time:") + " " + localTs + "
" + $L("Date:") + " " + localDate,
+ choices: [{label: "Ok", value: 'close'}],
+ allowHTMLMessage: true
+ });
+ });
},
/**