diff --git a/src/JsonRideFile.y b/src/JsonRideFile.y index 98a5e714c..ef9ab0fa1 100644 --- a/src/JsonRideFile.y +++ b/src/JsonRideFile.y @@ -229,7 +229,7 @@ static int jsonFileReaderRegistered = "json", "GoldenCheetah Json Format", new JsonFileReader()); RideFile * -JsonFileReader::openRideFile(QFile &file, QStringList &errors) const +JsonFileReader::openRideFile(QFile &file, QStringList &errors, QList*) const { // jsonRide is local and static, used in the parser // JsonRideFilein is the FILE * used by the lexer diff --git a/src/RideImportWizard.cpp b/src/RideImportWizard.cpp index 7c2dbe4fe..312bcb755 100644 --- a/src/RideImportWizard.cpp +++ b/src/RideImportWizard.cpp @@ -34,6 +34,7 @@ // drag and drop passes urls ... convert to a list of files and call main constructor RideImportWizard::RideImportWizard(QList *urls, QDir &home, MainWindow *main, QWidget *parent) : QDialog(parent), mainWindow(main) { + setAttribute(Qt::WA_DeleteOnClose); setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); QList filenames; for (int i=0; icount(); i++) @@ -303,6 +304,7 @@ RideImportWizard::process() TcxFileReader reader; QFile target(fulltarget); reader.writeRideFile(mainWindow, mainWindow->cyclist, extracted, target); + deleteMe.append(fulltarget); // now add each temporary file ... filenames.insert(here, fulltarget); @@ -867,27 +869,10 @@ RideImportWizard::abortClicked() aborted = false; } -// destructor - not sure it ever gets called tho, even by RideImportWizard::done() +// clean up files RideImportWizard::~RideImportWizard() { - // Fill in the filenames and all the textItems - for (int i=0; i < filenames.count(); i++) { - QTableWidgetItem *t; - t = tableWidget->item(i,0); delete t; - t = tableWidget->item(i,1); delete t; - t = tableWidget->item(i,2); delete t; - t = tableWidget->item(i,3); delete t; - t = tableWidget->item(i,4); delete t; - t = tableWidget->item(i,5); delete t; - } - delete tableWidget; - filenames.clear(); - delete phaseLabel; - delete progressBar; - delete abortButton; - delete cancelButton; - delete todayButton; - delete overFiles; + foreach(QString name, deleteMe) QFile(name).remove(); } diff --git a/src/RideImportWizard.h b/src/RideImportWizard.h index 747bed84a..6de5af2ec 100644 --- a/src/RideImportWizard.h +++ b/src/RideImportWizard.h @@ -67,6 +67,8 @@ private: QCheckBox *overFiles; // chance to set overwrite when asking for dates bool overwriteFiles; // flag to overwrite files from checkbox MainWindow *mainWindow; // caller + + QStringList deleteMe; // list of temp files created during import }; // Item Delegate for Editing Date and Time of Ride inside the