CVS commit by dymo: React on addedSourceInfo() signal and update function navigation combo items when code changes. M +1 -0 classviewpart.cpp 1.62 M +29 -8 navigator.cpp 1.2 --- kdevelop/parts/classview/classviewpart.cpp #1.61:1.62 @@ -127,4 +127,5 @@ void ClassViewPart::setupActions( ) m_functionsnav = new KListViewAction( new KComboView(true, 150, 0, "m_functionsnav_combo"), i18n("Functions Navigation"), 0, 0, 0, actionCollection(), "functionsnav_combo", true ); connect(m_functionsnav->view(), SIGNAL(activated(QListViewItem*)), navigator, SLOT(selectFunctionNav(QListViewItem*))); +// m_functionsnav->view()->setEditable(false); connect(m_functionsnav->view(), SIGNAL(focusGranted()), navigator, SLOT(functionNavFocused())); connect(m_functionsnav->view(), SIGNAL(focusLost()), navigator, SLOT(functionNavUnFocused())); --- kdevelop/parts/classview/navigator.cpp #1.1:1.2 @@ -262,12 +262,33 @@ void Navigator::refreshNavBars(const QSt QString fullName = fullFunctionDefinitionName(*it); + if (clear || !functionNavDefs[fullName]) + { FunctionNavItem *item = new FunctionNavItem(m_part, m_part->m_functionsnav->view()->listView(), fullName, FunctionNavItem::Definition); functionNavDefs[fullName] = item; m_part->m_functionsnav->view()->addItem(item); + } //remove unnecessary items with function declarations for which a definition item was created if (functionNavDecls[fullName]) + { m_part->m_functionsnav->view()->removeItem(functionNavDecls[fullName]); + functionNavDecls.remove(fullName); + } + + toLeave << fullName; + } + + kdDebug() << "leave list: " << toLeave << endl; + //remove items not in toLeave list + for (QMap::iterator it = functionNavDefs.begin(); + it != functionNavDefs.end(); ++it) + { + if (!toLeave.contains(it.key())) + { + if (it.data()) + m_part->m_functionsnav->view()->removeItem(it.data()); + functionNavDefs.remove(it); + } } } @@ -284,5 +305,5 @@ void Navigator::addFile(const QString & { kdDebug() << "Navigator::addFile, processing active file" << endl; - // refreshNavBars(m_part->m_activeFileName, false); + refreshNavBars(m_part->m_activeFileName, false); } } @@ -470,6 +491,6 @@ QString Navigator::fullFunctionDefinitio if (!funName.isEmpty()) funName += "."; - funName = m_part->languageSupport()->formatClassName(funName); funName += m_part->languageSupport()->formatModelItem(fun, true); + funName = m_part->languageSupport()->formatClassName(funName); return funName; @@ -482,6 +503,6 @@ QString Navigator::fullFunctionDeclarati if (!funName.isEmpty()) funName += "."; - funName = m_part->languageSupport()->formatClassName(funName); funName += m_part->languageSupport()->formatModelItem(fun, true); + funName = m_part->languageSupport()->formatClassName(funName); return funName;