| 205 | } |
| 206 | |
| 207 | void DocumentationView::showDocumentation(const IDocumentation::Ptr& doc) |
| 208 | { |
| 209 | qCDebug(DOCUMENTATION) << "showing" << doc->name(); |
| 210 | |
| 211 | mBack->setEnabled(!mHistory.isEmpty()); |
| 212 | mForward->setEnabled(false); |
| 213 | |
| 214 | // clear all history following the current item, unless we're already |
| 215 | // at the end (otherwise this code crashes when history is empty, which |
| 216 | // happens when addHistory is first called on startup to add the |
| 217 | // homepage) |
| 218 | if (mCurrent+1 < mHistory.end()) { |
| 219 | mHistory.erase(mCurrent+1, mHistory.end()); |
| 220 | } |
| 221 | |
| 222 | mHistory.append(doc); |
| 223 | mCurrent = mHistory.end()-1; |
| 224 | |
| 225 | // NOTE: we assume an existing widget was used to navigate somewhere |
| 226 | // but this history entry actually contains the new info for the |
| 227 | // title... this is ugly and should be refactored somehow |
| 228 | if (mIdentifiers->completer()->model() == (*mCurrent)->provider()->indexModel()) { |
| 229 | mIdentifiers->setText((*mCurrent)->name()); |
| 230 | } |
| 231 | |
| 232 | updateView(); |
| 233 | } |
| 234 | |
| 235 | void DocumentationView::emptyHistory() |
| 236 | { |
nothing calls this directly
no test coverage detected