Refactor: Move to simple default builds

* Remove individual feature flags in favor of a single `KPXC_MINIMAL` flag that removes advanced features from the build. Basic features are no longer guarded by feature flags.
* Basic features: Auto-Type, Yubikey, KeeShare
* Advanced features include: Browser (and passkeys), SSH Agent, and Secret Service
* Networking, Documentation, and Update Checking remain as feature flags to accommodate various distro requirements.

This change also cleans up the main CMakeLists.txt by re-arranging some content and placing macros into a dedicated include file. The minimum CMake version was bumped to 3.16.0 to conform to our minimum Ubuntu support of Focal (20.04). This also allows us to default to C++20, we fall back to C++17 for Qt versions less than 5.15.0 due to lack of support.

Lastly this change removes the KEEPASSXC_BUILD_TYPE="PreRelease" which is never used. We only support "Snapshot" and "Release" now.
This commit is contained in:
Jonathan White 2024-06-24 07:43:59 -04:00
parent 9e29b5c7b6
commit cfa94f69f3
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
76 changed files with 734 additions and 1200 deletions

View file

@ -39,12 +39,12 @@
#include "core/Group.h"
#include "core/Metadata.h"
#include "core/TimeDelta.h"
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
#include "sshagent/OpenSSHKey.h"
#include "sshagent/OpenSSHKeyGenDialog.h"
#include "sshagent/SSHAgent.h"
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "EntryURLModel.h"
#include "browser/BrowserService.h"
#endif
@ -74,10 +74,10 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
, m_advancedWidget(new QWidget(this))
, m_iconsWidget(new EditWidgetIcons(this))
, m_autoTypeWidget(new QWidget(this))
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
, m_sshAgentWidget(new QWidget(this))
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
, m_browserSettingsChanged(false)
, m_browserWidget(new QWidget(this))
, m_additionalURLsDataModel(new EntryURLModel(this))
@ -100,11 +100,11 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
setupIcon();
setupAutoType();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
setupSSHAgent();
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
setupBrowser();
#endif
@ -191,19 +191,19 @@ void EditEntryWidget::setupMain()
m_usernameCompleter->setModel(m_usernameCompleterModel);
m_mainUi->usernameComboBox->setCompleter(m_usernameCompleter);
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
m_mainUi->fetchFaviconButton->setIcon(icons()->icon("favicon-download"));
m_mainUi->fetchFaviconButton->setDisabled(true);
#else
m_mainUi->fetchFaviconButton->setVisible(false);
#endif
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(m_mainUi->fetchFaviconButton, SIGNAL(clicked()), m_iconsWidget, SLOT(downloadFavicon()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), m_iconsWidget, SLOT(setUrl(QString)));
m_mainUi->urlEdit->enableVerifyMode();
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(entryURLEdited(const QString&)));
#endif
connect(m_mainUi->expireCheck, &QCheckBox::toggled, [&](bool enabled) {
@ -298,7 +298,7 @@ void EditEntryWidget::setupAutoType()
// clang-format on
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void EditEntryWidget::setupBrowser()
{
if (config()->get(Config::Browser_Enabled).toBool()) {
@ -489,7 +489,7 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_mainUi->usernameComboBox->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(setModified()));
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()));
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(updateFaviconButtonEnable(QString)));
#endif
connect(m_mainUi->tagsList, SIGNAL(tagsEdited()), this, SLOT(setModified()));
@ -520,7 +520,7 @@ void EditEntryWidget::setupEntryUpdate()
// Properties and History tabs don't need extra connections
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
// SSH Agent tab
if (sshAgent()->isEnabled()) {
connect(m_sshAgentUi->attachmentRadioButton, SIGNAL(toggled(bool)), this, SLOT(setModified()));
@ -536,7 +536,7 @@ void EditEntryWidget::setupEntryUpdate()
}
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
connect(m_browserUi->skipAutoSubmitCheckbox, SIGNAL(toggled(bool)), SLOT(setModified()));
connect(m_browserUi->hideEntryCheckbox, SIGNAL(toggled(bool)), SLOT(setModified()));
@ -584,7 +584,7 @@ void EditEntryWidget::updateHistoryButtons(const QModelIndex& current, const QMo
}
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void EditEntryWidget::setupSSHAgent()
{
m_pendingPrivateKey = "";
@ -929,7 +929,7 @@ void EditEntryWidget::loadEntry(Entry* entry,
switchToPage(Page::Main);
setPageHidden(m_historyWidget, m_history || m_entry->historyItems().count() < 1);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
setPageHidden(m_sshAgentWidget, !sshAgent()->isEnabled());
#endif
@ -1045,13 +1045,13 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
}
updateAutoTypeEnabled();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
if (sshAgent()->isEnabled()) {
updateSSHAgent();
}
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
if (!hasPage(m_browserWidget)) {
setupBrowser();
@ -1207,7 +1207,7 @@ bool EditEntryWidget::commitEntry()
m_autoTypeAssoc->removeEmpty();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
toKeeAgentSettings(m_sshAgentSettings);
#endif
@ -1216,7 +1216,7 @@ bool EditEntryWidget::commitEntry()
m_entry->beginUpdate();
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
updateBrowser();
}
@ -1304,7 +1304,7 @@ void EditEntryWidget::updateEntryData(Entry* entry) const
entry->autoTypeAssociations()->copyDataFrom(m_autoTypeAssoc);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
if (sshAgent()->isEnabled()) {
m_sshAgentSettings.toEntry(entry);
}
@ -1390,7 +1390,7 @@ void EditEntryWidget::clear()
hideMessage();
}
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
void EditEntryWidget::updateFaviconButtonEnable(const QString& url)
{
m_mainUi->fetchFaviconButton->setDisabled(url.isEmpty());