summaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-18 14:44:07 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-18 14:44:07 -0800
commitd9ded26b86e9df8a87f92a5d7ad21f7fbce6edb6 (patch)
tree38780c771e99b4cc70a0875808eb78a682918884 /qt-mobile
parent4cf20c34489a9f3a53cece13ec07cba44aa44487 (diff)
downloadsubsurface-d9ded26b86e9df8a87f92a5d7ad21f7fbce6edb6.tar.gz
Location service: set user agent string
This allows the backend to know which version of Subsurface is contacting it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/gpslocation.cpp3
-rw-r--r--qt-mobile/gpslocation.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp
index f78a482a0..b109a01a3 100644
--- a/qt-mobile/gpslocation.cpp
+++ b/qt-mobile/gpslocation.cpp
@@ -28,6 +28,7 @@ GpsLocation::GpsLocation(QObject *parent)
} else {
status("don't have GPS source");
}
+ userAgent = getUserAgent();
}
void GpsLocation::serviceEnable(bool toggle)
@@ -95,6 +96,7 @@ QString GpsLocation::getUserid(QString user, QString passwd)
data = user + " " + passwd;
QNetworkRequest request;
request.setUrl(url);
+ request.setRawHeader("User-Agent", getUserAgent().toUtf8());
request.setRawHeader("Accept", "text/html");
request.setRawHeader("Content-type", "application/x-www-form-urlencoded");
reply = manager->post(request, data.toUtf8());
@@ -299,6 +301,7 @@ void GpsLocation::uploadToServer()
status(data.toString(QUrl::FullyEncoded).toUtf8());
QNetworkRequest request;
request.setUrl(url);
+ request.setRawHeader("User-Agent", getUserAgent().toUtf8());
request.setRawHeader("Accept", "text/json");
request.setRawHeader("Content-type", "application/x-www-form-urlencoded");
reply = manager->post(request, data.toString(QUrl::FullyEncoded).toUtf8());
diff --git a/qt-mobile/gpslocation.h b/qt-mobile/gpslocation.h
index d00fbae6a..82cab8082 100644
--- a/qt-mobile/gpslocation.h
+++ b/qt-mobile/gpslocation.h
@@ -24,6 +24,7 @@ private:
void status(QString msg);
QSettings *geoSettings;
QNetworkReply *reply;
+ QString userAgent;
signals: