Commit 8322aa63 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Use config setting instead of build variable to enable group support

This introduces a general Settings class instead of yet another
FooPreferences class.

GnuPG-bug-id: 5175
parent ee51092a
Pipeline #48678 failed with stage
in 12 minutes and 9 seconds
......@@ -11,7 +11,6 @@ endif()
option(FORCE_DISABLE_KCMUTILS "Force building Kleopatra without KCMUtils. Doing this will disable configuration KCM Plugins. [default=OFF]" OFF)
option(DISABLE_KWATCHGNUPG "Don't build the kwatchgnupg tool [default=OFF]" OFF)
option(ENABLE_GROUP_SUPPORT "Enable experimental support for groups of keys [default=OFF]" OFF)
# Standalone build. Find / include everything necessary.
set(KF5_MIN_VERSION "5.78.0")
......@@ -146,11 +145,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
add_definitions(-DQT_NO_EMIT)
if(ENABLE_GROUP_SUPPORT)
message(STATUS "Enabling experimental group support")
add_definitions(-DGROUP_SUPPORT)
endif()
kde_enable_exceptions()
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)
......
......@@ -327,6 +327,7 @@ kconfig_add_kcfg_files(_kleopatra_SRCS
kcfg/fileoperationspreferences.kcfgc
kcfg/smimevalidationpreferences.kcfgc
kcfg/tagspreferences.kcfgc
kcfg/settings.kcfgc
)
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/*-apps-kleopatra.png")
......
......@@ -52,6 +52,7 @@ kconfig_add_kcfg_files(kcm_kleopatra_PART_SRCS
${kleopatra_SOURCE_DIR}/src/kcfg/emailoperationspreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/fileoperationspreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/tagspreferences.kcfgc
${kleopatra_SOURCE_DIR}/src/kcfg/settings.kcfgc
)
add_library(kcm_kleopatra MODULE ${kcm_kleopatra_PART_SRCS})
......
......@@ -12,6 +12,7 @@
#include "kleopatra_debug.h"
#include "certificatelineedit.h"
#include "settings.h"
#include "unknownrecipientwidget.h"
#include "commands/detailscommand.h"
......@@ -99,11 +100,11 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent, bool sigEncExclusive)
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
#ifdef GROUP_SUPPORT
mModel->useKeyCache(true, KeyList::IncludeGroups);
#else
mModel->useKeyCache(true, KeyList::AllKeys);
#endif
if (Settings().groupsEnabled()) {
mModel->useKeyCache(true, KeyList::IncludeGroups);
} else {
mModel->useKeyCache(true, KeyList::AllKeys);
}
/* The signature selection */
QHBoxLayout *sigLay = new QHBoxLayout;
......@@ -278,11 +279,11 @@ void SignEncryptWidget::dialogRequested(CertificateLineEdit *certificateLineEdit
CertificateSelectionDialog *const dlg = new CertificateSelectionDialog(this);
dlg->setKeyFilter(std::make_shared<EncryptCertificateFilter>(mCurrentProto));
#ifdef GROUP_SUPPORT
dlg->setOptions(dlg->options() | CertificateSelectionDialog::MultiSelection | CertificateSelectionDialog::IncludeGroups);
#else
dlg->setOptions(dlg->options() | CertificateSelectionDialog::MultiSelection);
#endif
if (Settings().groupsEnabled()) {
dlg->setOptions(dlg->options() | CertificateSelectionDialog::MultiSelection | CertificateSelectionDialog::IncludeGroups);
} else {
dlg->setOptions(dlg->options() | CertificateSelectionDialog::MultiSelection);
}
if (dlg->exec()) {
const std::vector<Key> keys = dlg->selectedCertificates();
......
<?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="Groups">
<entry name="GroupsEnabled" type="Bool">
<label>Enable Groups (Experimental)</label>
<tooltip>Enable usage of groups of keys.</tooltip>
<whatsthis>Enable usage of groups of keys. This is an experimental feature.</whatsthis>
<default>false</default>
</entry>
</group>
</kcfg>
# Code generation options for kconfig_compiler
File=settings.kcfg
ClassName=Settings
NameSpace=Kleo
Mutators=true
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