Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat: check chat status before start a search
Browse files Browse the repository at this point in the history
  • Loading branch information
TriKriSta authored and anthonybilinski committed Aug 28, 2019
1 parent acb91ed commit ce57092
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/widget/form/genericchatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ce57092

Please sign in to comment.