Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.282
diff -u -p -r1.282 menu.inc
--- includes/menu.inc	10 Jul 2008 10:58:01 -0000	1.282
+++ includes/menu.inc	20 Aug 2008 03:35:01 -0000
@@ -1537,13 +1537,13 @@ function menu_set_active_item($path) {
 /**
  * Set (or get) the active trail for the current page - the path to root in the menu tree.
  */
-function menu_set_active_trail($new_trail = NULL) {
+function menu_set_active_trail($new_trail = NULL, $reset = FALSE) {
   static $trail;
 
   if (isset($new_trail)) {
     $trail = $new_trail;
   }
-  elseif (!isset($trail)) {
+  elseif (!isset($trail) || $reset) {
     $trail = array();
     $trail[] = array('title' => t('Home'), 'href' => '<front>', 'localized_options' => array(), 'type' => 0);
     $item = menu_get_item();
@@ -1619,6 +1619,17 @@ function menu_get_active_breadcrumb() {
   if ($item && $item['access']) {
     $active_trail = menu_get_active_trail();
 
+    // If the active trail consist only of "home" and the "active item", check
+    // the primary links menu for a better trail.
+    if (count($active_trail) < 3) {
+      $active_menu = menu_get_active_menu_name();
+      menu_set_active_menu_name(variable_get('menu_primary_links_source', 'primary-links'));
+      menu_set_active_trail(NULL, TRUE);
+      $active_trail = menu_get_active_trail();
+      // Reset the previous active menu.
+      menu_set_active_menu_name($active_menu);
+      menu_set_active_trail(NULL, TRUE);
+    }
     foreach ($active_trail as $parent) {
       $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);
     }
