void QNetworkAccessHttpBackend::postRequest() { bool loadedFromCache = false; QHttpNetworkRequest httpRequest; switch (operation()) { case QNetworkAccessManager::GetOperation: httpRequest.setOperation(QHttpNetworkRequest::Get); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::HeadOperation: httpRequest.setOperation(QHttpNetworkRequest::Head); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::PostOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Post); uploadDevice = new QNetworkAccessHttpBackendIODevice(this); break; case QNetworkAccessManager::PutOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Put); uploadDevice = new QNetworkAccessHttpBackendIODevice(this); break; default: break; // can't happen } httpRequest.setData(uploadDevice); httpRequest.setUrl(url()); QList<QByteArray> headers = request().rawHeaderList(); foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, request().rawHeader(header)); if (loadedFromCache) { QNetworkAccessBackend::finished(); return; // no need to send the request! :) } httpReply = http->sendRequest(httpRequest); httpReply->setParent(this); #ifndef QT_NO_OPENSSL if (pendingSslConfiguration) httpReply->setSslConfiguration(*pendingSslConfiguration); if (pendingIgnoreSslErrors) httpReply->ignoreSslErrors(); #endif connect(httpReply, SIGNAL(readyRead()), SLOT(replyReadyRead())); connect(httpReply, SIGNAL(finished()), SLOT(replyFinished())); connect(httpReply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), SLOT(httpError(QNetworkReply::NetworkError,QString))); connect(httpReply, SIGNAL(headerChanged()), SLOT(replyHeaderChanged())); }
void QmlTreeModel::setHeader(QmlModelRow* row) { if (row == impl_->header_) { return; } impl_->setHeader(row); headerChanged(); }
void CSVLogger::setHeader(QList<QString> const& header){ if(this->header != header){ if(writing) qCritical() << "CSVLogger::setHeader(): header cannot be changed while writing."; else{ this->header = header; emit headerChanged(); } } }
void Updater::getFile( const QUrl &url ) { QNetworkRequest request( url ); request.setRawHeader( "User-Agent", "QMPlay2" ); QNetworkReply *reply = net.get( request ); connect( reply, SIGNAL( metaDataChanged() ), this, SLOT( headerChanged() ) ); connect( reply, SIGNAL( readyRead() ), this, SLOT( writeToFile() ) ); connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( downloadprogress( qint64, qint64 ) ) ); connect( reply, SIGNAL( finished() ), this, SLOT( downloadFinished() ) ); reply->ignoreSslErrors(); firstChunk = true; }
void AbstractOperationDay::changeDirtyState( bool dirty ) { if( tHeader.isNull() || tHeader.isEmpty() ) return; if( dirty ) { if( tHeader.indexOf("*") < 0 ) tHeader = "*" + tHeader; } else tHeader.remove( QChar('*'), Qt::CaseInsensitive ); emit headerChanged( tNumber, tHeader ); }
void StatisticTableModel::setValueCoding( int valueCoding ) { // no changes? if( mValueCoding == valueCoding ) return; delete mValueCodec; mValueCoding = (Okteta::ValueCoding)valueCoding; mValueCodec = Okteta::ValueCodec::createCodec( mValueCoding ); // CodedByte.resize( ByteCodec->encodingWidth() ); emit dataChanged( index(0,ValueId), index(StatisticsByteSetSize-1,ValueId) ); emit headerChanged(); }
void PlayListHeaderModel::insert(int index, const QString &name, const QString &pattern) { if(index < 0 || index > m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } ColumnHeader col; col.name = name; col.pattern = pattern; m_columns.insert(index, col); emit columnAdded(index); emit headerChanged(); updatePlayLists(); }
void PlayListHeaderModel::remove(int index) { if(index < 0 || index >= m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } if(m_columns.count() == 1) return; m_columns.takeAt(index); emit columnRemoved(index); emit headerChanged(); updatePlayLists(); }
void CSVImport::Start() { if(!gui) { gui = new Ui::CSVImportDialog(); gui->setupUi(guiDialog = new QDialog()); guiDialog->setWindowTitle("CVS Import"); connect(gui->closeButton, SIGNAL(clicked()), this, SLOT(Closing())); connect(guiDialog, SIGNAL(finished(int)), this, SLOT(Closing())); connect(gui->classColumnSpin, SIGNAL(valueChanged(int)), this, SLOT(classColumnChanged(int))); connect(gui->headerCheck, SIGNAL(clicked()), this, SLOT(headerChanged())); connect(gui->loadFile, SIGNAL(clicked()), this, SLOT(LoadFile())); // file loader connect(gui->dumpButton, SIGNAL(clicked()),this,SLOT(on_dumpButton_clicked())); connect(gui->classIgnoreCheck, SIGNAL(clicked()), this, SLOT(classIgnoreChanged())); connect(gui->importLimitSpin, SIGNAL(valueChanged(int)), this, SLOT(on_importLimitSpin_valueChanged(int))); connect(gui->importLimitCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(on_importLimitCombo_currentIndexChanged(int))); // connect(gui->pcaButton, SIGNAL(clicked()),this,SLOT(on_pcaButton_clicked())); guiDialog->show(); }
void PlayListHeaderModel::move(int from, int to) { if(from < 0 || from >= m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } if(to < 0 || to >= m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } m_columns.move(from, to); emit columnMoved(from, to); emit headerChanged(); updatePlayLists(); }
void TransactionWidget::loadHeader( const QString &str ) { QString header = str.trimmed(); QStringList list = header.split("\t"); if( header.isNull() || header.isEmpty() ) return; if( list.count() <= 0 ) return; if( header.indexOf("\t") < 0 ) { QMessageBox::warning( this, programName, tr("%1%2</b>").arg(dbError).arg(header) ); return; } if( list.count() < 2 ) return; header = list[1].simplified(); if( header.indexOf("[") >= 0 ) { int i = header.indexOf(" "); if( i >= 0 ) { QString left = header.left(i); QString right = header.right( header.length() - i - 1 ); left = SConvert::convertString( 1, left ); header = left + " " + right; } } setWindowTitle( header ); label->setText( tr("Account: <b>") + header + "</b>" ); emit headerChanged( header ); loadAccountTypeRequest(); }
void PlayListHeaderModel::execEdit(int index, QWidget *parent) { if(index < 0 || index >= m_columns.size()) { qWarning("ColumnManager: index is out of range"); return; } if(!parent) parent = qApp->activeWindow(); ColumnEditor editor(m_columns[index].name, m_columns[index].pattern, parent); if(editor.exec() == QDialog::Accepted) { m_columns[index].name = editor.name(); m_columns[index].pattern = editor.pattern(); emit columnChanged(index); emit headerChanged(); updatePlayLists(); } }
void WebImport::Start() { if(!gui) { gui = new Ui::WebImportDialog(); gui->setupUi(guiDialog = new QDialog()); connect(gui->closeButton, SIGNAL(clicked()), this, SLOT(Closing())); connect(guiDialog, SIGNAL(finished(int)), this, SLOT(Closing())); connect(gui->spinBox, SIGNAL(valueChanged(int)), this, SLOT(spinBoxChanged(int))); //connect(gui->spinE1, SIGNAL(valueChanged(int)), this, SLOT(Updating())); //connect(gui->spinE2, SIGN.AL(valueChanged(int)), this, SLOT(Updating())); connect(gui->loadFile, SIGNAL(clicked()), this, SLOT(LoadFile())); // file loader connect(gui->browserWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(LinkHandler(QUrl))); connect(gui->backButton, SIGNAL(clicked()),gui->browserWebView,SLOT(back())); connect(gui->dumpButton, SIGNAL(clicked()),this,SLOT(on_dumpButton_clicked())); connect(gui->pcaButton, SIGNAL(clicked()),this,SLOT(on_pcaButton_clicked())); connect(gui->headerCheck, SIGNAL(clicked()), this, SLOT(headerChanged())); connect(&manager, SIGNAL(finished(QNetworkReply*)),SLOT(downloadHandler(QNetworkReply*))); guiDialog->show(); gui->browserWebView->show(); gui->browserWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); }
void QNetworkAccessHttpBackend::postRequest() { bool loadedFromCache = false; QHttpNetworkRequest httpRequest; httpRequest.setPriority(convert(request().priority())); switch (operation()) { case QNetworkAccessManager::GetOperation: httpRequest.setOperation(QHttpNetworkRequest::Get); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::HeadOperation: httpRequest.setOperation(QHttpNetworkRequest::Head); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::PostOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Post); httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::PutOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Put); httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::DeleteOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Delete); break; case QNetworkAccessManager::CustomOperation: invalidateCache(); // for safety reasons, we don't know what the operation does httpRequest.setOperation(QHttpNetworkRequest::Custom); httpRequest.setUploadByteDevice(createUploadByteDevice()); httpRequest.setCustomVerb(request().attribute( QNetworkRequest::CustomVerbAttribute).toByteArray()); break; default: break; // can't happen } httpRequest.setUrl(url()); QList<QByteArray> headers = request().rawHeaderList(); if (resumeOffset != 0) { if (headers.contains("Range")) { // Need to adjust resume offset for user specified range headers.removeOne("Range"); // We've already verified that requestRange starts with "bytes=", see canResume. QByteArray requestRange = request().rawHeader("Range").mid(6); int index = requestRange.indexOf('-'); quint64 requestStartOffset = requestRange.left(index).toULongLong(); quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong(); requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) + '-' + QByteArray::number(requestEndOffset); httpRequest.setHeaderField("Range", requestRange); } else { httpRequest.setHeaderField("Range", "bytes=" + QByteArray::number(resumeOffset) + '-'); } } foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, request().rawHeader(header)); if (loadedFromCache) { // commented this out since it will be called later anyway // by copyFinished() //QNetworkAccessBackend::finished(); return; // no need to send the request! :) } if (request().attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true) httpRequest.setPipeliningAllowed(true); if (static_cast<QNetworkRequest::LoadControl> (request().attribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual) httpRequest.setWithCredentials(false); httpReply = http->sendRequest(httpRequest); httpReply->setParent(this); #ifndef QT_NO_OPENSSL if (pendingSslConfiguration) httpReply->setSslConfiguration(*pendingSslConfiguration); if (pendingIgnoreAllSslErrors) httpReply->ignoreSslErrors(); httpReply->ignoreSslErrors(pendingIgnoreSslErrorsList); connect(httpReply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(sslErrors(QList<QSslError>))); #endif connect(httpReply, SIGNAL(readyRead()), SLOT(replyReadyRead())); connect(httpReply, SIGNAL(finished()), SLOT(replyFinished())); connect(httpReply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), SLOT(httpError(QNetworkReply::NetworkError,QString))); connect(httpReply, SIGNAL(headerChanged()), SLOT(replyHeaderChanged())); connect(httpReply, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)), SLOT(httpCacheCredentials(QHttpNetworkRequest,QAuthenticator*))); #ifndef QT_NO_NETWORKPROXY connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); #endif connect(httpReply, SIGNAL(authenticationRequired(const QHttpNetworkRequest,QAuthenticator*)), SLOT(httpAuthenticationRequired(const QHttpNetworkRequest,QAuthenticator*))); }
if (synchronous) { connect(httpReply,SIGNAL(headerChanged()), this, SLOT(synchronousHeaderChangedSlot())); connect(httpReply,SIGNAL(finished()), this, SLOT(synchronousFinishedSlot())); connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), this, SLOT(synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString))); connect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*))); #ifndef QT_NO_NETWORKPROXY connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*))); #endif // Don't care about ignored SSL errors for now in the synchronous HTTP case. } else if (!synchronous) { connect(httpReply,SIGNAL(headerChanged()), this, SLOT(headerChangedSlot())); connect(httpReply,SIGNAL(finished()), this, SLOT(finishedSlot())); connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), this, SLOT(finishedWithErrorSlot(QNetworkReply::NetworkError,QString))); // some signals are only interesting when normal asynchronous style is used connect(httpReply,SIGNAL(readyRead()), this, SLOT(readyReadSlot())); connect(httpReply,SIGNAL(dataReadProgress(qint64,qint64)), this, SLOT(dataReadProgressSlot(qint64,qint64))); #ifndef QT_NO_SSL connect(httpReply,SIGNAL(encrypted()), this, SLOT(encryptedSlot())); connect(httpReply,SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsSlot(QList<QSslError>))); connect(httpReply,SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), this, SLOT(preSharedKeyAuthenticationRequiredSlot(QSslPreSharedKeyAuthenticator*))); #endif // In the asynchronous HTTP case we can just forward those signals // Connect the reply signals that we can directly forward
// This is invoked as QueuedConnection from QNetworkAccessHttpBackend in the user thread void QHttpThreadDelegate::startRequest() { #ifdef QHTTPTHREADDELEGATE_DEBUG qDebug() << "QHttpThreadDelegate::startRequest() thread=" << QThread::currentThreadId(); #endif // Check QThreadStorage for the QNetworkAccessCache // If not there, create this connection cache if (!connections.hasLocalData()) { connections.setLocalData(new QNetworkAccessCache()); } // check if we have an open connection to this host QUrl urlCopy = httpRequest.url(); urlCopy.setPort(urlCopy.port(ssl ? 443 : 80)); QHttpNetworkConnection::ConnectionType connectionType = QHttpNetworkConnection::ConnectionTypeHTTP; #ifndef QT_NO_SSL if (httpRequest.isSPDYAllowed() && ssl) { connectionType = QHttpNetworkConnection::ConnectionTypeSPDY; urlCopy.setScheme(QStringLiteral("spdy")); // to differentiate SPDY requests from HTTPS requests QList<QByteArray> nextProtocols; nextProtocols << QSslConfiguration::NextProtocolSpdy3_0 << QSslConfiguration::NextProtocolHttp1_1; incomingSslConfiguration.setAllowedNextProtocols(nextProtocols); } #endif // QT_NO_SSL #ifndef QT_NO_NETWORKPROXY if (transparentProxy.type() != QNetworkProxy::NoProxy) cacheKey = makeCacheKey(urlCopy, &transparentProxy); else if (cacheProxy.type() != QNetworkProxy::NoProxy) cacheKey = makeCacheKey(urlCopy, &cacheProxy); else #endif cacheKey = makeCacheKey(urlCopy, 0); // the http object is actually a QHttpNetworkConnection httpConnection = static_cast<QNetworkAccessCachedHttpConnection *>(connections.localData()->requestEntryNow(cacheKey)); if (httpConnection == 0) { // no entry in cache; create an object // the http object is actually a QHttpNetworkConnection #ifdef QT_NO_BEARERMANAGEMENT httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, connectionType); #else httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, connectionType, networkSession); #endif #ifndef QT_NO_SSL // Set the QSslConfiguration from this QNetworkRequest. if (ssl && incomingSslConfiguration != QSslConfiguration::defaultConfiguration()) { httpConnection->setSslConfiguration(incomingSslConfiguration); } #endif #ifndef QT_NO_NETWORKPROXY httpConnection->setTransparentProxy(transparentProxy); httpConnection->setCacheProxy(cacheProxy); #endif // cache the QHttpNetworkConnection corresponding to this cache key connections.localData()->addEntry(cacheKey, httpConnection); } else { if (httpRequest.withCredentials()) { QNetworkAuthenticationCredential credential = authenticationManager->fetchCachedCredentials(httpRequest.url(), 0); if (!credential.user.isEmpty() && !credential.password.isEmpty()) { QAuthenticator auth; auth.setUser(credential.user); auth.setPassword(credential.password); httpConnection->d_func()->copyCredentials(-1, &auth, false); } } } // Send the request to the connection httpReply = httpConnection->sendRequest(httpRequest); httpReply->setParent(this); // Connect the reply signals that we need to handle and then forward if (synchronous) { connect(httpReply,SIGNAL(headerChanged()), this, SLOT(synchronousHeaderChangedSlot())); connect(httpReply,SIGNAL(finished()), this, SLOT(synchronousFinishedSlot())); connect(httpReply,SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), this, SLOT(synchronousFinishedWithErrorSlot(QNetworkReply::NetworkError,QString))); connect(httpReply, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), this, SLOT(synchronousAuthenticationRequiredSlot(QHttpNetworkRequest,QAuthenticator*))); #ifndef QT_NO_NETWORKPROXY connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(synchronousProxyAuthenticationRequiredSlot(QNetworkProxy,QAuthenticator*))); #endif // Don't care about ignored SSL errors for now in the synchronous HTTP case. } else if (!synchronous) {
void QNetworkAccessHttpBackend::postRequest() { bool loadedFromCache = false; QHttpNetworkRequest httpRequest; switch (operation()) { case QNetworkAccessManager::GetOperation: httpRequest.setOperation(QHttpNetworkRequest::Get); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::HeadOperation: httpRequest.setOperation(QHttpNetworkRequest::Head); validateCache(httpRequest, loadedFromCache); break; case QNetworkAccessManager::PostOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Post); httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::PutOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Put); httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::DeleteOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Delete); break; default: break; // can't happen } httpRequest.setUrl(url()); QList<QByteArray> headers = request().rawHeaderList(); foreach (const QByteArray &header, headers) httpRequest.setHeaderField(header, request().rawHeader(header)); if (loadedFromCache) { // commented this out since it will be called later anyway // by copyFinished() //QNetworkAccessBackend::finished(); return; // no need to send the request! :) } if (request().attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true) httpRequest.setPipeliningAllowed(true); httpReply = http->sendRequest(httpRequest); httpReply->setParent(this); #ifndef QT_NO_OPENSSL if (pendingSslConfiguration) httpReply->setSslConfiguration(*pendingSslConfiguration); if (pendingIgnoreAllSslErrors) httpReply->ignoreSslErrors(); httpReply->ignoreSslErrors(pendingIgnoreSslErrorsList); #endif connect(httpReply, SIGNAL(readyRead()), SLOT(replyReadyRead())); connect(httpReply, SIGNAL(finished()), SLOT(replyFinished())); connect(httpReply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)), SLOT(httpError(QNetworkReply::NetworkError,QString))); connect(httpReply, SIGNAL(headerChanged()), SLOT(replyHeaderChanged())); }