Commit 31bdc626 authored by Laurent Montel's avatar Laurent Montel 😁

Fix Bug 369146 - Reading email advancing with "space" doesn't jump to next...

Fix Bug 369146 - Reading email advancing with "space" doesn't jump to next unread at end of current email

CCBUG: 369146
(cherry picked from commit 6b867463)
parent b060f7a9
......@@ -83,6 +83,7 @@ void Viewer::initialize()
connect(d_ptr, &ViewerPrivate::changeDisplayMail, this, &Viewer::slotChangeDisplayMail);
connect(d_ptr, &ViewerPrivate::moveMessageToTrash, this, &Viewer::moveMessageToTrash);
connect(d_ptr, &ViewerPrivate::executeMailAction, this, &Viewer::executeMailAction);
connect(d_ptr, &ViewerPrivate::pageIsScrolledToBottom, this, &Viewer::pageIsScrolledToBottom);
setMessage(KMime::Message::Ptr(), MimeTreeParser::Delayed);
}
......@@ -217,10 +218,10 @@ void Viewer::slotScrollDown()
d->mViewer->scrollDown(10);
}
bool Viewer::atBottom() const
void Viewer::atBottom()
{
Q_D(const Viewer);
return d->mViewer->isScrolledToBottom();
d->mViewer->isScrolledToBottom();
}
void Viewer::slotJumpDown()
......
......@@ -235,7 +235,7 @@ public:
void enableMessageDisplay();
/** Returns true if the message view is scrolled to the bottom. */
bool atBottom() const;
void atBottom();
bool isFixedFont() const;
void setUseFixedFont(bool useFixedFont);
......@@ -325,6 +325,7 @@ public:
void runJavaScript(const QString &code);
Q_SIGNALS:
void moveMessageToTrash();
void pageIsScrolledToBottom(bool);
void executeMailAction(MessageViewer::Viewer::MailAction type);
/**
......
......@@ -1059,6 +1059,7 @@ void ViewerPrivate::initHtmlWidget()
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this, &ViewerPrivate::moveMessageToTrash);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::addToWhiteList, this, &ViewerPrivate::slotAddToWhiteList);
connect(mViewer, &MailWebEngineView::pageIsScrolledToBottom, this, &ViewerPrivate::pageIsScrolledToBottom);
}
bool ViewerPrivate::eventFilter(QObject *, QEvent *e)
......
......@@ -572,6 +572,7 @@ Q_SIGNALS:
void changeDisplayMail(Viewer::DisplayFormatMessage, bool);
void moveMessageToTrash();
void executeMailAction(MessageViewer::Viewer::MailAction type);
void pageIsScrolledToBottom(bool);
private:
QString attachmentInjectionHtml();
QString recipientsQuickListLinkHtml(const QString &);
......
......@@ -248,12 +248,15 @@ void MailWebEngineView::hideAccessKeys()
d->mWebViewAccessKey->hideAccessKeys();
}
bool MailWebEngineView::isScrolledToBottom() const
void MailWebEngineView::isScrolledToBottom()
{
qDebug() << "bool MailWebEngineView::isScrolledToBottom() const not implemented";
//Convert as async
//TODO '(window.innerHeight + window.scrollY) >= document.body.offsetHeight)'
return false;
#if QT_VERSION >= 0x050700
page()->runJavaScript(WebEngineViewer::WebEngineScript::isScrolledToBottom(),
WebEngineViewer::WebEngineManageScript::scriptWordId(),
invoke(this, &MailWebEngineView::handleIsScrolledToBottom));
#else
page()->runJavaScript(WebEngineViewer::WebEngineScript::isScrolledToBottom(), invoke(this, &MailWebEngineView::handleIsScrolledToBottom));
#endif
}
void MailWebEngineView::setElementByIdVisible(const QString &id, bool visible)
......@@ -283,6 +286,15 @@ void MailWebEngineView::scrollToAnchor(const QString &anchor)
#endif
}
void MailWebEngineView::handleIsScrolledToBottom(const QVariant &result)
{
bool scrolledToBottomResult = false;
if (result.isValid()) {
scrolledToBottomResult = result.toBool();
}
Q_EMIT pageIsScrolledToBottom(scrolledToBottomResult);
}
void MailWebEngineView::handleScrollToAnchor(const QVariant &result)
{
if (result.isValid()) {
......
......@@ -46,7 +46,7 @@ public:
void saveMainFrameScreenshotInFile(const QString &filename);
void showAccessKeys();
void hideAccessKeys();
bool isScrolledToBottom() const;
void isScrolledToBottom();
void setElementByIdVisible(const QString &id, bool visible);
void removeAttachmentMarking(const QString &id);
......@@ -93,9 +93,11 @@ Q_SIGNALS:
/// @param url if an URL was under the cursor, this parameter contains it. Otherwise empty
/// @param point position where the click happened, in local coordinates
void popupMenu(const WebEngineViewer::WebHitTestResult &result);
void pageIsScrolledToBottom(bool);
private Q_SLOTS:
void handleScrollToAnchor(const QVariant &result);
void handleIsScrolledToBottom(const QVariant &result);
void slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result);
void slotLoadFinished();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment