Merge pull request #3 from kyle-f/master

Owncloud client wizard setup page doesn't handle back button presses.
This commit is contained in:
Daniel Molkentin 2012-09-14 01:29:53 -07:00
commit 55e1ef2cc5
2 changed files with 19 additions and 2 deletions

View file

@ -57,6 +57,9 @@ void setupCustomMedia( QVariant variant, QLabel *label )
OwncloudSetupPage::OwncloudSetupPage() OwncloudSetupPage::OwncloudSetupPage()
{ {
_ui.setupUi(this); _ui.setupUi(this);
connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(handleNewOcUrl(QString)));
registerField( QLatin1String("OCUrl"), _ui.leUrl ); registerField( QLatin1String("OCUrl"), _ui.leUrl );
registerField( QLatin1String("OCUser"), _ui.leUsername ); registerField( QLatin1String("OCUser"), _ui.leUsername );
registerField( QLatin1String("OCPasswd"), _ui.lePassword); registerField( QLatin1String("OCPasswd"), _ui.lePassword);
@ -147,6 +150,21 @@ void OwncloudSetupPage::slotSecureConChanged( int state )
} }
} }
void OwncloudSetupPage::handleNewOcUrl(const QString& ocUrl)
{
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 bool OwncloudSetupPage::isComplete() const
{ {
if( _ui.leUrl->text().isEmpty() ) return false; if( _ui.leUrl->text().isEmpty() ) return false;

View file

@ -45,10 +45,10 @@ public:
protected slots: protected slots:
void slotPwdStoreChanged( int ); void slotPwdStoreChanged( int );
void slotSecureConChanged( int ); void slotSecureConChanged( int );
void handleNewOcUrl(const QString& ocUrl);
void setupCustomization(); void setupCustomization();
private: private:
Ui_OwncloudSetupPage _ui; Ui_OwncloudSetupPage _ui;
}; };
class OwncloudWizard: public QWizard class OwncloudWizard: public QWizard
@ -112,7 +112,6 @@ public:
private: private:
Ui_OwncloudWizardSelectTypePage _ui; Ui_OwncloudWizardSelectTypePage _ui;
}; };
class CreateAnOwncloudPage: public QWizardPage class CreateAnOwncloudPage: public QWizardPage