Commit 558742a0 authored by Simone Gaiarin's avatar Simone Gaiarin Committed by Albert Astals Cid
Browse files

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
parent 52acaf3a
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment