Commit 4e8afe80 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Handle tag preferences with kconfig compiler

parent 4b6f8f4b
......@@ -326,6 +326,7 @@ kconfig_add_kcfg_files(_kleopatra_SRCS
kcfg/emailoperationspreferences.kcfgc
kcfg/fileoperationspreferences.kcfgc
kcfg/smimevalidationpreferences.kcfgc
kcfg/tagspreferences.kcfgc
)
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/*-apps-kleopatra.png")
......
......@@ -51,6 +51,7 @@ kconfig_add_kcfg_files(kcm_kleopatra_PART_SRCS
${kleopatra_SOURCE_DIR}/src/kcfg/tooltippreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/emailoperationspreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/fileoperationspreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/tagspreferences.kcfgc
)
add_library(kcm_kleopatra MODULE ${kcm_kleopatra_PART_SRCS})
......
......@@ -13,6 +13,7 @@
#include "appearanceconfigwidget.h"
#include "ui_appearanceconfigwidget.h"
#include "tagspreferences.h"
#include "tooltippreferences.h"
#include <QGpgME/Protocol>
......@@ -330,6 +331,7 @@ public:
connect(tooltipValidityCheckBox, SIGNAL(toggled(bool)), q, SLOT(slotTooltipValidityChanged(bool)));
connect(tooltipOwnerCheckBox, SIGNAL(toggled(bool)), q, SLOT(slotTooltipOwnerChanged(bool)));
connect(tooltipDetailsCheckBox, SIGNAL(toggled(bool)), q, SLOT(slotTooltipDetailsChanged(bool)));
connect(useTagsCheckBox, SIGNAL(toggled(bool)), q, SLOT(slotUseTagsChanged(bool)));
}
private:
......@@ -353,6 +355,7 @@ private:
void slotTooltipValidityChanged(bool);
void slotTooltipOwnerChanged(bool);
void slotTooltipDetailsChanged(bool);
void slotUseTagsChanged(bool);
private:
Kleo::DNAttributeOrderConfigWidget *dnOrderWidget;
......@@ -448,6 +451,9 @@ void AppearanceConfigWidget::load()
d->tooltipValidityCheckBox->setChecked(prefs.showValidity());
d->tooltipOwnerCheckBox->setChecked(prefs.showOwnerInformation());
d->tooltipDetailsCheckBox->setChecked(prefs.showCertificateDetails());
const TagsPreferences tagsPrefs;
d->useTagsCheckBox->setChecked(tagsPrefs.useTags());
}
void AppearanceConfigWidget::save()
......@@ -484,6 +490,9 @@ void AppearanceConfigWidget::save()
save_to_config(item, group);
}
TagsPreferences tagsPrefs;
tagsPrefs.setUseTags(d->useTagsCheckBox->isChecked());
config->sync();
KeyFilterManager::instance()->reload();
}
......@@ -614,4 +623,9 @@ void AppearanceConfigWidget::Private::slotTooltipDetailsChanged(bool)
Q_EMIT q->changed();
}
void AppearanceConfigWidget::Private::slotUseTagsChanged(bool)
{
Q_EMIT q->changed();
}
#include "moc_appearanceconfigwidget.cpp"
......@@ -54,6 +54,7 @@ private:
Q_PRIVATE_SLOT(d, void slotTooltipValidityChanged(bool))
Q_PRIVATE_SLOT(d, void slotTooltipDetailsChanged(bool))
Q_PRIVATE_SLOT(d, void slotTooltipOwnerChanged(bool))
Q_PRIVATE_SLOT(d, void slotUseTagsChanged(bool))
};
}
......
......@@ -9,12 +9,39 @@
<height>464</height>
</rect>
</property>
<property name="windowTitle" >
<string>Color &amp;&amp; Font Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QTabWidget" name="tabWidget" >
<widget class="QWidget" name="tab_tags" >
<attribute name="title" >
<string>Tags</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_tags" >
<item>
<widget class="QCheckBox" name="useTagsCheckBox" >
<property name="text" >
<string>Use tags</string>
</property>
<property name="toolTip" >
<string>Enable display and usage of tags attached to keys.</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Tooltips</string>
......
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kleopatrarc" />
<group name="RemarkSettings">
<entry name="UseTags" key="RemarksEnabled" type="Bool">
<label>Use tags</label>
<whatsthis>Enable display and usage of tags attached to keys.</whatsthis>
<default>false</default>
</entry>
<entry name="TagKey" key="RemarkKeyFpr" type="String">
<label>Fingerprint of tag key</label>
<whatsthis>If a key is specified, then only tags made with this key are considered. Otherwise, tags made with any fully trusted key are considered.</whatsthis>
<default></default>
</entry>
</group>
</kcfg>
# Code generation options for kconfig_compiler
File=tagspreferences.kcfg
ClassName=TagsPreferences
NameSpace=Kleo
Singleton=false
Mutators=true
MemberVariables=private
......@@ -7,6 +7,9 @@
*/
#include "remarks.h"
#include "tagspreferences.h"
#include "kleopatra_debug.h"
#include <KSharedConfig>
......@@ -17,21 +20,18 @@ using namespace Kleo;
bool Remarks::remarksEnabled()
{
const KConfigGroup conf(KSharedConfig::openConfig(), "RemarkSettings");
return conf.readEntry("RemarksEnabled", false);
return TagsPreferences().useTags();
}
void Remarks::enableRemarks()
{
KConfigGroup conf(KSharedConfig::openConfig(), "RemarkSettings");
conf.writeEntry("RemarksEnabled", true);
TagsPreferences().setUseTags(true);
KeyCache::mutableInstance()->enableRemarks(true);
}
GpgME::Key Remarks::remarkKey()
{
const KConfigGroup conf(KSharedConfig::openConfig(), "RemarkSettings");
const auto remarkKeyFpr = conf.readEntry("RemarkKeyFpr", QString());
const auto remarkKeyFpr = TagsPreferences().tagKey();
GpgME::Key key;
if (remarkKeyFpr.isEmpty()) {
return key;
......@@ -61,6 +61,5 @@ std::vector<GpgME::Key> Remarks::remarkKeys()
void Remarks::setRemarkKey(const GpgME::Key &key)
{
KConfigGroup conf(KSharedConfig::openConfig(), "RemarkSettings");
conf.writeEntry("RemarkKeyFpr", key.isNull() ? QString() : QString::fromLatin1(key.primaryFingerprint()));
TagsPreferences().setTagKey(key.isNull() ? QString() : QString::fromLatin1(key.primaryFingerprint()));
}
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