If GoldenDict's option "Close to system tray" is checked and
GoldenDict's main window is visible when the user logs out, the logout
is canceled in latest stable versions of KDE Plasma and Xfce desktop
environments (probably in other GNU/Linux desktop environments too, but
they weren't tested). The cause of this unintended and pointless logout
cancellation is ignoring the close event.
Close events are accepted by default. main() calls
`app.setQuitOnLastWindowClosed( false );`. Thus, if the close event is
not touched, the main window is hidden as before this change.
GoldenDict's configuration, history and favorites are still committed
and saved in both KDE Plasma and Xfce when logging out first
closes/hides the main window, then quits GoldenDict.
The change is limited to GNU/Linux because @Abs62 pointed out that
closing the main window breaks global hotkeys on Windows. I have
verified that closing the main window does not break global hotkeys on
GNU/Linux with Qt5 or Qt4. No one has volunteered to test whether the
change is needed on macOS, so it is safer not to apply it there.
Closes #1421.
Separate data directory is only used if history file isn't already
present in the configuration directory.
This commit together with two previous ones allows to switch to
layout described in XDG Base Directory specification. Data is not
migrated automatically and old ~/.goldendict home dir has precedence.
If you wish to use standards-compliant locations, move files and
directories manually:
```
CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/goldendict"
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/goldendict"
DATA="${XDG_DATA_HOME:-$HOME/.local/share}/goldendict"
mkdir -p "${CACHE}"
mkdir -p "${DATA}"
mv ~/.goldendict/index "${CACHE}"
mv ~/.goldendict/history "${DATA}"
mv ~/.goldendict/ "${CONFIG}"
```