Closed Bug 242708 Opened 20 years ago Closed 20 years ago

Custom folder chosen as Junk folder has Junk icon, but keeps it even when not being the Junk folder anymore

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8alpha1

People

(Reporter: boris, Assigned: durbacher)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.2) Gecko/20040308 MultiZilla/1.5.0.4h
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.2) Gecko/20040308 MultiZilla/1.5.0.4h

A normal folder suddenly has the same icon as the Junk folder.
Restarting mozilla doesn't help.


Reproducible: Always
Steps to Reproduce:
Sorry, I don't know why it started.


Expected Results:  
A standard icon. Is there anything I can do (e.g. deleting a file) to get the
old standard icon back?


See attachment for screenshot
Your build is _veery_ old. Can you try with Mozilla 1.7b or Mozilla1.6?
I upgraded to 1.6. Problem persists.
Boris: could you please try with a new profile and without Multizilla?
Do you have other extensions and Themes installed?
I've got adblock besides mulizilla but they shouldn't interfere with the folder
icons. I use the modern theme. Changing it to classic and back to modern didn't
help. Is there a file in the profile where the images for the folder are set?
(In reply to comment #5)
> Is there a file in the profile where the images for the folder are set?

No, those are set in a css file in one of the jar files in the chrome directory
(I guess). Could you still try with a new profile? ("mozilla -profilemanager")
I've found a possibility to 100% reproduce the bug! Go to the Junk-Mail-Control
Window.
Instead of moving junk mail to the Junk folder select a different folder. Now
close your mail window and open it again. The selected folder now has the "junk
icon". Now switch back to moving mails to the normal Junk folder. The result is,
that the folder doesn't get back its old standard icon!

Boris:
so this is the way you got the Junk icon in the first place?
In this case (which I assume) this bug is about the folder not getting the
regular folder icon when it is not selected as Junk folder anymore.
Confirming and changing this bug appropriately.

BTW: bug 100239 is why you have to reopen the mailnews window at all to see the
change TOwards the Junk icon.

http://lxr.mozilla.org/seamonkey/source/themes/classic/messenger/folderPane.css#95
is where it gets its icon; I suspect the Special-Junk-Folder
properties/attributes do not get removed from a folder when a different one is
chosen as Junk folder.
Severity: normal → minor
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: PC → All
Summary: Normal folder has Junk icon → Custom folder chosen as Junk folder has Junk icon, but keeps it even when not being the Junk folder anymore
Venkman reveals that a folder once set as Junk target (but now not anymore
because a different one is chosen) still has the flag MSG_FOLDER_FLAG_JUNK.
http://lxr.mozilla.org/seamonkey/source/mailnews/base/util/nsMsgIncomingServer.cpp#2109
should remove this flag, calling:
  oldJunkFolder->SetFlag(~MSG_FOLDER_FLAG_JUNK);

However, nsMsgDBFolder::SetFlag(PRUint32 flag) does not blindly set this flag,
but first checks:
  GetFlag(flag, &flagSet)
and looks if flagSet == true (flag already set) and in this case just does nothing.
Else it would just do 
  mFlags |= flag;
which, as far as I know boolean operators, would set all bits to "1"... this
does not exactly look what should be happening.

But this also IS not happening, because GetFlag says this flag is already set!!
It is doing
   *_retval = ((mFlags & flag) != 0);
which evaluates to true because the current flag is MSG_FOLDER_FLAG_JUNK *AND at
least one other bit* set for regular folders. This other bit overlaps with
~MSG_FOLDER_FLAG_JUNK, therefore ANDing them does not return null.

I don't understand why this is using the complement of the flag, anyway.
I'd propose the use of ToggleFlag or better ClearFlag (the former forces calling
OnFlagChange, which is said to be expensive, but has to be called anyway,
because the flag IS changed).
Attached patch patchSplinter Review
Changes
  oldJunkFolder->SetFlag(~MSG_FOLDER_FLAG_JUNK);
to
  oldJunkFolder->ClearFlag(MSG_FOLDER_FLAG_JUNK);
because I believe this is what was meant.
Tested and works (properly changes Junk icon to regular one - because of bug
100239 you have to reopen the mailnews window, though).

BTW: bug 170555 introduced the faulty code, the comment above (about TODO in
SetFlag) was added in revision 1.180. But SetFlag was never changed afterwards
to do it, so I just changed the comment to reflect reality.
Comment on attachment 148693 [details] [diff] [review]
patch

Requesting r= from mscott and sr= from bienvenu.
(or what was the deal about review-only??)

You both reviewed the patch for bug 170555 that introduced this code, so you
seem to be those who should know best what it wants to do - out of those still
available...
Attachment #148693 - Flags: superreview?(bienvenu)
Attachment #148693 - Flags: review?(mscott)
Comment on attachment 148693 [details] [diff] [review]
patch

yeah, the old code seems very wrong.
Attachment #148693 - Flags: superreview?(bienvenu) → superreview+
Attachment #148693 - Flags: review?(mscott) → review+
Assignee: sspitzer → durbacher
fixed for 1.8a
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8alpha
I assume for someone already with this problem we will need to re-set a folder
as 'junk' and then clear it for the icon to be cleared...?
Justin: exactly.
Boris: this way you get rid of your problem.

This patch also removes the Junk icon from the Junk folder if a different folder
is selected for Junk. This might look strange, but I think is only logical and
it's what the old code also *wanted* to do. The Junk folder itself will remain
until you delete it by hand.
Andreas, can I fix it manually in a data file right now?
(In reply to comment #16)
> Andreas, can I fix it manually in a data file right now?

Not that I'd know. There is probably a way, but my patch is changing it deep
inside a dll, so I don't know how/where this is saved.
BTW: after a Mozilla restart the original "Junk" folder will have the Junk icon
no matter which folder you chose as target for Junk.
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: