SetupWizard: populate credentials from HTTP server URL

If a user enters a server URL in the form of
https://user:pass@example.com/, pre-populate the following credentials
page with those values.
This commit is contained in:
Michael Nutt 2015-11-09 18:21:33 -05:00
parent b29d1e94b5
commit bd65eb32b7

View file

@ -78,6 +78,18 @@ void OwncloudHttpCredsPage::initializePage()
if (!user.isEmpty()) {
_ui.leUsername->setText(user);
}
} else {
QUrl url = ocWizard->account()->url();
const QString user = url.userName();
const QString password = url.password();
if(!user.isEmpty()) {
_ui.leUsername->setText(user);
}
if(!password.isEmpty()) {
_ui.lePassword->setText(password);
}
}
_ui.leUsername->setFocus();
}