From be2a0abbc8619e8ef52e48f781d7b6a7665ac05c Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Jun 2016 13:08:46 +0300 Subject: [PATCH] Fixed checkboxes in boxes. Clearing cloud draft on inline result send. No history to down if unread appear in an inactive opened conversation. --- Telegram/Resources/basic.style | 4 ++-- Telegram/SourceFiles/history.cpp | 1 - Telegram/SourceFiles/historywidget.cpp | 27 ++++++++++++++++++-------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index e938985e9..ab50abf44 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -250,9 +250,9 @@ defaultCheckbox: Checkbox { font: normalFont; duration: 120; } -defaultBoxCheckbox: Checkbox { +defaultBoxCheckbox: Checkbox(defaultCheckbox) { width: -46px; - textPosition: point(34px, 0px); + textPosition: point(34px, 1px); font: boxTextFont; } defaultRadiobutton: Radiobutton { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 161a2fdbc..67f99df64 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1149,7 +1149,6 @@ void History::newItemAdded(HistoryItem *item) { if (!item->unread()) { outboxRead(item); } - item->history()->clearCloudDraft(); } else if (item->unread()) { bool skip = false; if (!isChannel() || peer->asChannel()->amIn()) { diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 49cfa7ad4..06e23174a 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -7017,7 +7017,16 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { } void HistoryWidget::updateToEndVisibility() { - auto isToEndVisible = [this]() { + auto haveUnreadBelowBottom = [this](History *history) { + if (!_list || !history || history->unreadCount() <= 0) { + return false; + } + if (!history->showFrom || history->showFrom->detached()) { + return false; + } + return (_list->itemTop(history->showFrom) >= _scroll.scrollTop() + _scroll.height()); + }; + auto isToEndVisible = [this, &haveUnreadBelowBottom]() { if (!_history || _a_show.animating() || _firstLoadRequest) { return false; } @@ -7027,7 +7036,7 @@ void HistoryWidget::updateToEndVisibility() { if (_scroll.scrollTop() + st::wndMinHeight < _scroll.scrollTopMax()) { return true; } - if (_history->unreadCount() > 0 || (_migrated && _migrated->unreadCount() > 0)) { + if (haveUnreadBelowBottom(_history) || haveUnreadBelowBottom(_migrated)) { return true; } return false; @@ -7159,9 +7168,10 @@ void HistoryWidget::onInlineResultSend(InlineBots::Result *result, UserData *bot App::historyRegRandom(randomId, newId); clearFieldText(); - _saveDraftText = true; - _saveDraftStart = getms(); - onDraftSave(); + //_saveDraftText = true; + //_saveDraftStart = getms(); + //onDraftSave(); + onCloudDraftSave(); // won't be needed if SendInlineBotResult will clear the cloud draft RecentInlineBots &bots(cRefRecentInlineBots()); int32 index = bots.indexOf(bot); @@ -7332,9 +7342,10 @@ void HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti if (_fieldAutocomplete->stickersShown()) { clearFieldText(); - _saveDraftText = true; - _saveDraftStart = getms(); - onDraftSave(); + //_saveDraftText = true; + //_saveDraftStart = getms(); + //onDraftSave(); + onCloudDraftSave(); // won't be needed if SendInlineBotResult will clear the cloud draft } if (!_fieldAutocomplete->isHidden()) _fieldAutocomplete->hideStart();