Index: src/index.cpp
===================================================================
--- src/index.cpp	(revision 820)
+++ src/index.cpp	(working copy)
@@ -313,6 +313,7 @@
   if (hasMembers || numClasses>0)
   {
     Doxygen::indexList.incContentsDepth();
+    bool added = false;
     QListIterator<LayoutDocEntry> eli(LayoutDocManager::instance().docEntries(part));
     LayoutDocEntry *lde;
     for (eli.toFirst();(lde=eli.current());++eli)
@@ -335,16 +336,22 @@
               {
                 Doxygen::indexList.addContentsItem(isDir,
                   md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex);
+                added = true;
               }
               else // inherited member
               {
                 Doxygen::indexList.addContentsItem(isDir,
                   md->name(),def->getReference(),def->getOutputFileBase(),md->anchor(),FALSE,addToIndex);
+                added = true;
               }
             }
             if (isDir)
             {
-              Doxygen::indexList.incContentsDepth();
+              bool dec = added;
+              if( dec ) {
+                // Do not increase if it is the first call
+                Doxygen::indexList.incContentsDepth();
+              }
               MemberListIterator emli(*enumList);
               MemberDef *emd;
               for (emli.toFirst();(emd=emli.current());++emli)
@@ -353,14 +360,18 @@
                 {
                   Doxygen::indexList.addContentsItem(FALSE,
                       emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex);
+                  added = true;
                 }
                 else // inherited member
                 {
                   Doxygen::indexList.addContentsItem(FALSE,
                       emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex);
+                  added = true;
                 }
               }
-              Doxygen::indexList.decContentsDepth();
+              if( dec ) {
+                Doxygen::indexList.decContentsDepth();
+              }
             }
           }
         }
@@ -381,6 +392,7 @@
               bool isNestedClass = def->definitionType()==Definition::TypeClass;
               addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(FALSE),cd->anchor(),
                                 addToIndex && isNestedClass,preventSeparateIndex);
+              added = true;
             }
           }
         }
