[dev] New IMP Summary Option

Rick Emery rick at emery.homelinux.net
Mon Dec 8 17:07:09 PST 2003


Quoting Chuck Hagenbuch <chuck at horde.org>:

> Quoting Rick Emery <rick at emery.homelinux.net>:
>
> > P.S. Not to stir up a hornets nest, but should the text about new messages
> be
> > tied in to the preference to display a pop-up for new messages? I'm
> thinking
> > that, if I elect not to be notified that there are new messages, I
> likewise
> > don't care to be notified if there *aren't* new messages. In which case, a
> > simple line advertising that there are no "unseen" messages might be
> necessary
> > (like kronolith, nag, and mnemo display if their blocks are empty). Just
> > thinking out loud :-)
>
> That makes sense to me.
>
> -chuck

OK, here's a patch :-)

These changes only apply if the "Only display folders with unread messages in
them" option is selected in the imp summary block preferences.

If there are no unseen messages (which means, by definition, that there are no
new messages), then "No folders contain unseen messages" is displayed in the
block.

If there are unseen messages, the block is displayed as it is currently (with
the folder names and unseen message count). However, if the imp preference to
display a pop-up for new mail is enabled, then "No folders contain new
messages" will be displayed below the folder list. If the preference is not
enabled, the last line is not displayed (only the folder list with message
counts).

Does this make sense? Does it suit everybody?

--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
 with your eyes turned skyward, for there you have been, and there
 you will always long to return"
                                              -- Leonardo Da Vinci
-------------- next part --------------
Index: summary.php
===================================================================
RCS file: /repository/imp/lib/Block/summary.php,v
retrieving revision 1.22
diff -u -r1.22 summary.php
--- summary.php	8 Dec 2003 17:35:50 -0000	1.22
+++ summary.php	8 Dec 2003 23:34:27 -0000
@@ -75,6 +75,7 @@
 
             $serverstring = IMP::serverString();
             $newmsgs = array();
+            $anyUnseen = false;
             foreach ($folders as $folder => $true) {
                 if (($folder == 'INBOX') ||
                     ($_SESSION['imp']['base_protocol'] != 'pop3')) {
@@ -95,6 +96,7 @@
                            $html .= '<tr style="cursor:pointer" class="text" onmouseover="className=\'text-hi\';" onmouseout="className=\'text\';" onclick="self.location=\'' . $url . '\'"><td>';
                            if (!empty($sts->unseen)) {
                                $html .= '<b>';
+                               $anyUnseen = true;
                            }
                            $html .= Horde::link($url, IMP::displayFolder($folder)) . IMP::displayFolder($folder) . '</a>';
                            if (!empty($sts->unseen)) {
@@ -141,7 +143,13 @@
             if (count($folders) == 0) {
                 $html .= _("No folders are being checked for new mail.");
             } else {
-                $html .= _("No folders with new messages.");
+                if (!$anyUnseen) {
+                    $html .= _("No folders with unseen messages.");
+                } else {
+                    if ($prefs->getValue('nav_popup')) {
+                        $html .= _("No folders with new messages.");
+                    }
+                }
             }
         }
 


More information about the dev mailing list