diff options
author | Thiago Macieira <thiago@macieira.org> | 2013-11-14 18:57:09 -0800 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2013-12-03 13:53:00 -0800 |
commit | a1972bc3433d2e412147a6925787ffee66adcb4b (patch) | |
tree | f91c750dcbdb00b0c234046992838d25eb7d8b96 /qt-ui/subsurfacewebservices.h | |
parent | bffb384c0fecdef515d7cc10a5f7e44ddbaa2aa8 (diff) | |
download | subsurface-a1972bc3433d2e412147a6925787ffee66adcb4b.tar.gz |
Implement the network part of the support for divelogs.de
This implements support for:
* uploading a zip file containing dives - untested
(the zip file must have been prepared elsewhere)
* downloading the dive list and the dive XML files
The networking part is finished, but it's missing the actual import of
the XML files sent by divelogs.de.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui/subsurfacewebservices.h')
-rw-r--r-- | qt-ui/subsurfacewebservices.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/subsurfacewebservices.h b/qt-ui/subsurfacewebservices.h index 89c41e4dd..3c41b08d1 100644 --- a/qt-ui/subsurfacewebservices.h +++ b/qt-ui/subsurfacewebservices.h @@ -3,6 +3,7 @@ #include <QDialog> #include <QNetworkReply> +#include <QTemporaryFile> #include <QTimer> #include <libxml/tree.h> @@ -10,6 +11,7 @@ class QAbstractButton; class QNetworkReply; +class QHttpMultiPart; class WebServices : public QDialog{ Q_OBJECT @@ -17,6 +19,7 @@ public: explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0); void hidePassword(); void hideUpload(); + void hideDownload(); static QNetworkAccessManager *manager(); @@ -32,6 +35,7 @@ protected slots: protected: void resetState(); void connectSignalsForDownload(QNetworkReply *reply); + void connectSignalsForUpload(); Ui::WebServices ui; QNetworkReply *reply; @@ -61,18 +65,27 @@ class DivelogsDeWebServices : public WebServices { Q_OBJECT public: static DivelogsDeWebServices * instance(); + void downloadDives(); + void uploadDives(QIODevice *dldContent); private slots: void startDownload(); void buttonClicked(QAbstractButton* button); + void saveToZipFile(); + void listDownloadFinished(); void downloadFinished(); + void uploadFinished(); void downloadError(QNetworkReply::NetworkError error); + void uploadError(QNetworkReply::NetworkError error); void startUpload(); private: explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0); void setStatusText(int status); void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status); unsigned int download_dialog_parse_response(const QByteArray& length); + + QHttpMultiPart *multipart; + QTemporaryFile zipFile; }; #endif |