Feed panel "Mark As Read / Mark As New" change proposal

Marcin Cieslak <[email protected]> Sat, 16 Aug 2008 16:24:54 +0200
Newsgroups gmane.comp.mozilla.multizilla
Organization The Mozdev Foundation - news server
Message-ID <[email protected]>
Hello,

I've just started to use Multizilla because of its build-in RSS feed 
reader. Once I've received a feed with 444 items I've found that it's 
very difficult to find a "Mark All Read" option. I tried right clicking 
on some news items and only "Mark All New" was available.

I couldn't figure this out until.... I looked at the code.
Then it was easy - click on the new item with a right click (don't use 
left click since it will be marked as read...) and voilĂ , the options 
are there.

Since I find hiding options this way a bit counter-intuitive and to make 
Feed Panel behaviour be a bit more consistent with the Mozilla's Mail 
and News reader, I have implemented a small change:

- Mark as New / as Read options will always be visible, only sometimes 
disabled (greyed-out)
- A check mark indicates selected message status.

Attached please find a patch against CVS (with some white space change 
to the XUL file it applies to the 1.8.3.4e as well).

If you want to try that yourself on a running installation, just unpack 
the multiviews.jar file from the "components" directory to some 
temporary directory, apply changes and re-pack the jar file again. 
(Jarfiles are more or less normal zipfiles).

--Marcin

_______________________________________________
MultiZilla mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/multizilla
patch-feedpanel (text/plain, 4.5 KB)
Index: content/multiviews/feedpanel/feed-panel.js
===================================================================
RCS file: /cvs/multizilla/src/content/multiviews/feedpanel/feed-panel.js,v
retrieving revision 1.17
diff -u -r1.17 feed-panel.js
--- content/multiviews/feedpanel/feed-panel.js	11 Nov 2007 02:37:36 -0000	1.17
+++ content/multiviews/feedpanel/feed-panel.js	16 Aug 2008 13:03:24 -0000
@@ -146,25 +146,35 @@
     var row = getRowFromEvent(tree, aEvent);
     var resource = (tree.currentIndex >= 0) ? tree.builderView.getResourceAtIndex(tree.currentIndex) : "";
 
-    if (resource && mzWebFeedService.getVisitedState(resource)) {
-      menuitems[CM_MARK_AS_READ].setAttribute("hidden", "true");
-      menuitems[CM_MARK_ALL_AS_READ].setAttribute("hidden", "true");
-
-      menuitems[CM_MARK_AS_NEW].removeAttribute("hidden");
-      menuitems[CM_MARK_ALL_AS_NEW].removeAttribute("hidden");
-
-      menuitems[CM_MARK_AS_NEW].setAttribute("disabled", (treeState != SINGLE_ROW_SELECTED));
-      menuitems[CM_MARK_ALL_AS_NEW].setAttribute("disabled", (treeState == NO_ROWS_AVAILABLE));
-    }
-    else {
-      menuitems[CM_MARK_AS_NEW].setAttribute("hidden", "true");
-      menuitems[CM_MARK_ALL_AS_NEW].setAttribute("hidden", "true");
-
-      menuitems[CM_MARK_AS_READ].removeAttribute("hidden");
-      menuitems[CM_MARK_ALL_AS_READ].removeAttribute("hidden");
-
-      menuitems[CM_MARK_AS_READ].setAttribute("disabled", (treeState != SINGLE_ROW_SELECTED));
-      menuitems[CM_MARK_ALL_AS_READ].setAttribute("disabled", (treeState == NO_ROWS_AVAILABLE));
+    switch (treeState) {
+    case NO_ROWS_AVAILABLE:
+      menuitems[CM_MARK_AS_NEW].setAttribute("disabled", "true");
+      menuitems[CM_MARK_AS_NEW].setAttribute("checked", "false");
+      menuitems[CM_MARK_AS_READ].setAttribute("disabled", "true");
+      menuitems[CM_MARK_AS_READ].setAttribute("checked", "false");
+      menuitems[CM_MARK_ALL_AS_NEW].setAttribute("disabled", "true");
+      menuitems[CM_MARK_ALL_AS_READ].setAttribute("disabled", "true");
+      break;
+    case SINGLE_ROW_SELECTED:
+      menuitems[CM_MARK_AS_NEW].setAttribute("disabled", "false");
+      menuitems[CM_MARK_AS_READ].setAttribute("disabled", "false");
+      menuitems[CM_MARK_ALL_AS_NEW].setAttribute("disabled", "false");
+      menuitems[CM_MARK_ALL_AS_READ].setAttribute("disabled", "false");
+      if (resource && mzWebFeedService.getVisitedState(resource)) {
+      	menuitems[CM_MARK_AS_READ].setAttribute("checked", "true");
+      	menuitems[CM_MARK_AS_NEW].setAttribute("checked", "false");
+      } else {
+      	menuitems[CM_MARK_AS_READ].setAttribute("checked", "false");
+      	menuitems[CM_MARK_AS_NEW].setAttribute("checked", "true");
+      }
+      break;
+    default:
+      menuitems[CM_MARK_AS_NEW].setAttribute("disabled", "true");
+      menuitems[CM_MARK_AS_NEW].setAttribute("checked", "false");
+      menuitems[CM_MARK_AS_READ].setAttribute("disabled", "true");
+      menuitems[CM_MARK_AS_READ].setAttribute("checked", "false");
+      menuitems[CM_MARK_ALL_AS_NEW].setAttribute("disabled", "false");
+      menuitems[CM_MARK_ALL_AS_READ].setAttribute("disabled", "false");
     }
     document.getElementById(tree.id + "-properties").setAttribute("disabled", "true");
   }
