Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kitemlistcontroller.cpp
Show First 20 Lines • Show All 466 Lines • ▼ Show 20 Line(s) | 214 | { | |||
---|---|---|---|---|---|
467 | return true; | 467 | return true; | ||
468 | } | 468 | } | ||
469 | 469 | | |||
470 | void KItemListController::slotChangeCurrentItem(const QString& text, bool searchFromNextItem) | 470 | void KItemListController::slotChangeCurrentItem(const QString& text, bool searchFromNextItem) | ||
471 | { | 471 | { | ||
472 | if (!m_model || m_model->count() == 0) { | 472 | if (!m_model || m_model->count() == 0) { | ||
473 | return; | 473 | return; | ||
474 | } | 474 | } | ||
475 | const int currentIndex = m_selectionManager->currentItem(); | | |||
476 | int index; | 475 | int index; | ||
477 | if (searchFromNextItem) { | 476 | if (searchFromNextItem) { | ||
477 | const int currentIndex = m_selectionManager->currentItem(); | ||||
478 | index = m_model->indexForKeyboardSearch(text, (currentIndex + 1) % m_model->count()); | 478 | index = m_model->indexForKeyboardSearch(text, (currentIndex + 1) % m_model->count()); | ||
479 | } else { | 479 | } else { | ||
480 | index = m_model->indexForKeyboardSearch(text, currentIndex); | 480 | index = m_model->indexForKeyboardSearch(text, 0); | ||
elvisangelaccio: Can you explain the reason for this change? | |||||
This function way bugged : meven: This function way bugged :
The two branches of `if (searchFromNextItem)` both looked for the… | |||||
I see. Please put this information in the commit message because it is valuable and it shouldn't be lost in a phabricator inline comment. elvisangelaccio: I see. Please put this information in the commit message because it is valuable and it… | |||||
481 | } | 481 | } | ||
482 | if (index >= 0) { | 482 | if (index >= 0) { | ||
483 | m_selectionManager->setCurrentItem(index); | 483 | m_selectionManager->setCurrentItem(index); | ||
484 | 484 | | |||
485 | if (m_selectionBehavior != NoSelection) { | 485 | if (m_selectionBehavior != NoSelection) { | ||
486 | m_selectionManager->clearSelection(); | 486 | m_selectionManager->replaceSelection(index); | ||
487 | m_selectionManager->setSelected(index, 1); | | |||
488 | m_selectionManager->beginAnchoredSelection(index); | 487 | m_selectionManager->beginAnchoredSelection(index); | ||
489 | } | 488 | } | ||
490 | 489 | | |||
491 | m_view->scrollToItem(index); | 490 | m_view->scrollToItem(index); | ||
492 | } | 491 | } | ||
493 | } | 492 | } | ||
494 | 493 | | |||
495 | void KItemListController::slotAutoActivationTimeout() | 494 | void KItemListController::slotAutoActivationTimeout() | ||
▲ Show 20 Lines • Show All 860 Lines • Show Last 20 Lines |
Can you explain the reason for this change?