Divelogs.de: Improve the error handling post DLD creation

Only show a filename in the error report if such was previsly
set. We also add a string for translation, that is shown
in the main window.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Lubomir I. Ivanov 2013-12-09 16:07:00 +02:00
parent ca731cef89
commit de8d532adb

View file

@ -539,6 +539,7 @@ void DivelogsDeWebServices::downloadDives()
void DivelogsDeWebServices::prepareDivesForUpload() void DivelogsDeWebServices::prepareDivesForUpload()
{ {
QString errorText(tr("Cannot create DLD file"));
char *filename = prepare_dives_for_divelogs(true); char *filename = prepare_dives_for_divelogs(true);
if (filename) { if (filename) {
QFile f(filename); QFile f(filename);
@ -549,8 +550,10 @@ void DivelogsDeWebServices::prepareDivesForUpload()
f.remove(); f.remove();
return; return;
} }
mainWindow()->showError(QString("Cannot create file: ").append(filename)); mainWindow()->showError(errorText.append(": ").append(filename));
return;
} }
mainWindow()->showError(errorText.append("!"));
} }
void DivelogsDeWebServices::uploadDives(QIODevice *dldContent) void DivelogsDeWebServices::uploadDives(QIODevice *dldContent)