diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2024-10-10 19:30:52 +0300 |
|---|---|---|
| committer | Ahmad Samir <a.samirh78@gmail.com> | 2025-01-01 03:04:55 +0200 |
| commit | c41aa896101b2eaf12b2f65220f091ccb375d200 (patch) | |
| tree | 1720071246b66261067f16cd15db05ae4c7479e1 /examples/sql/sqlbrowser/qsqlconnectiondialog.cpp | |
| parent | 3bb4c4949fed9ccf8653151c78d5130b8db00716 (diff) | |
QTranslator: refactor loading translation files
QTranslator::load() used to:
- call find_translation(), which finds the file, ensures it's readable,
and returns file name
- pass the file name to do_load() which would proceed to open the
file
During the time between calling find_translation()/is_readable_file()
and calling do_load(), the underlying filesystem could have changed.
Solve the issue by making find_translation() call do_load() itself (as
suggested in the bug report). Also rename the method to
load_translation() and make it a member method so that it can call
do_load().
Remove the now redundant is_readable_file() static helper, since
QFile::open() in do_load() will do the necessary checks.
Note that there is a slight behavior change:
- with this commit we call do_load() on a variant of the translation
file name, if that fails we call it again on the next variant ...etc
- before this, if the file was readable, the code called do_load() once,
if it failed, it didn't try again.
This was suggested by Volker in code review as a good/welcome
side-effect.
Task-number: QTBUG-129777
Change-Id: Ie5fada60dd6267e67cda4272530db69a44f3ee55
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'examples/sql/sqlbrowser/qsqlconnectiondialog.cpp')
0 files changed, 0 insertions, 0 deletions
