[KJotsTreeView] Fix "copy link address" action
ClosedPublic

Authored by poboiko on Apr 22 2020, 11:47 AM.

Details

Summary

Previously, it copied an internal Akonadi url (i.e. akonadi://?item=...),
which isn't recognized with KJots. Use newly introduced KJotsModel::UrlRole instead.

The pasting code (KJotsEdit) did not cope well with unicode
(it was converted to QLatin1String before pasting), fixed that as well.

Also, used QStringLiteral instead of QLatin1String for methods that don't have QLatin1String overload.

Test Plan
  1. Open KJots, right click on a book with non-latin1 title -> Copy Link Address
  2. It can be pasted inside KJots without problems

Diff Detail

Repository
R573 KJots
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
poboiko created this revision.Apr 22 2020, 11:47 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 22 2020, 11:47 AM
poboiko requested review of this revision.Apr 22 2020, 11:47 AM
dvratil requested changes to this revision.Apr 22 2020, 12:07 PM
dvratil added inline comments.
src/kjotstreeview.cpp
179

Does this actually need to be localized? There's nothing to localize, really :)

This revision now requires changes to proceed.Apr 22 2020, 12:07 PM
poboiko added a subscriber: pino.Apr 22 2020, 1:06 PM
poboiko added inline comments.
src/kjotstreeview.cpp
179

I thought so too at first. But then, @pino asked me about localizing string like "%1 -> %2", so now I'm a bit afraid :)
(probably there might be something specific for arabic languages which use rtl, which I actually haven't thought of originally)

Is there some sort of a guide or a checklist of stuff which one has to store in head when translating messages? :)

pino added inline comments.Apr 22 2020, 1:38 PM
src/kjotstreeview.cpp
179

"%1 -> %2" needed to be translatable because it is more than a simple "show this metadata to the user", and there is some room for adaptation by translation teams according to their language (say use an unicode arrow, or even show a text in case the arrow doesn't make sense for a language)

in this case i'd say there is nothing to translate, as you are showing directly the title of a book as title for a link.

poboiko updated this revision to Diff 80905.Apr 22 2020, 3:45 PM
poboiko marked 3 inline comments as done.

Remove useless i18nc

poboiko added inline comments.Apr 22 2020, 3:45 PM
src/kjotstreeview.cpp
179

OK, haven't thought of it actually. It makes sense, thanks!

dvratil accepted this revision.Apr 24 2020, 7:25 AM
This revision is now accepted and ready to land.Apr 24 2020, 7:25 AM
This revision was automatically updated to reflect the committed changes.