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 <path>` 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.
This commit is contained in:
Jonathan White 2020-09-20 09:39:59 -04:00
parent 122051c91c
commit 9886b1075f
7 changed files with 125 additions and 69 deletions

View file

@ -1269,6 +1269,8 @@ bool MainWindow::saveLastDatabases()
void MainWindow::updateTrayIcon()
{
if (isTrayIconEnabled()) {
QApplication::setQuitOnLastWindowClosed(false);
if (!m_trayIcon) {
m_trayIcon = new QSystemTrayIcon(this);
auto* menu = new QMenu(this);
@ -1307,6 +1309,8 @@ void MainWindow::updateTrayIcon()
m_trayIcon->setIcon(resources()->trayIconLocked());
}
} else {
QApplication::setQuitOnLastWindowClosed(true);
if (m_trayIcon) {
m_trayIcon->hide();
delete m_trayIcon;