Wizard: Prepend 'https://' if no scheme is set

First part of fix for #1356
This commit is contained in:
Daniel Molkentin 2014-01-20 17:53:46 +01:00
parent 2780dae569
commit 9b9b62d4e3
2 changed files with 12 additions and 0 deletions

View file

@ -51,6 +51,7 @@ OwncloudSetupPage::OwncloudSetupPage()
setupCustomization();
connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(slotUrlChanged(QString)));
connect(_ui.leUrl, SIGNAL(editingFinished()), SLOT(slotUrlEditFinished()));
}
void OwncloudSetupPage::setServerUrl( const QString& newUrl )
@ -108,6 +109,16 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url)
}
}
void OwncloudSetupPage::slotUrlEditFinished()
{
QString url = _ui.leUrl->text();
if (QUrl(url).isRelative()) {
// no scheme defined, set one
url.prepend("https://");
}
_ui.leUrl->setText(url);
}
bool OwncloudSetupPage::isComplete() const
{
return !_ui.leUrl->text().isEmpty() && !_checking;

View file

@ -53,6 +53,7 @@ public slots:
protected slots:
void slotUrlChanged(const QString&);
void slotUrlEditFinished();
void setupCustomization();