diff options
author | Kyle Fazzari <github@status.e4ward.com> | 2012-09-12 02:56:32 +0400 |
---|---|---|
committer | Kyle Fazzari <github@status.e4ward.com> | 2012-09-12 02:56:32 +0400 |
commit | 7f6d39383e784846db2fb0ce46296c18df911061 (patch) | |
tree | a0046a124f34cc30820eacda7bd4f429b456e1e3 /src | |
parent | a426c4ea37bd098a2b3a4c21b7a73255ad5aa896 (diff) |
Found a much slicker solution to the problem of the OC URL
containing the protocol when the back button is used. Instead
of moving to two separate URL fields, a slot was created and
connected to the textChanged signal of the OCUrl LineEdit.
This slot simply ensures the protocol is not present.
Diffstat (limited to 'src')
-rw-r--r-- | src/mirall/owncloudsetupwizard.cpp | 17 | ||||
-rw-r--r-- | src/mirall/owncloudwizard.cpp | 16 | ||||
-rw-r--r-- | src/mirall/owncloudwizard.h | 3 |
3 files changed, 11 insertions, 25 deletions
diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp index 4b5dcd416..19e382f8e 100644 --- a/src/mirall/owncloudsetupwizard.cpp +++ b/src/mirall/owncloudsetupwizard.cpp @@ -127,14 +127,6 @@ void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url ) qDebug() << "Connect to url: " << url; _ocWizard->setField(QLatin1String("OCUrl"), url ); _ocWizard->appendToResultWidget(tr("Trying to connect to ownCloud at %1...").arg(url )); - - // Remove the protocol from the beginning of the url - QString urlWithoutProtocol = url; - urlWithoutProtocol.remove(QRegExp(".*://")); - - _ocWizard->setField(QLatin1String("OCUrlWithoutProtocol"), - urlWithoutProtocol); - testOwnCloudConnect(); } @@ -221,8 +213,6 @@ void OwncloudSetupWizard::slotCreateOCLocalhost() // define _ocWizard->setField( QLatin1String("OCUrl"), QLatin1String( "http://localhost/owncloud/") ); - _ocWizard->setField(QLatin1String("OCUrlWithoutProtocol"), - QLatin1String("localhost/owncloud/")); } void OwncloudSetupWizard::slotInstallOCServer() @@ -254,13 +244,6 @@ void OwncloudSetupWizard::slotInstallOCServer() runOwncloudAdmin( args ); _ocWizard->setField( QLatin1String("OCUrl"), QString::fromLatin1( "%1/owncloud/") .arg(_ocWizard->field(QLatin1String("myOCDomain")).toString() )); - - QString url = QString::fromLatin1( "%1/owncloud/") - .arg(_ocWizard->field(QLatin1String("myOCDomain")).toString()); - - _ocWizard->setField(QLatin1String("OCUrl"), url); - _ocWizard->setField(QLatin1String("OCUrlWithoutProtocol"), - url.remove(QRegExp(".*://"))); } void OwncloudSetupWizard::runOwncloudAdmin( const QStringList& args ) diff --git a/src/mirall/owncloudwizard.cpp b/src/mirall/owncloudwizard.cpp index e6cf28dd7..c08565bd2 100644 --- a/src/mirall/owncloudwizard.cpp +++ b/src/mirall/owncloudwizard.cpp @@ -57,7 +57,10 @@ void setupCustomMedia( QVariant variant, QLabel *label ) OwncloudSetupPage::OwncloudSetupPage() { _ui.setupUi(this); - registerField( QLatin1String("OCUrlWithoutProtocol"), _ui.leUrl ); + + connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(handleNewOcUrl(QString))); + + registerField( QLatin1String("OCUrl"), _ui.leUrl ); registerField( QLatin1String("OCUser"), _ui.leUsername ); registerField( QLatin1String("OCPasswd"), _ui.lePassword); registerField( QLatin1String("connectMyOC"), _ui.cbConnectOC ); @@ -147,6 +150,11 @@ void OwncloudSetupPage::slotSecureConChanged( int state ) } } +void OwncloudSetupPage::handleNewOcUrl(QString ocUrl) +{ + _ui.leUrl->setText(ocUrl.remove(QRegExp(".*://"))); +} + bool OwncloudSetupPage::isComplete() const { if( _ui.leUrl->text().isEmpty() ) return false; @@ -465,11 +473,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) QString OwncloudWizard::ocUrl() const { - QString url = field("OCUrlWithoutProtocol").toString(); - - if (url.isEmpty()) { - url = field("OCUrl").toString(); - } + QString url = field("OCUrl").toString(); if( field("secureConnect").toBool() ) { url.prepend(QLatin1String("https://")); diff --git a/src/mirall/owncloudwizard.h b/src/mirall/owncloudwizard.h index d0427c0bf..a43152bef 100644 --- a/src/mirall/owncloudwizard.h +++ b/src/mirall/owncloudwizard.h @@ -45,10 +45,10 @@ public: protected slots: void slotPwdStoreChanged( int ); void slotSecureConChanged( int ); + void handleNewOcUrl(QString ocUrl); void setupCustomization(); private: Ui_OwncloudSetupPage _ui; - }; class OwncloudWizard: public QWizard @@ -112,7 +112,6 @@ public: private: Ui_OwncloudWizardSelectTypePage _ui; - }; class CreateAnOwncloudPage: public QWizardPage |