mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-29 19:06:55 -05:00
Merge branch 'develop'
Conflicts: CMakeLists.txt cmake/CLangFormat.cmake snapcraft.yaml src/CMakeLists.txt src/core/Database.cpp src/core/Database.h src/core/Tools.cpp src/crypto/CryptoHash.h src/crypto/ssh/ASN1Key.h src/crypto/ssh/OpenSSHKey.cpp src/format/Kdbx4Reader.cpp src/gui/DatabaseTabWidget.cpp src/gui/DatabaseTabWidget.h src/gui/DatabaseWidget.cpp src/gui/DatabaseWidget.h src/gui/DetailsWidget.cpp src/gui/DetailsWidget.ui src/gui/EditWidgetProperties.cpp src/gui/EntryPreviewWidget.cpp src/gui/EntryPreviewWidget.ui src/gui/FileDialog.cpp src/gui/dbsettings/DatabaseSettingsDialog.cpp src/gui/dbsettings/DatabaseSettingsDialog.h src/gui/group/EditGroupWidget.cpp src/gui/group/EditGroupWidget.h src/sshagent/ASN1Key.h src/sshagent/OpenSSHKey.cpp src/sshagent/SSHAgent.cpp tests/CMakeLists.txt
This commit is contained in:
commit
9e2be34897
421 changed files with 18208 additions and 12907 deletions
|
|
@ -24,6 +24,23 @@
|
|||
#include <QStandardPaths>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
/*
|
||||
* Map of configuration file settings that are either deprecated, or have
|
||||
* had their name changed. Entries in the map are of the form
|
||||
* {oldName, newName}
|
||||
* Set newName to empty string to remove the setting from the file.
|
||||
*/
|
||||
static const QMap<QString, QString> deprecationMap = {
|
||||
// >2.3.4
|
||||
{"security/hidepassworddetails", "security/HidePasswordPreviewPanel"},
|
||||
// >2.3.4
|
||||
{"GUI/HideDetailsView", "GUI/HidePreviewPanel"},
|
||||
// >2.3.4
|
||||
{"GUI/DetailSplitterState", "GUI/PreviewSplitterState"},
|
||||
// >2.3.4
|
||||
{"security/IconDownloadFallbackToGoogle", "security/IconDownloadFallback"},
|
||||
};
|
||||
|
||||
Config* Config::m_instance(nullptr);
|
||||
|
||||
QVariant Config::get(const QString& key)
|
||||
|
|
@ -72,6 +89,19 @@ void Config::sync()
|
|||
m_settings->sync();
|
||||
}
|
||||
|
||||
void Config::upgrade()
|
||||
{
|
||||
for (const auto& setting : deprecationMap.keys()) {
|
||||
if (m_settings->contains(setting)) {
|
||||
if (!deprecationMap.value(setting).isEmpty()) {
|
||||
// Add entry with new name and old entry's value
|
||||
m_settings->setValue(deprecationMap.value(setting), m_settings->value(setting));
|
||||
}
|
||||
m_settings->remove(setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Config::Config(const QString& fileName, QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
|
@ -89,7 +119,7 @@ Config::Config(QObject* parent)
|
|||
QString userPath;
|
||||
QString homePath = QDir::homePath();
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||
// we can't use QStandardPaths on X11 as it uses XDG_DATA_HOME instead of XDG_CONFIG_HOME
|
||||
QByteArray env = qgetenv("XDG_CONFIG_HOME");
|
||||
if (env.isEmpty()) {
|
||||
|
|
@ -127,10 +157,12 @@ Config::~Config()
|
|||
void Config::init(const QString& fileName)
|
||||
{
|
||||
m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
upgrade();
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, this, &Config::sync);
|
||||
|
||||
m_defaults.insert("SingleInstance", true);
|
||||
m_defaults.insert("RememberLastDatabases", true);
|
||||
m_defaults.insert("NumberOfRememberedLastDatabases", 5);
|
||||
m_defaults.insert("RememberLastKeyFiles", true);
|
||||
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
||||
m_defaults.insert("AutoSaveAfterEveryChange", true);
|
||||
|
|
@ -156,7 +188,7 @@ void Config::init(const QString& fileName)
|
|||
m_defaults.insert("security/passwordsrepeat", false);
|
||||
m_defaults.insert("security/passwordscleartext", false);
|
||||
m_defaults.insert("security/passwordemptynodots", true);
|
||||
m_defaults.insert("security/hidepassworddetails", true);
|
||||
m_defaults.insert("security/HidePasswordPreviewPanel", true);
|
||||
m_defaults.insert("security/autotypeask", true);
|
||||
m_defaults.insert("security/IconDownloadFallback", false);
|
||||
m_defaults.insert("security/resettouchid", false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue