OwncloudWizard::OwncloudWizard(QWidget *parent) : QWizard(parent), _configExists(false) { _setupPage = new OwncloudSetupPage; _resultPage = new OwncloudWizardResultPage; setPage(Page_oCSetup, _setupPage ); setPage(Page_Result, _resultPage ); // note: start Id is set by the calling class depending on if the // welcome text is to be shown or not. setWizardStyle( QWizard::ModernStyle ); connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int))); connect( _setupPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); Theme *theme = Theme::instance(); setWizardStyle(QWizard::ModernStyle); setPixmap( QWizard::BannerPixmap, theme->wizardHeaderBanner() ); setPixmap( QWizard::LogoPixmap, theme->wizardHeaderLogo() ); setOption( QWizard::NoBackButtonOnStartPage ); setOption( QWizard::NoBackButtonOnLastPage ); setOption( QWizard::NoCancelButton ); setTitleFormat(Qt::RichText); setSubTitleFormat(Qt::RichText); }
OwncloudWizard::OwncloudWizard(QWidget *parent) : QWizard(parent), _account(0), _setupPage(new OwncloudSetupPage(this)), _httpCredsPage(new OwncloudHttpCredsPage(this)), _shibbolethCredsPage(new OwncloudShibbolethCredsPage), _advancedSetupPage(new OwncloudAdvancedSetupPage), _resultPage(new OwncloudWizardResultPage), _credentialsPage(0), _configFile(), _oCUser(), _setupLog(), _configExists(false) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setPage(WizardCommon::Page_ServerSetup, _setupPage); setPage(WizardCommon::Page_HttpCreds, _httpCredsPage); setPage(WizardCommon::Page_ShibbolethCreds, _shibbolethCredsPage); setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage); setPage(WizardCommon::Page_Result, _resultPage); connect(this, SIGNAL(finished(int)), SIGNAL(basicSetupFinished(int))); // note: start Id is set by the calling class depending on if the // welcome text is to be shown or not. setWizardStyle( QWizard::ModernStyle ); connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int))); connect( _setupPage, SIGNAL(determineAuthType(QString)), SIGNAL(determineAuthType(QString))); connect( _httpCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); connect( _shibbolethCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); connect( _advancedSetupPage, SIGNAL(createLocalAndRemoteFolders(QString, QString)), SIGNAL(createLocalAndRemoteFolders(QString, QString))); connect(this, SIGNAL(customButtonClicked(int)), this, SIGNAL(skipFolderConfiguration())); Theme *theme = Theme::instance(); setWindowTitle( tr("%1 Connection Wizard").arg(theme->appNameGUI())); setWizardStyle(QWizard::ModernStyle); setPixmap( QWizard::BannerPixmap, theme->wizardHeaderBanner() ); setPixmap( QWizard::LogoPixmap, theme->wizardHeaderLogo() ); setOption( QWizard::NoBackButtonOnStartPage ); setOption( QWizard::NoBackButtonOnLastPage ); setOption( QWizard::NoCancelButton ); setTitleFormat(Qt::RichText); setSubTitleFormat(Qt::RichText); setButtonText(QWizard::CustomButton1, tr("Skip folders configuration")); }
void OwncloudOAuthCredsPage::asyncAuthResult(OAuth::Result r, const QString &user, const QString &token, const QString &refreshToken) { switch (r) { case OAuth::NotSupported: { /* OAuth not supported (can't open browser), fallback to HTTP credentials */ OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); ocWizard->back(); ocWizard->setAuthType(DetermineAuthTypeJob::Basic); break; } case OAuth::Error: /* Error while getting the access token. (Timeout, or the server did not accept our client credentials */ _ui.errorLabel->show(); wizard()->show(); break; case OAuth::LoggedIn: { _token = token; _user = user; _refreshToken = refreshToken; OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard()); Q_ASSERT(ocWizard); emit connectToOCUrl(ocWizard->account()->url().toString()); break; } } }
bool OwncloudSetupPage::validatePage() { bool re = false; if( ! _connected) { setErrorString(QString::null); _checking = true; _progressIndi->setVisible(true); _progressIndi->startAnimation(); emit completeChanged(); emit connectToOCUrl( url() ); return false; } else { // connecting is running stopSpinner(); _checking = false; emit completeChanged(); return true; } }
void OwncloudWizard::slotCurrentPageChanged( int id ) { qDebug() << "Current Wizard page changed to " << id; qDebug() << "Page_install is " << Page_Install; if( id == Page_FTP ) { // preset the ftp url field CreateAnOwncloudPage *p = static_cast<CreateAnOwncloudPage*> (page( Page_Create_OC )); QString domain = p->domain(); if( domain.startsWith( QLatin1String("http://") )) { domain = domain.right( domain.length()-7 ); } if( domain.startsWith( QLatin1String("https://") )) { domain = domain.right( domain.length()-8 ); } QString host = QLatin1String("ftp.") +domain; OwncloudFTPAccessPage *p1 = static_cast<OwncloudFTPAccessPage*> (page( Page_FTP )); p1->setFTPUrl( host ); } if( id == Page_Install ) { appendToResultWidget( QString::null ); showOCUrlLabel( false ); if( field(QLatin1String("connectMyOC")).toBool() ) { // check the url and connect. _oCUrl = ocUrl(); emit connectToOCUrl( _oCUrl); } else if( field(QLatin1String("createLocalOC")).toBool() ) { qDebug() << "Connect to local!"; emit installOCLocalhost(); } else if( field(QLatin1String("createNewOC")).toBool() ) { // call in installation mode and install to ftp site. emit installOCServer(); } else { } } if( id == Page_oCSetup ) { emit clearPendingRequests(); } }
bool OwncloudHttpCredsPage::validatePage() { if (_ui.leUsername->text().isEmpty() || _ui.lePassword->text().isEmpty()) { return false; } if (!_connected) { _ui.errorLabel->setVisible(false); _checking = true; startSpinner(); emit completeChanged(); emit connectToOCUrl(field("OCUrl").toString().simplified()); return false; } else { _checking = false; emit completeChanged(); stopSpinner(); return true; } return true; }
void OwncloudShibbolethCredsPage::slotShibbolethCookieReceived(const QNetworkCookie& cookie) { disposeBrowser(); _cookie = cookie; emit connectToOCUrl(field("OCUrl").toString().simplified()); }