diff --git a/part/annotationactionhandler.cpp b/part/annotationactionhandler.cpp index 016785cad..92cc2748d 100644 --- a/part/annotationactionhandler.cpp +++ b/part/annotationactionhandler.cpp @@ -426,7 +426,7 @@ const QIcon AnnotationActionHandlerPrivate::stampIcon(const QString &stampIconNa void AnnotationActionHandlerPrivate::selectTool(int toolId) { selectedTool = toolId; - annotator->selectTool(toolId, PageViewAnnotator::ShowTip::Yes); + annotator->selectBuiltinTool(toolId, PageViewAnnotator::ShowTip::Yes); parseTool(toolId); } diff --git a/part/pageviewannotator.cpp b/part/pageviewannotator.cpp index c312dfa71..4bec0f691 100644 --- a/part/pageviewannotator.cpp +++ b/part/pageviewannotator.cpp @@ -1149,7 +1149,12 @@ void PageViewAnnotator::routePaint(QPainter *painter, const QRect paintRect) painter->restore(); } -void PageViewAnnotator::selectTool(int toolId, ShowTip showTip) +void PageViewAnnotator::selectBuiltinTool(int toolId, ShowTip showTip) +{ + selectTool(m_builtinToolsDefinition, toolId, showTip); +} + +void PageViewAnnotator::selectTool(AnnotationTools *toolsDefinition, int toolId, ShowTip showTip) { // ask for Author's name if not already set if (toolId > 0 && Okular::Settings::identityAuthor().isEmpty()) { @@ -1193,7 +1198,7 @@ void PageViewAnnotator::selectTool(int toolId, ShowTip showTip) } // for the selected tool create the Engine - QDomElement toolElement = m_builtinToolsDefinition->tool(toolId); + QDomElement toolElement = toolsDefinition->tool(toolId); if (!toolElement.isNull()) { // parse tool properties QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine")); @@ -1262,7 +1267,7 @@ void PageViewAnnotator::selectTool(int toolId, ShowTip showTip) void PageViewAnnotator::selectLastTool() { - selectTool(m_lastToolId, ShowTip::No); + selectBuiltinTool(m_lastToolId, ShowTip::No); } void PageViewAnnotator::selectStampTool(const QString &stampSymbol) @@ -1273,12 +1278,12 @@ void PageViewAnnotator::selectStampTool(const QString &stampSymbol) engineElement.setAttribute(QStringLiteral("hoverIcon"), stampSymbol); annotationElement.setAttribute(QStringLiteral("icon"), stampSymbol); saveBuiltinAnnotationTools(); - selectTool(STAMP_TOOL_ID, ShowTip::Yes); + selectBuiltinTool(STAMP_TOOL_ID, ShowTip::Yes); } void PageViewAnnotator::detachAnnotation() { - selectTool(-1, ShowTip::No); + selectBuiltinTool(-1, ShowTip::No); if (!signatureMode()) { if (m_actionHandler) m_actionHandler->deselectAllAnnotationActions(); diff --git a/part/pageviewannotator.h b/part/pageviewannotator.h index 5f939e365..515f4f492 100644 --- a/part/pageviewannotator.h +++ b/part/pageviewannotator.h @@ -107,7 +107,7 @@ public: enum class ShowTip { Yes, No }; // selects the active tool - void selectTool(int toolId, ShowTip showTip); + void selectBuiltinTool(int toolId, ShowTip showTip); // selects a stamp tool and sets the stamp symbol void selectStampTool(const QString &stampSymbol); // makes a quick annotation the active tool @@ -148,6 +148,8 @@ private: void reparseQuickToolsConfig(); // save the builtin annotation tools to Okular settings void saveBuiltinAnnotationTools(); + // selects the active tool + void selectTool(AnnotationTools *toolsDefinition, int toolId, ShowTip showTip); // returns the engine QDomElement of the the currently active tool QDomElement currentEngineElement(); // returns the annotation QDomElement of the the currently active tool