std::string fileName() { std::string url = fullUrl(); int i = url.find_last_of('/'); std::string fileName = url.substr(i + 1); return fileName; }
SimRequest::SimRequest(String url, String mimeType) : m_url(url) , m_loader(nullptr) , m_client(nullptr) , m_totalEncodedDataLength(0) , m_isReady(false) { KURL fullUrl(ParsedURLString, url); WebURLResponse response(fullUrl); response.setMIMEType(mimeType); response.setHTTPStatusCode(200); Platform::current()->unitTestSupport()->registerMockedURL(fullUrl, response, ""); SimNetwork::current().addRequest(*this); }
QNetworkReply* Ytv::searchAddress(const QString &address) { qDebug() << "Searching for address (" << address << ")"; QUrl fullUrl(Url); fullUrl.addEncodedQueryItem( "key", address.toAscii().toPercentEncoding() ); fullUrl.addQueryItem( "user", Username ); fullUrl.addQueryItem( "pass", Password ); qDebug() << "The query url: " << fullUrl.toString(); return manager.get(QNetworkRequest(fullUrl)); };
void CLogRequest::Send( void ) { std::string fullUrl(mTrackUrl); fullUrl += mData; mSendTries++; if(gPlaytomic->IsWiFiActive()) { gConnectionInterface->PerformAsyncRequest(fullUrl.c_str(), fastdelegate::MakeDelegate(this, &CLogRequest::RequestComplete), false); } else { SaveToFile(); if(mMustReleaseOnFinished) { //TODO please change this to an object delete list delete this; } } }
EventSource* EventSource::create(const String& url, IEventSourceReceiver* receiver, const Hashtable<String,String>& eventSourceInit ) { LOG(TRACE) + "Creating EventSource with URL: " + url; if (url.empty()) { return 0; } String fullUrl( (url.find("://")==String::npos)? (RHODESAPP().getCurrentUrl(-1) + url): (url) ); LOG(TRACE) + "Full URL for EventSource: " + fullUrl; EventSource* source = new EventSource(fullUrl, receiver, eventSourceInit); source->scheduleInitialConnect(); return source; }
void RouteFinder::startRouteSearch() { qDebug() << "Ready to search for route now."; QUrl fullUrl( Ytv::Url ); QStringList a; a << this->from->x() << this->from->y(); QStringList b; b << this->to->x() << this->to->y(); fullUrl.addQueryItem( "a", a.join(",") ); fullUrl.addQueryItem( "b", b.join(",") ); fullUrl.addQueryItem( "show", QString::number(Ytv::ShowFiveResults) ); fullUrl.addQueryItem( "walkspeed", QString::number(Ytv::WalkSpeedFast) ); fullUrl.addQueryItem( "optimize", QString::number(Ytv::OptimizeDefault) ); fullUrl.addQueryItem( "user", Ytv::Username); fullUrl.addQueryItem( "pass", Ytv::Password); qDebug() << "The query url: " << fullUrl.toString(); this->reply = Ytv::manager.get(QNetworkRequest(fullUrl)); this->connect(this->reply, SIGNAL(finished()), SLOT(requestFinished())); }
bool NewAccountPage::validatePage() { if(hasCreatedAccount) { return true; } serverQueryFinished = false; serverQueryError = false; //Check if passwords match if(input_password->text() != input_confirmPassword->text()) { label_message->setText(tr("<font color='red'>Passwords do not match</font>")); return false; } label_message->setText("Creating account..."); QUrl baseUrl( "https://api.screencloud.net/1.0/users/register.xml" ); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QUrlQuery query(baseUrl); #else QUrl query(baseUrl); #endif query.addQueryItem("oauth_version", "1.0"); query.addQueryItem("oauth_signature_method", "PLAINTEXT"); query.addQueryItem("oauth_consumer_key", CONSUMER_KEY_SCREENCLOUD); query.addQueryItem("oauth_signature", CONSUMER_SECRET_SCREENCLOUD); query.addQueryItem("oauth_timestamp", QString::number(QDateTime::currentDateTimeUtc().toTime_t())); query.addQueryItem("oauth_nonce", NetworkUtils::generateNonce(15)); // create a request parameters map #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QUrlQuery bodyParams; #else QUrl bodyParams; #endif bodyParams.addQueryItem("data[User][email]", input_email->text()); bodyParams.addQueryItem("data[User][password]", input_password->text()); bodyParams.addQueryItem("data[User][password_confirmation]", input_confirmPassword->text()); // construct the body string #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QByteArray body = bodyParams.query(QUrl::FullyEncoded).toUtf8(); #else QByteArray body = bodyParams.encodedQuery(); #endif #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QUrl fullUrl(baseUrl); fullUrl.setQuery(query); #else QUrl fullUrl(query); #endif QNetworkRequest request; request.setUrl(fullUrl); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); manager->post(request, body); while (!serverQueryFinished) { qApp->processEvents(QEventLoop::WaitForMoreEvents); } if(serverQueryError) { return false; } hasCreatedAccount = true; return true; }
void Viewer::renderHtml(QString html, QString url) { emit urlChanged(url); QUrl fullUrl(url); webView->setHtml(html, QUrl(fullUrl.toString(QUrl::RemovePath))); }