diff --git a/conf/okular.kcfg b/conf/okular.kcfg index 51e13fd5d..b68991df3 100644 --- a/conf/okular.kcfg +++ b/conf/okular.kcfg @@ -79,9 +79,9 @@ drawingTools - + - QStringList annotationTools; + QStringList builtinAnnotationTools; // load the default tool list from the 'xml tools definition' file QFile infoFile( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/tools.xml") ); if ( infoFile.exists() && infoFile.open( QIODevice::ReadOnly ) ) @@ -90,7 +90,7 @@ if ( doc.setContent( &infoFile ) ) { QDomElement toolsDefinition = doc.elementsByTagName("annotatingTools").item( 0 ).toElement(); - // create the annotationTools list from the XML dom tree + // create the builtinAnnotationTools list from the XML dom tree QDomNode toolDescription = toolsDefinition.firstChild(); while ( toolDescription.isElement() ) { @@ -100,7 +100,7 @@ QDomDocument temp; temp.appendChild( temp.importNode( toolElement, true) ); // add each <tool>...</tool> as XML string - annotationTools << temp.toString(-1); + builtinAnnotationTools << temp.toString(-1); } toolDescription = toolDescription.nextSibling(); } @@ -115,7 +115,7 @@ qWarning() << "Unable to open AnnotatingTools XML definition"; } - annotationTools + builtinAnnotationTools diff --git a/okular.upd b/okular.upd index f099e0168..bb0448fd9 100644 --- a/okular.upd +++ b/okular.upd @@ -6,3 +6,9 @@ Id=annotation-toolbar File=okularpartrc Group=Reviews Key=AnnotationTools,QuickAnnotationTools + +#Remove key that stored the state of the bultin annotation tools (now stored in BuiltinAnnoationTools) +Id=builtin-annotations +File=okularpartrc +Group=Reviews +RemoveKey=AnnotationTools diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp index 9ac5ce06a..9bc05666c 100644 --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -719,7 +719,7 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage , m_pageView(parent) , m_actionHandler(nullptr) , m_engine(nullptr) - , m_toolsDefinition(nullptr) + , m_builtinToolsDefinition(nullptr) , m_quickToolsDefinition(nullptr) , m_continuousMode(true) , m_constrainRatioAndAngle(false) @@ -732,9 +732,9 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage void PageViewAnnotator::reparseConfig() { // Read tool list from configuration. It's a list of XML elements - if (!m_toolsDefinition) - m_toolsDefinition = new AnnotationTools(); - m_toolsDefinition->setTools(Okular::Settings::annotationTools()); + if (!m_builtinToolsDefinition) + m_builtinToolsDefinition = new AnnotationTools(); + m_builtinToolsDefinition->setTools(Okular::Settings::builtinAnnotationTools()); if (!m_quickToolsDefinition) m_quickToolsDefinition = new AnnotationTools(); @@ -972,7 +972,7 @@ void PageViewAnnotator::selectTool(int toolID) } // for the selected tool create the Engine - QDomElement toolElement = m_toolsDefinition->tool(toolID); + QDomElement toolElement = m_builtinToolsDefinition->tool(toolID); if (!toolElement.isNull()) { // parse tool properties QDomElement engineElement = toolElement.firstChildElement(QStringLiteral("engine")); @@ -1268,7 +1268,7 @@ void PageViewAnnotator::setTextToolsEnabled(bool enabled) void PageViewAnnotator::saveAnnotationTools() { - Okular::Settings::setAnnotationTools(m_toolsDefinition->toStringList()); + Okular::Settings::setBuiltinAnnotationTools(m_builtinToolsDefinition->toStringList()); Okular::Settings::setQuickAnnotationTools(m_quickToolsDefinition->toStringList()); Okular::Settings::self()->save(); } @@ -1278,8 +1278,8 @@ int PageViewAnnotator::setQuickTool(int favToolID) int toolId = -1; QDomElement favToolElement = m_quickToolsDefinition->tool(favToolID); if (!favToolElement.isNull()) { - toolId = m_toolsDefinition->findToolId(favToolElement.attribute(QStringLiteral("type"))); - if (m_toolsDefinition->updateTool(favToolElement, toolId)) + toolId = m_builtinToolsDefinition->findToolId(favToolElement.attribute(QStringLiteral("type"))); + if (m_builtinToolsDefinition->updateTool(favToolElement, toolId)) saveAnnotationTools(); } return toolId; @@ -1287,7 +1287,7 @@ int PageViewAnnotator::setQuickTool(int favToolID) QDomElement PageViewAnnotator::builtinTool(int toolID) { - return m_toolsDefinition->tool(toolID); + return m_builtinToolsDefinition->tool(toolID); } QDomElement PageViewAnnotator::quickTool(int toolID) @@ -1297,7 +1297,7 @@ QDomElement PageViewAnnotator::quickTool(int toolID) QDomElement PageViewAnnotator::currentEngineElement() { - return m_toolsDefinition->tool(m_lastToolID).firstChildElement(QStringLiteral("engine")); + return m_builtinToolsDefinition->tool(m_lastToolID).firstChildElement(QStringLiteral("engine")); } QDomElement PageViewAnnotator::currentAnnotationElement() @@ -1354,7 +1354,7 @@ void PageViewAnnotator::setAnnotationFont(const QFont &font) void PageViewAnnotator::addToQuickAnnotations() { - QDomElement sourceToolElement = m_toolsDefinition->tool(m_lastToolID); + QDomElement sourceToolElement = m_builtinToolsDefinition->tool(m_lastToolID); if (sourceToolElement.isNull()) return; @@ -1374,7 +1374,7 @@ void PageViewAnnotator::addToQuickAnnotations() void PageViewAnnotator::slotAdvancedSettings() { - QDomElement toolElement = m_toolsDefinition->tool(m_lastToolID); + QDomElement toolElement = m_builtinToolsDefinition->tool(m_lastToolID); EditAnnotToolDialog t(nullptr, toolElement, true); if (t.exec() != QDialog::Accepted) @@ -1382,7 +1382,7 @@ void PageViewAnnotator::slotAdvancedSettings() QDomElement toolElementUpdated = t.toolXml().documentElement(); int toolID = toolElement.attribute(QStringLiteral("id")).toInt(); - m_toolsDefinition->updateTool(toolElementUpdated, toolID); + m_builtinToolsDefinition->updateTool(toolElementUpdated, toolID); saveAnnotationTools(); selectTool(m_lastToolID); } diff --git a/ui/pageviewannotator.h b/ui/pageviewannotator.h index 3c1ebdda5..63b3e172e 100644 --- a/ui/pageviewannotator.h +++ b/ui/pageviewannotator.h @@ -44,12 +44,12 @@ class PageView; * to this class that performs a rough visual representation of what the * annotation will become when finished. * - * m_toolsDefinition is a AnnotationTools object that wraps a DOM object that + * m_builtinToolsDefinition is a AnnotationTools object that wraps a DOM object that * contains Annotations/Engine association for the items placed in the toolbar. * The XML is parsed after selecting a toolbar item, in which case an Ann is * initialized with the values in the XML and an engine is created to handle - * that annotation. m_toolsDefinition is created in reparseConfig according to - * user configuration. m_toolsDefinition is updated (and saved to disk) (1) each + * that annotation. m_builtinToolsDefinition is created in reparseConfig according to + * user configuration. m_builtinToolsDefinition is updated (and saved to disk) (1) each * time a property of an annotation (color, font, etc) is changed by the user, * and (2) each time a "quick annotation" is selected, in which case the properties * of the selected quick annotation are written over those of the corresponding @@ -149,7 +149,7 @@ private: PageView *m_pageView; AnnotationActionHandler *m_actionHandler; AnnotatorEngine *m_engine; - AnnotationTools *m_toolsDefinition; + AnnotationTools *m_builtinToolsDefinition; AnnotationTools *m_quickToolsDefinition; bool m_continuousMode; bool m_constrainRatioAndAngle;