From 9886b1075fbddca0d4ef564c1bb481afcc199c3f Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 20 Sep 2020 09:39:59 -0400 Subject: Cleanup config initialization, add local config options * Fix #5313, allow specifying local config path using environment variable and command line flag * Add command line flag `--localconfig ` to specify a file path to use for the local configuration settings. * Add environment variable support to set config files paths: `KPXC_CONFIG` and `KPXC_CONFIG_LOCAL` to override default locations. * Reorder startup sequence to load specified config files earlier to allow for theme settings and other early options to be picked up. * Removed old command line option `--pw`, no longer used. * Attempt a fix of application not closing when last window is gone. Only set `QApplication::setQuitOnLastWindowClosed(true)` when tray icon is enabled instead of always. --- src/core/Config.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/Config.h') diff --git a/src/core/Config.h b/src/core/Config.h index 64e8c945a..2ed4c6ec1 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -198,17 +198,18 @@ public: void resetToDefaults(); static Config* instance(); - static void createConfigFromFile(const QString& file); + static void createConfigFromFile(const QString& configFileName, const QString& localConfigFileName = {}); static void createTempFileInstance(); signals: void changed(ConfigKey key); private: - Config(const QString& fileName, QObject* parent = nullptr); + Config(const QString& configFileName, const QString& localConfigFileName, QObject* parent); explicit Config(QObject* parent); - void init(const QString& configFileName, const QString& localConfigFileName = ""); + void init(const QString& configFileName, const QString& localConfigFileName); void migrate(); + static QPair defaultConfigFiles(); static QPointer m_instance; -- cgit v1.2.3