Skip to content

Refactor ClientApp::createNewWindow

Stefano Crocco requested to merge stefanocrocco/konqueror:remove-goto into master

I refactored the Refactor ClientApp::createNewWindow function to remove the goto. I split the function in four parts:

  • parseBrowserApplicationString which takes the BrowserApplication string and parses it to determine if it's a command or a service, whether it calls kfmclient itself and to create the command line
  • launchExternalBrowserCommand which launches the external browser if it's specified as a command
  • launchExternalBrowserService which launches the external browser if it's specified as a service
  • createNewWindow itself which uses the above three functions.

I'm not completely sure whether I understood correctly what createNewWindow is supposed to return. In the original code, there were two lines saying return qApp->exec(): since createNewWindow returns a bool, it would return false when qApp->exec() returns 0 (the application exited successfully) and true when it returns a different number (the application exited with errors). Looking at the rest of the code, however, it seems that createNewWindow should return true in case of success and false in case of errors. Because of this, i replaced return qApp->exec() with something similar to return qApp->exec() == 0.

Merge request reports