There is also another scenario in which this is triggered, and it's not something that can be helped with some refactoring:
When an application needs an OAuth token, it talks to Online Accounts (OA) to get it. If OA doesn't have a cached token (or if it's expired), OA will create a WebView, and load the OAuth URL into it. Since we are saving the session cookies, it is possible that there is no need to interact with the user, and that the WebView will be automatically redirected to the URL where the OAuth token can be collected from. When this happens, we don't want to bother the user at all.
However, in order to run a WebView, we need a QGuiApplication, which will make a blak window appear for some seconds.
There is also another scenario in which this is triggered, and it's not something that can be helped with some refactoring:
When an application needs an OAuth token, it talks to Online Accounts (OA) to get it. If OA doesn't have a cached token (or if it's expired), OA will create a WebView, and load the OAuth URL into it. Since we are saving the session cookies, it is possible that there is no need to interact with the user, and that the WebView will be automatically redirected to the URL where the OAuth token can be collected from. When this happens, we don't want to bother the user at all.
However, in order to run a WebView, we need a QGuiApplication, which will make a blak window appear for some seconds.