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

feat: check chat status before start a search

This commit is contained in:
TriKriSta 2019-08-21 15:30:17 +03:00 committed by Anthony Bilinski
parent acb91ed731
commit ce570927b1
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -940,7 +940,17 @@ void GenericChatForm::onSearchTriggered()
void GenericChatForm::searchInBegin(const QString& phrase, const ParameterSearch& parameter)
{
disableSearchText();
if (phrase.isEmpty()) {
disableSearchText();
return;
}
if (chatLog.getNextIdx().get() == messages.rbegin()->first.get() + 1) {
disableSearchText();
} else {
goToCurrentDate();
}
if (!parameter.time.isNull()) {
LoadHistoryDialog::LoadType type = (parameter.period == PeriodSearch::BeforeDate)
@ -992,7 +1002,7 @@ void GenericChatForm::onSearchUp(const QString& phrase, const ParameterSearch& p
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();