1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

revert(chatlog): "fix: data validation during the search"

This reverts commit acb91ed731.
This commit is contained in:
Anthony Bilinski 2020-04-04 22:46:03 -07:00
parent 6395ce3aae
commit 35c5e77a8a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 7 additions and 20 deletions

View File

@ -158,7 +158,6 @@ SearchResult ChatHistory::searchBackward(SearchPos startIdx, const QString& phra
history->getDateWhereFindPhrase(f.getPublicKey().toString(), earliestMessageDate, phrase, history->getDateWhereFindPhrase(f.getPublicKey().toString(), earliestMessageDate, phrase,
parameter); parameter);
if (dateWherePhraseFound.isValid()) {
auto loadIdx = history->getNumMessagesForFriendBeforeDate(f.getPublicKey(), dateWherePhraseFound); auto loadIdx = history->getNumMessagesForFriendBeforeDate(f.getPublicKey(), dateWherePhraseFound);
loadHistoryIntoSessionChatLog(ChatLogIdx(loadIdx)); loadHistoryIntoSessionChatLog(ChatLogIdx(loadIdx));
@ -168,11 +167,6 @@ SearchResult ChatHistory::searchBackward(SearchPos startIdx, const QString& phra
return sessionChatLog.searchBackward(startIdx, phrase, parameter); return sessionChatLog.searchBackward(startIdx, phrase, parameter);
} }
SearchResult ret;
ret.found = false;
return ret;
}
ChatLogIdx ChatHistory::getFirstIdx() const ChatLogIdx ChatHistory::getFirstIdx() const
{ {
if (canUseHistory()) { if (canUseHistory()) {

View File

@ -987,12 +987,6 @@ void GenericChatForm::onSearchUp(const QString& phrase, const ParameterSearch& p
void GenericChatForm::onSearchDown(const QString& phrase, const ParameterSearch& parameter) void GenericChatForm::onSearchDown(const QString& phrase, const ParameterSearch& parameter)
{ {
auto result = chatLog.searchForward(searchPos, phrase, parameter); auto result = chatLog.searchForward(searchPos, phrase, parameter);
if (result.found && result.pos.logIdx.get() > messages.end()->first.get()) {
const auto dt = chatLog.at(result.pos.logIdx).getTimestamp();
loadHistory(dt, LoadHistoryDialog::from);
}
handleSearchResult(result, SearchDirection::Down); handleSearchResult(result, SearchDirection::Down);
} }
@ -1014,7 +1008,6 @@ void GenericChatForm::handleSearchResult(SearchResult result, SearchDirection di
chatWidget->scrollToLine(msg); chatWidget->scrollToLine(msg);
auto text = qobject_cast<Text*>(msg->getContent(1)); auto text = qobject_cast<Text*>(msg->getContent(1));
text->visibilityChanged(true);
text->selectText(result.exp, std::make_pair(result.start, result.len)); text->selectText(result.exp, std::make_pair(result.start, result.len));
}); });
} }