Author: jflesch
Date: 2007-09-06 03:35:51 +0000 (Thu, 06 Sep 2007)
New Revision: 14985

Modified:
   trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java
Log:
Fix the button 'next unread message' in minifrost

Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java    
2007-09-06 01:46:03 UTC (rev 14984)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessageTreeTable.java    
2007-09-06 03:35:51 UTC (rev 14985)
@@ -499,7 +499,7 @@
                        }
                }

-               public java.util.Enumeration children() {
+               public Enumeration children() {
                        synchronized(children) {
                                return children.elements();
                        }
@@ -1056,12 +1056,16 @@
                        return null;
                }

-               /* we first check if it has a child */
+               /* we first check if it has an unread child */

-               if (node.getChildCount() > 0) {
-                       return ((MessageNode)node.getChildAt(0)).getMessage();
+               for (Enumeration e = node.children();
+                    e.hasMoreElements();) {
+                       MessageNode child = (MessageNode)e.nextElement();
+                       if (!child.getMessage().isRead())
+                               return child.getMessage();
                }

+
                /* if it has no child, we check if it has a brother (or if its 
parents
                 * have brothers, etc)
                 */
@@ -1081,11 +1085,12 @@

                        int i = parent.getIndex(node);

-                       if (i < parent.getChildCount()-1) {
-                               /* then it has a brother */
-                               return 
((MessageNode)parent.getChildAt(i+1)).getMessage();
+                       for (i++ ; i < parent.getChildCount() ; i++) {
+                               MessageNode child = 
(MessageNode)parent.getChildAt(i);
+
+                               if (!child.getMessage().isRead())
+                                       return child.getMessage();
                        }
-
                }

                return null;


Reply via email to