Index: content/multiviews/feedpanel/feed-panel.xul
===================================================================
RCS file: /cvs/multizilla/src/content/multiviews/feedpanel/feed-panel.xul,v
retrieving revision 1.9
diff -u -r1.9 feed-panel.xul
--- content/multiviews/feedpanel/feed-panel.xul	21 Apr 2007 08:02:24 -0000	1.9
+++ content/multiviews/feedpanel/feed-panel.xul	16 Aug 2008 13:03:24 -0000
@@ -199,11 +199,11 @@
         <menuitem id="openInWindow" label="&openArticleInWindow.label;"
                   accesskey="&openArticleInWindow.accesskey;"/>
         <menuseparator/>
-        <menuitem id="markAsRead" label="&markArticleAsRead.label;"
+        <menuitem id="markAsRead" type="checkbox" label="&markArticleAsRead.label;"
                   accesskey="&markArticleAsRead.accesskey;"/>
         <menuitem id="markAllAsRead" class="menuitem-iconic" label="&markAllArticlesAsRead.label;"
                   accesskey="&markAllArticlesAsRead.accesskey;"/>
-        <menuitem id="markAsNew" label="&markArticleAsNew.label;"
+        <menuitem id="markAsNew" type="checkbox" label="&markArticleAsNew.label;"
                   accesskey="&markArticleAsNew.accesskey;"/>
         <menuitem id="markAllAsNew" class="menuitem-iconic" label="&markAllArticlesAsNew.label;"
                   accesskey="&markAllArticlesAsNew.accesskey;"/>
signature.asc (application/pgp-signature, 273 B)
-----BEGIN PGP SIGNATURE-----

iQCVAwUBSKbjOj2W2v2wY27ZAQNCkAP9ErRFSAj6FskO/TNPU3gKVUXgC4owBfaR
oTtCxS3nToRu15E2ZQ5H4eEMJ245nXo1X9uootUByCalTq4MfoAGE9C7u65g/Euu
pFwrWqXTn6YrLRbcxkvDbU72wSCooGwiD5v0G+R+R/7gL7RE37IdeCf1tBQjW+dx
bBg6pQUW8sg=
=WeBW
-----END PGP SIGNATURE-----