leapcode/bitmask_client — pull request #751 by elijh (2014-09-08 09:08:04+00:00)
Title: Combined preferences window

DO NOT MERGE

not finished, but I won't be able to finish until friday.

some questions about things i don't understand

### Disconnecting when the service is disabled

There is a very hacky thing that happens when you disable VPN while it is running.

(1) PreferencesVpnPage emits app.service_selection_changed signal
(2) This connects to _update_eip_enabled_status slot
(3) Although the comment says that _update_eip_enabled_status will turn off EIP if needed, it did not.
(4) To do so, i emit "do_disconnect_signal"

There are two problems with this

(1) after disconnect is done, it shows the Turn ON button, but we want it disabled

so I super hackishly do this:

def hide():
self.app.backend.eip_can_start(domain=domain)
QtDelayedCall(100, hide)

to make that button go away.

(2) if you issue do_disconnect_signal while it is in the process of connecting, nothing happens.
there is no do_cancel_signal

The cancel button does some extreme measures, and calls

self._backend.bitmask_root_vpn_down()

But calling this does not help, just confuses the UI.

There is also backend.eip_terminate(), but that doesn't work either. as far as i can tell, there will be no good was to sort this out until we create a proper state machine in the backend. One that can understand the difference between 'cancel current connection attempt and then go into disabled state' versus 'cancel current connection attempt and then go into off state'.

### Soledad and changing password

Ideally, I think it is important that the user be able to change their password whenever they want.

* If offline, they should be able to just change their soledad password.
* If online, they should be able to change their srp password and soledad password without waiting for soledad.
* The determination if soledad should be used should be based on the account settings (username@domain), not just the provider settings (domain).

That is not at all how the code currently works. afaik, it works like this:

* if online and authenticated, change SRP password
* if online and provider offers mx and mx is enabled for that provider (but not the particular account), then also change soledad password after soledad is ready.

I don't understand why this code:

if MX_SERVICE not in enabled_services:
msg = self.tr("You need to enable {0} in order to change "
"the password.".format(mx_name))
self._set_password_change_status(msg, error=True)
pw_enabled = False

Why must the user enable email just to change their password? I did not include this logic in these changes, which probably breaks something.