Ensure "Quick annotations" action is always disabled on protected pdf

If the annotations are disabled in the current pdf we can skip repopulating "Quick annotations" and in this way we also assure that the enabled/disabled state of the action is preserved upon configuration reparsing.

d->toolsEnabled must be initialized to true, in order to correctly populate the "Quick annotations" action the first time for non-protected pdf, given that setToolsEnabled is called after the first call to populateQuickAnnotations.

BUG: 424296
FIXED-IN: 1.11.0
remotes/origin/work/aacid/annoying_braces
Simone Gaiarin 6 years ago committed by Albert Astals Cid
parent 52acaf3a9a
commit 558742a009
  1. 5
      ui/annotationactionhandler.cpp

@ -330,6 +330,10 @@ void AnnotationActionHandlerPrivate::updateConfigActions(const QString &annotTyp
void AnnotationActionHandlerPrivate::populateQuickAnnotations()
{
if (!aQuickTools->isEnabled()) {
return;
}
const QList<int> numberKeys = {Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5, Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0};
textQuickTools->clear();
@ -616,6 +620,7 @@ AnnotationActionHandler::AnnotationActionHandler(PageViewAnnotator *parent, KAct
d->aQuickTools = new KSelectAction(QIcon::fromTheme(QStringLiteral("draw-freehand")), i18nc("@action:intoolbar Show list of quick annotation tools", "Quick Annotations"), this);
d->aQuickTools->setToolTip(i18nc("@info:tooltip", "Choose an annotation tool from the quick annotations"));
d->aQuickTools->setToolBarMode(KSelectAction::MenuMode);
d->aQuickTools->setEnabled(true); // required to ensure that populateQuickAnnotations is executed the first time
d->populateQuickAnnotations();
// Add to quick annotation action

Loading…
Cancel
Save