Commit 580cbce8 authored by Simone Gaiarin's avatar Simone Gaiarin

Selectively reparse builtin and quick annotation tool configuration

parent 91dbaa1f
......@@ -437,7 +437,7 @@ ki18n_wrap_ui(okularpart_SRCS
conf/dlgpresentationbase.ui
)
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc)
kconfig_add_kcfg_files(okularpart_SRCS GENERATE_MOC conf/settings.kcfgc)
add_library(okularpart SHARED ${okularpart_SRCS})
generate_export_header(okularpart BASE_NAME okularpart)
......
......@@ -5,6 +5,8 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<include>kuser.h</include>
<kcfgfile arg="true" />
<signal name="builtinAnnotationToolsChanged" />
<signal name="quickAnnotationToolsChanged" />
<group name="Dlg Performance" >
<entry key="EnableCompositing" type="Bool" >
<default>true</default>
......@@ -116,6 +118,7 @@
}
</code>
<default code="true">builtinAnnotationTools</default>
<emit signal="builtinAnnotationToolsChanged" />
</entry>
<entry key="QuickAnnotationTools" type="StringList">
<code>
......@@ -154,6 +157,7 @@
}
</code>
<default code="true">quickAnnotationTools</default>
<emit signal="quickAnnotationToolsChanged" />
</entry>
<entry key="AnnotationContinuousMode" type="Bool">
<default>true</default>
......
......@@ -20,7 +20,7 @@ set(okular_SRCS
okularsingleton.cpp
)
kconfig_add_kcfg_files(okular_SRCS ${CMAKE_SOURCE_DIR}/conf/settings_mobile.kcfgc)
kconfig_add_kcfg_files(okular_SRCS GENERATE_MOC ${CMAKE_SOURCE_DIR}/conf/settings_mobile.kcfgc)
add_library(okularplugin SHARED ${okular_SRCS})
set_target_properties(okularplugin PROPERTIES COMPILE_DEFINITIONS "okularpart_EXPORTS")
......
......@@ -726,9 +726,13 @@ void AnnotationActionHandler::setupAnnotationToolBarVisibilityAction()
connect(d->aShowToolBar, &QAction::toggled, this, [this](bool checked) { d->slotToolBarVisibilityChanged(checked); });
}
void AnnotationActionHandler::reparseTools()
void AnnotationActionHandler::reparseBuiltinToolsConfig()
{
d->parseTool(d->selectedTool);
}
void AnnotationActionHandler::reparseQuickToolsConfig()
{
d->populateQuickAnnotations();
}
......
......@@ -39,7 +39,8 @@ public:
* selected, an annotation property (line width, colors, opacity, font) is modified.
*/
void setupAnnotationToolBarVisibilityAction();
void reparseTools();
void reparseBuiltinToolsConfig();
void reparseQuickToolsConfig();
void setToolsEnabled(bool on);
void setTextToolsEnabled(bool on);
void deselectAllAnnotationActions();
......
......@@ -733,26 +733,40 @@ PageViewAnnotator::PageViewAnnotator(PageView *parent, Okular::Document *storage
, m_lockedItem(nullptr)
{
reparseConfig();
reparseBuiltinToolsConfig();
reparseQuickToolsConfig();
connect(Okular::Settings::self(), &Okular::Settings::builtinAnnotationToolsChanged, this, &PageViewAnnotator::reparseBuiltinToolsConfig);
connect(Okular::Settings::self(), &Okular::Settings::quickAnnotationToolsChanged, this, &PageViewAnnotator::reparseQuickToolsConfig);
}
void PageViewAnnotator::reparseConfig()
{
m_continuousMode = Okular::Settings::annotationContinuousMode();
if (Okular::Settings::identityAuthor().isEmpty())
detachAnnotation();
}
void PageViewAnnotator::reparseBuiltinToolsConfig()
{
// Read tool list from configuration. It's a list of XML <tool></tool> elements
if (!m_builtinToolsDefinition)
m_builtinToolsDefinition = new AnnotationTools();
m_builtinToolsDefinition->setTools(Okular::Settings::builtinAnnotationTools());
if (m_actionHandler)
m_actionHandler->reparseBuiltinToolsConfig();
}
void PageViewAnnotator::reparseQuickToolsConfig()
{
// Read tool list from configuration. It's a list of XML <tool></tool> elements
if (!m_quickToolsDefinition)
m_quickToolsDefinition = new AnnotationTools();
m_quickToolsDefinition->setTools(Okular::Settings::quickAnnotationTools());
m_continuousMode = Okular::Settings::annotationContinuousMode();
if (Okular::Settings::identityAuthor().isEmpty())
detachAnnotation();
if (m_actionHandler)
m_actionHandler->reparseTools();
m_actionHandler->reparseQuickToolsConfig();
}
PageViewAnnotator::~PageViewAnnotator()
......
......@@ -137,6 +137,8 @@ Q_SIGNALS:
void toolSelected();
private:
void reparseBuiltinToolsConfig();
void reparseQuickToolsConfig();
// save the annotation tools to Okular settings
void saveAnnotationTools();
// returns the engine QDomElement of the the currently active tool
......
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