Skip to content

Commit

Permalink
WebEngine-specific: add/expand TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vedgy committed Sep 17, 2022
1 parent 1e9e5f5 commit 372e0e3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,8 @@ QString ArticleView::toHtml()
return ui.definition->page()->mainFrame()->toHtml();
#else
// TODO (Qt WebEngine): port this function and its uses to asynchronous QWebEnginePage::toHtml().
// This function is called only from MainWindow::on_saveArticle_triggered(). The Save Article feature can be
// implemented differently using QWebEnginePage::save(). Compare the results of the two approaches and select one.
return QString();
#endif
}
Expand Down
10 changes: 10 additions & 0 deletions articlewebpage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ bool ArticleWebPage::acceptNavigationRequest( QUrl const & url, NavigationType t
Q_UNUSED( isMainFrame )
if( type != NavigationTypeLinkClicked )
return true;

// TODO (Qt WebEngine): when a link that does not load a new page is clicked before the current page is fully loaded,
// the view stops updating because of QTBUG-106580. And then only the beginning of the last displayed article may be
// visible, a few bottommost articles may be altogether missing from the page. A possible workaround is to replace the
// anchor element (<a>) of each such link with a button (possibly image button) and pass the link's URL to ArticleView
// via Qt WebChannel: onclick="gdArticleView.onJsLinkClicked('<url>');". Such a replacement is very time-consuming for
// a workaround: each audio, video, other resource or external link in every dictionary format has to be replaced.
// One more downside of this workaround is that the buttons won't work in saved articles (this in turn can be worked
// around by falling back to assigning the URL to window.location.href if gdArticleView is falsy in a new
// gdLinkClicked(url) helper function).
emit linkClicked( url );
return false;
}
Expand Down
14 changes: 14 additions & 0 deletions mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ void setupWebEngineProfile( QWebEngineProfile & webEngineProfile, ArticleNetwork
// TODO (Qt WebEngine): should the maximum size of the HTTP cache and whether
// it is cleared on exit be configurable similarly to the network cache?

// TODO (Qt WebEngine): in the Qt WebEngine version articleNetMgr's cache is useful only for downloaded files,
// because the page itself is stored separately in the Qt WebEngine profile's cache. In the interest of
// reusing the Qt WebEngine profile's cache for both loading pages and downloading files,
// Dictionary::WebMultimediaDownload could call QWebEnginePage::download() instead of
// QNetworkAccessManager::get() to retrieve files from network. articleNetMgr's cache would become
// practically useless then and could be restricted to the Qt WebKit version along with its configuration UI.

// TODO (Qt WebEngine): should the configuration UI allow disabling persistent cookies?
// Cookies are never stored on disk in the Qt WebKit version according to the documentation for QNetworkCookieJar:
// > QNetworkCookieJar does not implement permanent storage: it only keeps the cookies in memory. Once the
// > QNetworkCookieJar object is deleted, all cookies it held will be discarded as well. If you want to save the
// > cookies, you should derive from this class and implement the saving to disk to your own storage format.
// Should the persistent cookies be disabled by default in the Qt WebEngine version too?

articleNetMgr.setStreamingDeviceWorkarounds( computeStreamingDeviceWorkarounds( webEngineProfile ) );

auto * const handler = new ArticleUrlSchemeHandler( articleNetMgr );
Expand Down

0 comments on commit 372e0e3

Please sign in to comment.