summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-05 06:55:35 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-05 06:55:35 (GMT)
commit6b8674631b71e7ebb67ad7cfec3bf0aa4ea640de (patch)
tree3336655ad1fd80679472b3b828ce2d926c917ea9
parentf9cd0bbae68f61b1be24ce809c318bbf6780f468 (diff)
Fix Bug 369146 - Reading email advancing with "space" doesn't jump to next unread at end of current email
CCBUG: 369146
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/viewer/viewer.cpp5
-rw-r--r--messageviewer/src/viewer/viewer.h3
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp1
-rw-r--r--messageviewer/src/viewer/viewer_p.h1
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.cpp22
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.h4
7 files changed, 26 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45a4682..cff037b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.68")
+set(PIM_VERSION "5.3.69")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/messageviewer/src/viewer/viewer.cpp b/messageviewer/src/viewer/viewer.cpp
index 4ca33cc..74a325c 100644
--- a/messageviewer/src/viewer/viewer.cpp
+++ b/messageviewer/src/viewer/viewer.cpp
@@ -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()
diff --git a/messageviewer/src/viewer/viewer.h b/messageviewer/src/viewer/viewer.h
index a8d4750..5d4b278 100644
--- a/messageviewer/src/viewer/viewer.h
+++ b/messageviewer/src/viewer/viewer.h
@@ -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);
@@ -326,6 +326,7 @@ public:
void setPrintElementBackground(bool printElementBackground);
Q_SIGNALS:
void moveMessageToTrash();
+ void pageIsScrolledToBottom(bool);
void executeMailAction(MessageViewer::Viewer::MailAction type);
/**
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 6ba9bea..c8ee44f 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -1077,6 +1077,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)
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 8bed526..0028421 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -575,6 +575,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 &);
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
index de713ec..916284c 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
@@ -247,16 +247,15 @@ void MailWebEngineView::hideAccessKeys()
d->mWebViewAccessKey->hideAccessKeys();
}
-bool MailWebEngineView::isScrolledToBottom() const
+void MailWebEngineView::isScrolledToBottom()
{
#if QT_VERSION >= 0x050700
- qDebug() << " page position " << page()->scrollPosition().y();
- qDebug() << " content size " << page()->contentsSize().height();
+ page()->runJavaScript(WebEngineViewer::WebEngineScript::isScrolledToBottom(),
+ WebEngineViewer::WebEngineManageScript::scriptWordId(),
+ invoke(this, &MailWebEngineView::handleIsScrolledToBottom));
+#else
+ page()->runJavaScript(WebEngineViewer::WebEngineScript::isScrolledToBottom(), invoke(this, &MailWebEngineView::handleIsScrolledToBottom));
#endif
- qDebug() << "bool MailWebEngineView::isScrolledToBottom() const not implemented";
- //Convert as async
- //TODO '(window.innerHeight + window.scrollY) >= document.body.offsetHeight)'
- return false;
}
void MailWebEngineView::setElementByIdVisible(const QString &id, bool visible)
@@ -286,6 +285,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()) {
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.h b/messageviewer/src/viewer/webengine/mailwebengineview.h
index 11f9102..8c8d65b 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.h
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.h
@@ -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);
@@ -96,9 +96,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();