mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
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:
parent
7f6d39383e
commit
2652a744d0
2 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue