Fix duplicate and markup displaying failed-save message box
ClosedPublic

Authored by muhlenpfordt on Apr 18 2018, 7:17 AM.

Details

Summary

When saving of a file fails, two dialogs are displayed. One of them
contains markup tags like <html> and <tt>.
The duplicate message box is caused by KJob's (not disabled) internal
error handling. The markup is displayed because of using strings with
markup as argument for xi18n* functions without special handling.

BUG: 393170
FIXED-IN: 18.04.1

Test Plan
  1. Open Gwenview in View or Browse Mode
  2. FileSave As or Ctrl++S
  3. Try to save in a folder you don't have write permission (e.g. Root)
  4. Error message box should display only once and without markup tags
  1. Open Gwenview in View or Browse Mode
  2. Edit a readonly file (e.g. rotate with Ctrl+R)
  3. Click Save or Save All
  4. Error message box should display only once and without markup tags

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
muhlenpfordt requested review of this revision.Apr 18 2018, 7:17 AM
muhlenpfordt created this revision.

Guide on how to add markup containing arguments to xi18n*: KI18n -> Escaping


There are two console warnings caused by wrong markup for xi18n*:

"Tag 'b' is not defined in message {<__kuit_internal_top__>...
"Tag 'br' is not defined in message {<__kuit_internal_top__>...

I'll do an additional patch for master since this changes the visible strings.

lib/document/savejob.cpp
109

This modification changes the display from file:///folder/ to /folder/ for local files.

rkflx accepted this revision.Apr 18 2018, 9:29 PM
rkflx added a subscriber: rkflx.

LGTM, thanks!

There are two console warnings caused by wrong markup for xi18n*:

doc->errorString() is also used in GvCore::saveAs and in ImportDialogPrivate::deleteImportedUrls. Are you referring to those?


You may have noticed it already, but if not:

  • The Save As button in the warning dialog is broken in the sense that is does not allow you to save the image in the end ("Gwenview cannot save this kind of documents.").
  • For overwriting in general, there are also quite a few dialogs to click through…

Should I open new bug reports?

lib/document/savejob.cpp
109

Agreed, but please split this out into a separate commit on master (no need for a Diff).

This revision is now accepted and ready to land.Apr 18 2018, 9:29 PM
muhlenpfordt marked an inline comment as done.

Removed Url shortening option

There are two console warnings caused by wrong markup for xi18n*:

doc->errorString() is also used in GvCore::saveAs and in ImportDialogPrivate::deleteImportedUrls. Are you referring to those?

These warnings are caused by the string <b>Saving <filename>%1</filename> failed:</b><br />%2 in GvCore::saveAs().
xi18n* needs <emphasis strong='true'> instead of <b> and <nl> instead of <br> (found this hint here: D6815).
Error strings from a KJob itself should be no problem since they are plain text.

You may have noticed it already, but if not:

  • The Save As button in the warning dialog is broken in the sense that is does not allow you to save the image in the end ("Gwenview cannot save this kind of documents.").
  • For overwriting in general, there are also quite a few dialogs to click through…

I noticed only the second. I'll take a look at these, don't think we need a bug report.

This revision was automatically updated to reflect the committed changes.

Agreed, but please split this out into a separate commit on master (no need for a Diff).

Changed here: 8d8cfbd66184