diff options
Diffstat (limited to 'qt-ui/subsurfacewebservices.cpp')
-rw-r--r-- | qt-ui/subsurfacewebservices.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 5170b3a40..c430deec6 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -49,7 +49,7 @@ static bool merge_locations_into_dives(void) sort_table(&gps_location_table); - for_each_gps_location(i, gpsfix) { + for_each_gps_location (i, gpsfix) { if (is_automatic_fix(gpsfix)) { dive = find_dive_including(gpsfix->when); if (dive && !dive_has_gps_location(dive)) { @@ -133,7 +133,9 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, } /* walk the dive list in chronological order */ - for (int i = 0; i < dive_table.nr; i++) { + int i; + struct dive *dive; + for_each_dive (i, dive) { FILE *f; char filename[PATH_MAX]; int streamsize; @@ -145,9 +147,6 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, * Get the i'th dive in XML format so we can process it. * We need to save to a file before we can reload it back into memory... */ - struct dive *dive = get_dive(i); - if (!dive) - continue; if (selected && !dive->selected) continue; f = tmpfile(); @@ -527,8 +526,8 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData) if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { result.errorCondition = invalidXmlError; result.errorDetails = - DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") - .arg(reader.name().toString()); + DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1") + .arg(reader.name().toString()); goto out; } @@ -581,8 +580,8 @@ out: // if there was an XML error, overwrite the result or other error conditions result.errorCondition = invalidXmlError; result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2") - .arg(reader.lineNumber()) - .arg(reader.errorString()); + .arg(reader.lineNumber()) + .arg(reader.errorString()); } return result; } @@ -602,11 +601,11 @@ void DivelogsDeWebServices::downloadDives() exec(); } -void DivelogsDeWebServices::prepareDivesForUpload() +void DivelogsDeWebServices::prepareDivesForUpload(bool selected) { /* generate a random filename and create/open that file with zip_open */ QString filename = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld"; - if (prepare_dives_for_divelogs(filename, true)) { + if (prepare_dives_for_divelogs(filename, selected)) { QFile f(filename); if (f.open(QIODevice::ReadOnly)) { uploadDives((QIODevice *)&f); |