mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-05 16:22:36 -08:00
1 parent
6f5e13815c
commit
2073f2ddc3
11 files changed
+149
-128
No files matched your search
+26
-20
@@ -68,26 +68,6 @@ Application::Application(int& argc, char** argv)
|
||||
registerUnixSignals();
|
||||
#endif
|
||||
|
||||
QString appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
|
||||
if (appTheme == "auto") {
|
||||
if (osUtils->isDarkMode()) {
|
||||
setStyle(new DarkStyle);
|
||||
m_darkTheme = true;
|
||||
} else {
|
||||
setStyle(new LightStyle);
|
||||
}
|
||||
} else if (appTheme == "light") {
|
||||
setStyle(new LightStyle);
|
||||
} else if (appTheme == "dark") {
|
||||
setStyle(new DarkStyle);
|
||||
m_darkTheme = true;
|
||||
} else {
|
||||
// Classic mode, only check for dark theme when not on Windows
|
||||
#ifndef Q_OS_WIN
|
||||
m_darkTheme = osUtils->isDarkMode();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString userName = qgetenv("USER");
|
||||
if (userName.isEmpty()) {
|
||||
userName = qgetenv("USERNAME");
|
||||
@@ -162,6 +142,32 @@ Application::~Application()
|
||||
}
|
||||
}
|
||||
|
||||
void Application::applyTheme()
|
||||
{
|
||||
QString appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
|
||||
if (appTheme == "auto") {
|
||||
if (osUtils->isDarkMode()) {
|
||||
setStyle(new DarkStyle);
|
||||
m_darkTheme = true;
|
||||
} else {
|
||||
setStyle(new LightStyle);
|
||||
}
|
||||
} else if (appTheme == "light") {
|
||||
setStyle(new LightStyle);
|
||||
} else if (appTheme == "dark") {
|
||||
setStyle(new DarkStyle);
|
||||
m_darkTheme = true;
|
||||
} else {
|
||||
// Classic mode, don't check for dark theme on Windows
|
||||
// because Qt 5.x does not support it
|
||||
#ifndef Q_OS_WIN
|
||||
m_darkTheme = osUtils->isDarkMode();
|
||||
#endif
|
||||
}
|
||||
|
||||
setPalette(style()->standardPalette());
|
||||
}
|
||||
|
||||
bool Application::event(QEvent* event)
|
||||
{
|
||||
// Handle Apple QFileOpenEvent from finder (double click on .kdbx file)
|
||||
|
||||
Reference in new issue
Block a user