-
Notifications
You must be signed in to change notification settings - Fork 144
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
Fix bug: When saving a file in Linux, the file name extension is not … #402
Conversation
I‘m working well on Linux. And you will not receive the path from the CEF correctly |
|
I have tested it on Ubuntu 20.04, Kylin OS v10, and UOS V20 systems, and there are problems in all of them. As shown in the first picture, although the filters are pptx, the final saved file does not have the pptx suffix. You can also review the implementation logic of QCefViewPrivate::onFileDialog. In fact, judging from your screenshot, there is also a problem. The save dialog box does not automatically fill in the suggested file name. Also, try forcibly removing the suffix from the file name and see if the suffix is automatically added after saving. |
hi @mogoweb, thanks for the contribution to QCefView, this PR seems to be a good workaround of QT bugs. bu as of the QCefView, I think we'd better not add this logic into the under-layer implementation. I suggest we expose a new virtual method QCefView::onFileDialog to the consumer. Do you think this is better solution? |
Sounds like very good advice. I'm actually a little confused, why is this behavior of saving files only implemented by users under Linux? 如果由用户来实现保存逻辑,这个保存逻辑应该在所有平台下都可以给用户自己实现的机会。 |
CEF offers a callback method for managing dialog processing logic, allowing users to present their own file dialog with custom logic. If users prefer to utilize CEF's built-in file dialog logic, they simply need to return false in this callback. Regrettably, the default implementation is missing on the Linux platform, so QCefView just provide a default Implementation with Qt. |
If the onFileDialog method is added to QCefView, how to handle the callback? The CefRefPtr callback also needs to be encapsulated, which feels a bit troublesome. Are you sure you want to do this? |
Hi @mogoweb I will complete this PR currently, maybe I will address a PR to reform the code as we discussed above. |
There are two problems when downloading file under Linux: