Closed Bug 128916 Opened 23 years ago Closed 21 years ago

Need new method to the view's js interface that returns header flags from a URI

Categories

(MailNews Core :: Backend, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ssu0262, Assigned: ssu0262)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(1 file)

I'm not sure if I got the summary correct, but here is the problem:

The patch to bug 82056 will conflict with the patch in bug 30560 in that when
right-mouse clicking on an already deleted message (that is not currently
selected) to undelete, the context menu item should display 'Undelete Message'.
 It will show 'Delete Message' still.

The reason being is that the only view method that returns the header for a
selected message (hdrForFirstSelectedMessage()), returns the message that is
reference by the outliner's 'currentIndex' which is not necessarily the same as
the message that is currently selected/highlighted (specially after fixing bug
30560).

The header is required to check for the MSG_FLAG_IMAP_DELETED flag and show the
appropriate context menu string.

One solution is to add a new method to expose the GetMsgDBHdrFromURI() function
in js, since there's already way in js to get the correct URI of the selected
message.
Status: NEW → ASSIGNED
QA Contact: esther → olgam
In fact there is a way to get the hdr for a URI, I found some code in the
extractMsgKeyFromURI function, the code would look something like this, thus
making it independent of the patch to bug 30560. How does it look?

function UpdateDeleteCommand()
{
  var value = "value";
  var uri = GetFirstSelectedMessage();
  if (IsNewsMessage(uri))
    value += "News";
  else if (IsIMAPDeleted(uri))
    value += "IMAPDeleted";
  if (GetNumSelectedMessages() < 2)
    value += "Message";
  else
    value += "Messages";
  goSetMenuValue("cmd_delete", value);
  goSetAccessKey("cmd_delete", value + "AccessKey");
}

function IsImapDeleted(uri)
{
  if (uri) {
    var msgService = messenger.messageServiceFromURI(uri);
    if (msgService)
    {
      var msgHdr = msgService.messageURIToMsgHdr(uri);
      if (msgHdr)
        return msgHdr.flags & MSG_FLAG_IMAP_DELETED;
    }
  }
  return 0;
}
Neil, that actually looks good.  Can you attach a working patch?
Keywords: patch, regression, review
Tested Neil's patch with IMAP (and POP) on nightly 2002032003, "delete" and
"undelete" are now always shown as appropriate in the context menu.
I can't verify his patch.  It wasn't working for me, but then I have lots of
other things going on in my current tree.  If you can't find someone else to r=,
I'll do it as soon as I can pull a fresh tree.  Sorry for the inconvenience, but
I'm currently at home recovering from a surgery, and I don't have a high speed
connection to the internet from home.
*** Bug 148261 has been marked as a duplicate of this bug. ***
Blocks: 158011
Fixed by checkin to bug 161333.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: