Commit a122fc28 authored by Laurent Montel's avatar Laurent Montel 😁

Start to prepare to save/restore position when we add/remove article

parent a583df81
......@@ -56,6 +56,7 @@ using namespace Akregator;
ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *parent)
: WebEngineViewer::WebEngineView(parent),
mActionCollection(ac),
mCurrentPosition(0),
mLastButtonClicked(LeftButton),
mViewerPluginToolManager(Q_NULLPTR)
{
......@@ -343,6 +344,16 @@ void ArticleViewerWebEngine::setArticleAction(ArticleViewerWebEngine::ArticleAct
Q_EMIT articleAction(type, articleId, feed);
}
void ArticleViewerWebEngine::saveCurrentPosition()
{
//TODO
}
void ArticleViewerWebEngine::restoreCurrentPosition()
{
//TODO
}
void ArticleViewerWebEngine::forwardMouseReleaseEvent(QMouseEvent *event)
{
if (event->button() & Qt::RightButton) {
......
......@@ -68,6 +68,8 @@ public:
void disableIntroduction();
void setArticleAction(ArticleViewerWebEngine::ArticleAction type, const QString &articleId, const QString &feed);
void saveCurrentPosition();
void restoreCurrentPosition();
void createViewerPluginToolManager(KActionCollection *ac, QWidget *parent);
......@@ -132,6 +134,7 @@ protected:
QList<QAction *> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
WebEngineViewer::NetworkAccessManagerWebEngine *mNetworkAccessManager;
private:
qreal mCurrentPosition;
MousePressedButtonType mLastButtonClicked;
MessageViewer::ViewerPluginToolManager *mViewerPluginToolManager;
WebEngineViewer::WebEngineAccessKey *mWebEngineViewAccessKey;
......
......@@ -98,3 +98,13 @@ void ArticleViewerWebEngineWidgetNg::slotSpeakText()
const QString text = mArticleViewerNg->selectedText();
mTextToSpeechWidget->say(text);
}
void ArticleViewerWebEngineWidgetNg::saveCurrentPosition()
{
mArticleViewerNg->saveCurrentPosition();
}
void ArticleViewerWebEngineWidgetNg::restoreCurrentPosition()
{
mArticleViewerNg->restoreCurrentPosition();
}
......@@ -51,6 +51,8 @@ public:
ArticleViewerWebEngine *articleViewerNg() const;
void saveCurrentPosition();
void restoreCurrentPosition();
public Q_SLOTS:
void slotSpeakText();
void slotFind();
......
......@@ -232,6 +232,7 @@ void ArticleViewerWidget::slotUpdateCombinedView()
return slotClear();
}
m_articleViewerWidgetNg->saveCurrentPosition();
QString text;
int num = 0;
......@@ -258,6 +259,7 @@ void ArticleViewerWidget::slotUpdateCombinedView()
qCDebug(AKREGATOR_LOG) << "Combined view rendering: (" << num << " articles):" << "generating HTML:" << spent.elapsed() << "ms";
renderContent(text);
qCDebug(AKREGATOR_LOG) << "HTML rendering:" << spent.elapsed() << "ms";
m_articleViewerWidgetNg->restoreCurrentPosition();
}
void ArticleViewerWidget::slotArticlesUpdated(TreeNode * /*node*/, const QVector<Article> & /*list*/)
......
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