@@ -398,9 +398,10 @@ Theme::Theme()
398
398
QColor (127 , 127 , 127 ));
399
399
reserveDarkPalette.setColor (QPalette::Disabled, QPalette::WindowText,
400
400
QColor (127 , 127 , 127 ));
401
- connectToPaletteSignal ();
402
401
#endif
403
402
403
+ connectToPaletteSignal ();
404
+
404
405
#ifdef APPLICATION_SERVER_URL_ENFORCE
405
406
_forceOverrideServerUrl = true ;
406
407
#endif
@@ -964,13 +965,10 @@ QColor Theme::defaultColor()
964
965
return QColor{NEXTCLOUD_BACKGROUND_COLOR};
965
966
}
966
967
967
- void Theme::connectToPaletteSignal ()
968
+ void Theme::connectToPaletteSignal () const
968
969
{
969
- if (!_paletteSignalsConnected) {
970
- if (const auto ptr = qobject_cast<QGuiApplication*>(qApp)) {
971
- connect (ptr->styleHints (), &QStyleHints::colorSchemeChanged, this , &Theme::darkModeChanged);
972
- _paletteSignalsConnected = true ;
973
- }
970
+ if (const auto ptr = qobject_cast<QGuiApplication*>(qApp)) {
971
+ connect (ptr->styleHints (), &QStyleHints::colorSchemeChanged, this , &Theme::darkModeChanged, Qt::UniqueConnection);
974
972
}
975
973
}
976
974
@@ -1012,6 +1010,7 @@ QVariantMap Theme::systemPalette() const
1012
1010
1013
1011
bool Theme::darkMode () const
1014
1012
{
1013
+ connectToPaletteSignal ();
1015
1014
const auto isDarkFromStyle = [] {
1016
1015
switch (qGuiApp->styleHints ()->colorScheme ())
1017
1016
{
0 commit comments