void OwncloudSetupWizard::slotCreateRemoteFolderFinished( QNetworkReply::NetworkError error ) { qDebug() << "** webdav mkdir request finished " << error; disconnect(ownCloudInfo::instance(), SIGNAL(webdavColCreated(QNetworkReply::NetworkError)), this, SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError))); bool success = true; if( error == QNetworkReply::NoError ) { _ocWizard->appendToConfigurationLog( tr("Remote folder %1 created successfully.").arg(_remoteFolder)); } else if( error == 202 ) { _ocWizard->appendToConfigurationLog( tr("The remote folder %1 already exists. Connecting it for syncing.").arg(_remoteFolder)); } else if( error > 202 && error < 300 ) { _ocWizard->displayError( tr("The folder creation resulted in HTTP error code %1").arg((int)error )); _ocWizard->appendToConfigurationLog( tr("The folder creation resulted in HTTP error code %1").arg((int)error) ); } else if( error == QNetworkReply::OperationCanceledError ) { _ocWizard->displayError( tr("The remote folder creation failed because the provided credentials " "are wrong!" "<br/>Please go back and check your credentials.</p>")); _ocWizard->appendToConfigurationLog( tr("<p><font color=\"red\">Remote folder creation failed probably because the provided credentials are wrong.</font>" "<br/>Please go back and check your credentials.</p>")); _remoteFolder.clear(); success = false; } else { _ocWizard->appendToConfigurationLog( tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(_remoteFolder).arg(error)); _ocWizard->displayError( tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(_remoteFolder).arg(error) ); _remoteFolder.clear(); success = false; } finalizeSetup( success ); }
// ### TODO move into EntityExistsJob once we decide if/how to return gui strings from jobs void OwncloudSetupWizard::slotRemoteFolderExists(QNetworkReply *reply) { bool ok = true; QString error; QNetworkReply::NetworkError errId = reply->error(); if( errId == QNetworkReply::NoError ) { qDebug() << "******** Remote folder found, all cool!"; } else if( errId == QNetworkReply::ContentNotFoundError ) { if( _remoteFolder.isEmpty() ) { error = tr("No remote folder specified!"); ok = false; } else { createRemoteFolder(); } } else { error = tr("Error: %1").arg(reply->errorString()); ok = false; } if( !ok ) { _ocWizard->displayError(error, false); } finalizeSetup( ok ); }
void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString& localFolder, const QString& remoteFolder) { qDebug() << "Setup local sync folder for new oC connection " << localFolder; const QDir fi( localFolder ); bool nextStep = true; if( fi.exists() ) { // there is an existing local folder. If its non empty, it can only be synced if the // ownCloud is newly created. _ocWizard->appendToConfigurationLog( tr("Local sync folder %1 already exists, setting it up for sync.<br/><br/>").arg(localFolder)); } else { QString res = tr("Creating local sync folder %1...").arg(localFolder); if( fi.mkpath( localFolder ) ) { Utility::setupFavLink( localFolder ); // FIXME: Create a local sync folder. res += tr("ok"); } else { res += tr("failed."); qDebug() << "Failed to create " << fi.path(); _ocWizard->displayError(tr("Could not create local folder %1").arg(localFolder), false); nextStep = false; } _ocWizard->appendToConfigurationLog( res ); } if (nextStep) { EntityExistsJob *job = new EntityExistsJob(_ocWizard->account(), _ocWizard->account()->davPath() + remoteFolder, this); connect(job, SIGNAL(exists(QNetworkReply*)), SLOT(slotRemoteFolderExists(QNetworkReply*))); job->start(); } else { finalizeSetup( false ); } }
/** Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements(). * @note Must be called after the index buffer has been filled. */ void setCountVector(const GLsizei* vcount, size_t size) { mCountVector.resize(size); for(size_t i=0; i<size; ++i) mCountVector[i] = vcount[i]; finalizeSetup(); }
void OwncloudSetupWizard::slotNoOwnCloudFound( QNetworkReply *err ) { _ocWizard->appendToResultWidget(tr("<font color=\"red\">Failed to connect to %1!</font>") .arg(Theme::instance()->appNameGUI())); _ocWizard->appendToResultWidget(tr("Error: <tt>%1</tt>").arg(err->errorString()) ); // remove the config file again MirallConfigFile cfgFile( _configHandle ); cfgFile.cleanupCustomConfig(); finalizeSetup( false ); }
void OwncloudSetupWizard::slotNoOwnCloudFound( QNetworkReply *err ) { disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)), this, SLOT(slotOwnCloudFound(QString,QString,QString,QString))); disconnect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)), this, SLOT(slotNoOwnCloudFound(QNetworkReply*))); _ocWizard->displayError(tr("Failed to connect to %1:<br/>%2"). arg(Theme::instance()->appNameGUI()).arg(err->errorString())); // remove the config file again MirallConfigFile cfgFile( _configHandle ); cfgFile.cleanupCustomConfig(); finalizeSetup( false ); }
void ofxFensterCanvas::setup(ofxFensterListener * listener, int _columns, int _rows, int width, int height, ofxDisplay * display, ofWindowMode screenMode){ columns = _columns, rows = _rows; ofxFenster * bootstrapWin = ofxFensterManager::get()->getActiveWindow(); if(display){ setupScreensOnDisplay(listener, display, width, height, screenMode); } else { autoSetupScreensOnDisplays(listener, width, height, screenMode); } ofxFensterManager::get()->deleteFenster(bootstrapWin); finalizeSetup(); }
void OwncloudSetupWizard::slotAuthCheckReply( const QString&, QNetworkReply *reply ) { // disconnect from ownCloud Info signals disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)), this,SLOT(slotAuthCheckReply(QString,QNetworkReply*))); bool ok = true; QString error; QNetworkReply::NetworkError errId = reply->error(); if( errId == QNetworkReply::NoError ) { qDebug() << "******** Remote folder found, all cool!"; } else if( errId == QNetworkReply::AuthenticationRequiredError ) { // returned if the user is wrong. qDebug() << "******** Password is wrong!"; error = tr("The given credentials do not authenticate."); ok = false; } else if( errId == QNetworkReply::OperationCanceledError ) { // the username was wrong and ownCloudInfo was closing the request after a couple of auth tries. qDebug() << "******** Username or password is wrong!"; error = tr("Username or password is wrong!"); ok = false; } else if( errId == QNetworkReply::ContentNotFoundError ) { // FIXME try to create the remote folder! if( !createRemoteFolder() ) { error = tr("The remote folder could not be accessed!"); ok = false; } else { return; // Finish here, the mkdir request will go on. } } else { error = tr("Error: %1").arg(reply->errorString()); ok = false; } if( !ok ) { _ocWizard->displayError(error); } else { _ocWizard->setRemoteFolder( _remoteFolder ); } finalizeSetup( ok ); }