[KJots] Port bookmarks code, unify link handling code
ClosedPublic

Authored by poboiko on Apr 21 2020, 10:20 PM.

Details

Summary

Link creation was present in three places:

  1. Inside template pagetemplate.html
  2. Inside KJotsLinkDialog, the dialog to add links
  3. Inside KJotsBookmarks

Unify it inside KJotsModel: provide a UrlRole for QModelIndex::data.
Provide an url property for KJotsEntity, so it could also be used in templates.

Link handling was also duplicated in two places:

  1. Inside KJotsBookmarks
  2. Inside KJotsBrowser

Unify it too, so both classes emit a signal with QUrl property, which is then caught by KJotsWidget
(which actually gets the job done)

Test Plan
  1. Navigation in the "Browser mode" works, clicking at "books", "pages" and "page headers" (which should switch to edit mode)
  2. Bookmarks also work, they are created with fancy icons, and navigation works (both with "pages" and "books")
  3. Link dialog creates proper links pointing where they should
  4. External links are being opened by an external web browser

Diff Detail

Repository
R573 KJots
Branch
fix-bookmarks (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25661
Build 25679: arc lint + arc unit
poboiko requested review of this revision.Apr 21 2020, 10:20 PM
poboiko created this revision.
poboiko updated this revision to Diff 80836.Apr 22 2020, 6:34 AM

Moved all URL handling to KJotsModel, added a modelIndexForUrl method which
is a wrapper around ETM::modelIndexForItem/modelIndexesForCollection.

Restricted Application added a project: KDE PIM. · View Herald TranscriptApr 22 2020, 6:34 AM
poboiko updated this revision to Diff 80837.Apr 22 2020, 6:34 AM

Rebase on master

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