preferences: Allow to restore from an image containing a QR code
Also move all the closures to proper functions as otherwise it gets really hard to figure out what is goin on note we have lost some proper error reporting but i feel like this should almost never happen. Instead, the user can open the app from terminal to get proper error reporting or once we do that similarly across all the app.
Fixes #369 (closed)