Start encapsulating Javascript behavior into two different files: currencyConverter.js for the QML, and a currencyService.java to put there the "convert" function.