Damino requested that QUrl be used to parse the URL, along with toString(QUrl::RemoveScheme). QUrl::RemoveScheme doesn't remove the slashes, so extra code was thrown in to ensure they were removed if they were present.

This commit is contained in:
Kyle Fazzari 2012-09-13 22:47:39 -04:00
parent 7f6d39383e
commit 2652a744d0
2 changed files with 14 additions and 3 deletions

View file

@ -150,9 +150,20 @@ void OwncloudSetupPage::slotSecureConChanged( int state )
}
}
void OwncloudSetupPage::handleNewOcUrl(QString ocUrl)
void OwncloudSetupPage::handleNewOcUrl(const QString& ocUrl)
{
_ui.leUrl->setText(ocUrl.remove(QRegExp(".*://")));
QUrl url(ocUrl);
QString urlMinusScheme = url.toString(QUrl::RemoveScheme);
// QUrl::RemoveScheme leaves the beginning slashes. Remove them
// if they're present.
if (urlMinusScheme.startsWith("//"))
{
urlMinusScheme.remove(0, 2);
}
_ui.leUrl->setText(urlMinusScheme);
}
bool OwncloudSetupPage::isComplete() const

View file

@ -45,7 +45,7 @@ public:
protected slots:
void slotPwdStoreChanged( int );
void slotSecureConChanged( int );
void handleNewOcUrl(QString ocUrl);
void handleNewOcUrl(const QString& ocUrl);
void setupCustomization();
private:
Ui_OwncloudSetupPage _ui;