Commit 2befe0e2 authored by David Faure's avatar David Faure
Browse files

Improve error message when saving

parent 9d2b543a
...@@ -286,12 +286,12 @@ static void CouldNotCreateTemporaryFileDialog (QWidget *parent) ...@@ -286,12 +286,12 @@ static void CouldNotCreateTemporaryFileDialog (QWidget *parent)
//--------------------------------------------------------------------- //---------------------------------------------------------------------
static void CouldNotSaveDialog (const QUrl &url, QWidget *parent) static void CouldNotSaveDialog (const QUrl &url, const QString &error, QWidget *parent)
{ {
// TODO: use file.errorString()
KMessageBox::error (parent, KMessageBox::error (parent,
i18n ("Could not save as \"%1\".", i18n ("Could not save as \"%1\": %2",
kpUrlFormatter::PrettyFilename (url))); kpUrlFormatter::PrettyFilename (url),
error));
} }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
...@@ -361,7 +361,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap, ...@@ -361,7 +361,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap,
qCDebug(kpLogDocument) << "\treturning false because could not save pixmap to device" qCDebug(kpLogDocument) << "\treturning false because could not save pixmap to device"
<< endl; << endl;
#endif #endif
::CouldNotSaveDialog (url, parent); ::CouldNotSaveDialog (url, i18n("Error saving image"), parent);
return false; return false;
} }
...@@ -374,7 +374,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap, ...@@ -374,7 +374,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap,
#if DEBUG_KP_DOCUMENT #if DEBUG_KP_DOCUMENT
qCDebug(kpLogDocument) << "\tcould not close QSaveFile"; qCDebug(kpLogDocument) << "\tcould not close QSaveFile";
#endif #endif
::CouldNotSaveDialog (url, parent); ::CouldNotSaveDialog (url, atomicFileWriter.errorString(), parent);
return false; return false;
} }
} // sync QSaveFile.cancelWriting() } // sync QSaveFile.cancelWriting()
...@@ -404,7 +404,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap, ...@@ -404,7 +404,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap,
qCDebug(kpLogDocument) << "\treturning false because could not save pixmap to device" qCDebug(kpLogDocument) << "\treturning false because could not save pixmap to device"
<< endl; << endl;
#endif #endif
::CouldNotSaveDialog (url, parent); ::CouldNotSaveDialog (url, i18n("Error saving image"), parent);
return false; return false;
} }
...@@ -422,7 +422,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap, ...@@ -422,7 +422,7 @@ bool kpDocument::savePixmapToFile (const QImage &pixmap,
#if DEBUG_KP_DOCUMENT #if DEBUG_KP_DOCUMENT
qCDebug(kpLogDocument) << "\treturning false because could not close"; qCDebug(kpLogDocument) << "\treturning false because could not close";
#endif #endif
::CouldNotSaveDialog (url, parent); ::CouldNotSaveDialog (url, tempFile.errorString(), parent);
return false; return false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment