Bug 541416 - Filter editor should not allow "Delete" and "Move" of same message, also not Mark as read/Mark as Unread. But allow multiple copies of it. r=rkent
authoraceman <acelists@atlas.sk>
Wed, 18 Apr 2012 19:00:39 -0400
changeset 11666 ad44a8e284a730f2c3c724fc882015a808fe4263
parent 11665 1a3c7ece1ff544f5cd4842b44972e2c4588d7b65
child 11667 1824acff65bdbeca5b20821b62a19bb47d54bba4
push idunknown
push userunknown
push dateunknown
reviewersrkent
bugs541416
Bug 541416 - Filter editor should not allow "Delete" and "Move" of same message, also not Mark as read/Mark as Unread. But allow multiple copies of it. r=rkent
mailnews/base/search/content/searchWidgets.xml
--- a/mailnews/base/search/content/searchWidgets.xml
+++ b/mailnews/base/search/content/searchWidgets.xml
@@ -215,21 +215,35 @@
                   {
                     isCustom = true;
                     if (!gCustomActions[i].allowDuplicates)
                       usedActions[actionValue] = true;
                     break;
                   }
                 }
 
-                // don't add the tag action, several tags can be set
-                // don't add the forward action, severals forwards are OK
-                if (!isCustom && actionValue != 'addtagtomessage' &&
-                                 actionValue != 'forwardmessage')
-                  usedActions[actionValue] = true;
+                if (!isCustom) {
+                  // The following actions can appear more than once in a single filter
+                  // so do not set them as already used.
+                  if (actionValue != 'addtagtomessage' &&
+                      actionValue != 'forwardmessage' &&
+                      actionValue != 'copymessage')
+                    usedActions[actionValue] = true;
+                  // If either Delete message or Move message exists, disable the other one.
+                  // It does not make sense to apply both to the same message.
+                  if (actionValue == 'deletemessage')
+                    usedActions['movemessage'] = true;
+                  else if (actionValue == 'movemessage')
+                    usedActions['deletemessage'] = true;
+                  // The same with Mark as read/Mark as Unread.
+                  else if (actionValue == 'markasread')
+                    usedActions['markasunread'] = true;
+                  else if (actionValue == 'markasunread')
+                    usedActions['markasread'] = true;
+                }
               }
             }
             return usedActions;
           ]]>
         </body>
       </method>
     </implementation>