mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
Remove FdoSecretsSettings::collectionAliasesChanged()
Remove the collectionAliasesChanged() signal from FdoSecretsSettings to avoid making it a QObject. Instead connect to Config::changed and check which Config key changed. This does break the abstraction layer that FdoSecretsSettings was between Service and Config, and requires comparing the key each time any config value is updated, but averts the QObject overhead for FdoSecretsSettings. Suggested-by: Jonathan White <droidmonkey@users.noreply.github.com> (https://github.com/keepassxreboot/keepassxc/pull/12252#discussion_r2181100088)
This commit is contained in:
parent
f2361eb385
commit
913c912677
4 changed files with 11 additions and 9 deletions
|
|
@ -112,7 +112,6 @@ namespace FdoSecrets
|
|||
void FdoSecretsSettings::setCollectionAliases(const QVariantMap& aliases)
|
||||
{
|
||||
config()->set(Config::FdoSecrets_CollectionAliasDatabaseUUIDs, aliases);
|
||||
emit collectionAliasesChanged();
|
||||
}
|
||||
|
||||
void FdoSecretsSettings::setCollectionAlias(QString alias, QUuid publicUuid)
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@ class Database;
|
|||
namespace FdoSecrets
|
||||
{
|
||||
|
||||
class FdoSecretsSettings : public QObject
|
||||
class FdoSecretsSettings
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FdoSecretsSettings() = default;
|
||||
static FdoSecretsSettings* instance();
|
||||
|
|
@ -62,9 +60,6 @@ namespace FdoSecrets
|
|||
QUuid exposedGroup(Database* db) const;
|
||||
void setExposedGroup(Database* db, const QUuid& group);
|
||||
|
||||
signals:
|
||||
void collectionAliasesChanged() const;
|
||||
|
||||
private:
|
||||
static FdoSecretsSettings* m_instance;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ namespace FdoSecrets
|
|||
// when a new database is opened, apply it's aliases
|
||||
connect(m_databases.data(), &DatabaseTabWidget::databaseOpened, this, &Service::applyCollectionAliasSettings);
|
||||
// apply aliases from settings, when they change
|
||||
connect(
|
||||
settings(), &FdoSecretsSettings::collectionAliasesChanged, this, &Service::applyCollectionAliasSettings);
|
||||
connect(config(), &Config::changed, this, &Service::handleSettingsChanged);
|
||||
|
||||
// make default alias track current activated database
|
||||
connect(m_databases.data(), &DatabaseTabWidget::activeDatabaseChanged, this, &Service::ensureDefaultAlias);
|
||||
|
|
@ -469,6 +468,13 @@ namespace FdoSecrets
|
|||
return collection->addAlias(name);
|
||||
}
|
||||
|
||||
void Service::handleSettingsChanged(Config::ConfigKey key)
|
||||
{
|
||||
if (key == Config::FdoSecrets_CollectionAliasDatabaseUUIDs) {
|
||||
applyCollectionAliasSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void Service::applyCollectionAliasSettings()
|
||||
{
|
||||
auto aliases = settings()->collectionAliases();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#ifndef KEEPASSXC_FDOSECRETS_SERVICE_H
|
||||
#define KEEPASSXC_FDOSECRETS_SERVICE_H
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "fdosecrets/dbus/DBusClient.h"
|
||||
#include "fdosecrets/dbus/DBusObject.h"
|
||||
|
||||
|
|
@ -143,6 +144,7 @@ namespace FdoSecrets
|
|||
|
||||
void onCollectionAliasRemoved(const QString& alias);
|
||||
|
||||
void handleSettingsChanged(Config::ConfigKey key);
|
||||
void applyCollectionAliasSettings();
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue