The current annotation toolbar is not very flexible and can benefit from some modernization.
Some of the problems are:
- Custom toolbar UI not integrated with the other Qt toolbars
- Impossibility to change the color/font of the annotations on the fly (it is necessary to create a new tool with the desired color/font)
- Some tools are missing from the toolbar by default (e.g. squiggle underline, delete text, rectangle, ...)
- To keep an annotation tool selected one need to double click on an annotation (not intuitive/no tips for the user) (BUG: 358057)
- Incoherence between annotation icons used and one in config dialogs (BUG: 358065)
Note: This task has evolved from problems in the annotation configuration dialogs to usability problems in the annotation toolbar itself.
To-do
- Select and use text annotations (highlighter, underline, squiggle, strike out)
- Select and use note annotations (typewriter, inline note, popup note)
- Select and use drawing annotations (freehand line, straight line, rectangle, ellipse, polygon)
- Select and use stamp annotation (see also T8074) [possibly disable this button for PDF documents, see 383651]
- Pin annotation / The annotation remains selected after use if the pin button is checked
- Change (outer) color and opacity of annotations [Draft code in place for now]
- Change inner color and opacity of annotations
- Make color selectors a list of default colors with an option to select a custom color via a FileChooser
- Change size of lines (freehand, straight line, geometrical shapes)
- Change icon of popup note
- Change font of notes annotations (typewriter, inline note, popup note?)
- Change straight line line extensions ( via Advanced settings)
- Add mechanism to save annotation tools with custom options (quick tools) See T8076#186855
- Save state of pin action
- Prevent changing the annotation type of builtin annotations, when using the advanced setting menu (wait for D10859)
- Add real value of opacity and line width to the list of action if it is not one of the default values (e.g. if it was set with the advanced settings menu)
- Set width combo icons (generate programatically see D21364#469241)
- Activate line width action in one click (not just clicking on the down arrow)
- Click on a selected annotation should deselect it (see https://codereview.qt-project.org/c/qt/qtbase/+/255770)
- Selecting an annotation should switch to Browse mode
- Set default location of annotation toolbar under the main toolbar
- Show/hide toolbar from menu
- Set meaningful default shortcuts for implicit and/or explicit tools
- Set tooltips everywhere
- Add i18nc everywhere
- Reimplement code to enable/disable tools or text tools if document not editable
- Rename and move PageViewToolBar, not part of PageView anymore
- Do not deselect annotation when color dialog is closed by hitting Esc (how?)
- Show annotation toolbar when a quick annotation is activated
- Remove annotation fill color
- Document properties of tools.xml
- Disable ToolActionMenu and Quick Annotations if document is protected (but I still can add annotations?!)
Problems:- KSelectAction is an exclusive group, the action will become uncheckable
- The action is created after we setup the annotationActionHandler actions
- Add a menu entry to the context menu of 'quick annotation action' to open quick annotation config dialog (how?)
- Remove legacy code left hanging around after the changes
- Clean and refactor code
- Properly manage the upgrade of the configuration file during the upgrade of okular (in particular the AnnotationTools key).
Discuss
- Default toolbar aspect should be icons only or text alongside icons? (in this second case we need to shrink it)
- Stamp action shows the default action (Okular icon) by default, so it may not be clear to the user that it is the stamp action. How to workaround this? A possibility is to use KSelectAction in KSelectAction::MenuMode but in this case the action is never shown as checked.
Delegate
- Create proper icons for all annotation (see BUG: 408283)
- Update documentation (some icons used in the doc will be removed)
Future improvements
- Remove unused icons from ui/data
- Use better engine hoover icons / Make them match to the resulting icons and those in the config dialog
- Allow setting the inline note text color (code is ready, but setting the text color sets also the border color some needs some discussion)
- Deselect Browse mode when an annotation action is checked (needs Qt 5.14)
- Remove non-exclusive QActionGroup workaround (needs Qt 5.14)