Divelogs.de: add a divelist context menu item for upload

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2013-12-05 18:28:28 +02:00
parent be16ade038
commit 5869712569
3 changed files with 11 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include "models.h"
#include "modeldelegates.h"
#include "mainwindow.h"
#include "subsurfacewebservices.h"
#include "../display.h"
#include <QApplication>
#include <QHeaderView>
@ -726,6 +727,8 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
popup.addAction(tr("export As UDDF"), this, SLOT(exportSelectedDivesAsUDDF()));
popup.addAction(tr("shift times"), this, SLOT(shiftTimes()));
}
if (d)
popup.addAction(tr("upload dive(s) to divelogs.de"), this, SLOT(uploadToDivelogsDE()));
// "collapse all" really closes all trips,
// "collapse" keeps the trip with the selected dive open
QAction * actionTaken = popup.exec(event->globalPos());
@ -781,3 +784,8 @@ void DiveListView::shiftTimes()
{
ShiftTimesDialog::instance()->show();
}
void DiveListView::uploadToDivelogsDE()
{
DivelogsDeWebServices::instance()->prepareDivesForUpload();
}

View file

@ -49,6 +49,7 @@ public slots:
void saveSelectedDivesAs();
void exportSelectedDivesAsUDDF();
void shiftTimes();
void uploadToDivelogsDE();
signals:
void currentDiveChanged(int divenr);

View file

@ -66,7 +66,7 @@ class DivelogsDeWebServices : public WebServices {
public:
static DivelogsDeWebServices * instance();
void downloadDives();
void uploadDives(QIODevice *dldContent);
void prepareDivesForUpload();
private slots:
void startDownload();
@ -79,6 +79,7 @@ private slots:
void uploadError(QNetworkReply::NetworkError error);
void startUpload();
private:
void uploadDives(QIODevice *dldContent);
explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0);
void setStatusText(int status);
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);