-
-
Notifications
You must be signed in to change notification settings - Fork 153
Add options for downloading multimedia content #1424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add options for downloading multimedia content #1424
Conversation
|
Qt6 builds are failing, will look into it. |
|
Tested for qt6 also. |
c69ef6b to
454bcee
Compare
|
@vighnesh-sawant Thank you very much for this PR. I will test it this evening! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the context menu implementation in the web view by replacing the custom-built context menu with Qt WebEngine's standard context menu functionality, while adding appropriate icons and removing media control options.
Key Changes:
- Replaced custom back/forward actions with Qt WebEngine's standard context menu
- Added version-specific handling for Qt 5 vs Qt 6 API differences
- Set custom icons for back/forward actions and removed media control options
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/webview.cpp
Outdated
| #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) | ||
| QMenu* menu = QWebEngineView::createStandardContextMenu(); | ||
| #else | ||
| QMenu* menu = page()->createStandardContextMenu(); | ||
| #endif | ||
| page()->action(QWebEnginePage::Back)->setIcon(app->getAction(KiwixApp::HistoryBackAction)->icon()); | ||
| page()->action(QWebEnginePage::Forward)->setIcon(app->getAction(KiwixApp::HistoryForwardAction)->icon()); | ||
| if (page()->action(QWebEnginePage::ToggleMediaControls)) { | ||
| menu->removeAction(page()->action(QWebEnginePage::ToggleMediaControls)); | ||
| } |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation style here is inconsistent with the rest of the file. In this file, preprocessor directives like #if are not indented (see lines 98, 104, 312, 317). Additionally, the code within the #if blocks uses 2-space indentation instead of the 4-space indentation used elsewhere.
Please adjust to match the file's style:
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMenu* menu = QWebEngineView::createStandardContextMenu();
#else
QMenu* menu = page()->createStandardContextMenu();
#endif
page()->action(QWebEnginePage::Back)->setIcon(app->getAction(KiwixApp::HistoryBackAction)->icon());
page()->action(QWebEnginePage::Forward)->setIcon(app->getAction(KiwixApp::HistoryForwardAction)->icon());
if (page()->action(QWebEnginePage::ToggleMediaControls)) {
menu->removeAction(page()->action(QWebEnginePage::ToggleMediaControls));
}
src/webview.cpp
Outdated
| QMenu* menu = QWebEngineView::createStandardContextMenu(); | ||
| #else | ||
| QMenu* menu = page()->createStandardContextMenu(); | ||
| #endif |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createStandardContextMenu() functions can return nullptr if there is no context menu available. You should add a null check after creating the menu to prevent potential crashes when accessing menu in subsequent lines.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMenu* menu = QWebEngineView::createStandardContextMenu();
#else
QMenu* menu = page()->createStandardContextMenu();
#endif
if (!menu) {
menu = new QMenu(this);
}| #endif | |
| #endif | |
| if (!menu) { | |
| menu = new QMenu(this); | |
| } |
src/webview.cpp
Outdated
| if (page()->action(QWebEnginePage::ToggleMediaControls)) { | ||
| menu->removeAction(page()->action(QWebEnginePage::ToggleMediaControls)); | ||
| } | ||
|
|
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected. Please remove the trailing spaces at the end of this line.
454bcee to
48ffcac
Compare
|
@vighnesh-sawant I have a bit of a hard time to identify what your PR changed from a user perspective. Could you please clarify this with a list of differences and a small description in the PR description? That been said, I have already a small feedback:
|
48ffcac to
f2b672c
Compare
|
@kelson42 I have changed the PR a lot, I think this a better option that I did not figure out then. |
f2b672c to
2061d18
Compare
kelson42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vighnesh-sawant Thank you for this new iteration. Here my remarks:
- Saving an image works, but one I have done it once, the item is not display anymore, see for example (actually I have achieved to save the
thumbnail.webponce and then not anymore. Something is wrong here):
-
The contextual menu should not allow anymore to save the article in PDF, please move this in the topbar contextual menu (I would suggest between "Random article" and "print"). I would recommend to do that first in a dedicated issue.
-
Saving a video does not work for me, see
- To me it seems the code should allow to download anything via the right-click contextual menu. Here I have an
.epubbehind the link... and I can not save it.
2061d18 to
2393714
Compare
6624f48 to
11a5771
Compare
11a5771 to
6b2b317
Compare
|
@kelson42 forgot to tag you please look at this iteration! |
|
Here my remarks:
Once #1433 implemented an merged, we should rebase this one and restest everything... sorry, but for the moment this part is still pretty fuzzy at this stage. |
|
We are working on #1434 for the moment, once merged we will rebased and finish the work here. |

Fixes #1274
This PR adds an option to save image when right clicked on an image, save video when right clicked on an video and save video when right clicked on an audio.
In rest of the cases it gives you an option to save page as html.
I think this a better fix then the last one