The-Compiler/qutebrowser — pull request #239 by peterlvilim (2014-11-01 06:40:09+00:00)
Title: Confirm quit if downloads running

This partially addresses #48 quit confirmation by adding a check for running downloads when the browser is closed.

There were a couple design decision to make in implementing this feature. First, I decided to add a new setting for whether or not the browser should check for running downloads when quitting. I didn't see a good way to integrate it with the current confirm-quit setting. For instance you might want to both check for open tabs and check for downloads. So the current confirm-quit setting would have ended up with a ton of possibilities that would have increased further as additional quit checks are added (#48 has a comment about checking text form fields as well).

Since I added the new setting confirm-quit-downloads I decided to rename the other one to confirm-quit-tabs so that it is clearer what they do. This means that that any config files that users currently have will be broken and an exception will be thrown if master is pulled. I personally don't view this as an issue at this stage in the development of this software. So I think this is fine. There are a couple alternatives:
1. Write an upgrade script for users. We would want to do this if this application was widely deployed, but since it is currently in development I believe this adds unneeded cruft that would have to be maintained later.
2. Leave the setting with its current name. Degrades the readability of the code. Since this software isn't widely deployed we have some freedom in being able to break things to keep the code high quality.

Anyway, those are my thoughts. I'll defer to you though because from reading through your code you obviously know what you are doing.

Testing: Automated testing passes.
Manual testing:
1. Set confirm-quit-tabs=never. Browser does not ask when one or two tabs are closed.
2. Set confirm-quit-tabs=always. Browser asks when one or two tabs are closed.
3. Set confirm-quit-tabs=multiple-tabs. Browser does not ask when one tab is closed but asks when two are closed.
4. Set confirm-quit-downloads=true. Browser asks when one or two downloads are running and quit messages correctly use singular and plural. Browser does not ask when 0 downloads are running.
5. Set confirm-quit-downloads=false. Browser does not ask when one download is running.
6. I also tested the case confirm-quit-tabs=multiple-tabs and confirm-quit-downloads=true while multiple tabs were opened and downloads running. The browser correctly asks both questions and responds correctly.