[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkde-workspace=5D_kstyles/oxygen=3A_Moved_activation?=
From: Hugo Pereira Da Costa <hugo () oxygen-icons ! org>
Date: 2011-05-25 8:21:26
Message-ID: 20110525082126.9F397A60A4 () git ! kde ! org
[Download RAW message or body]
Git commit 4d468b7cca49d815b610b5631548349730590ad4 by Hugo Pereira Da Costa.
Committed on 25/05/2011 at 10:20.
Pushed by hpereiradacosta into branch 'master'.
Moved activation of kglobalsettings and connection to signals into separate method;
- Method is now called (once) in Style::polish() so that it is late enough for the \
style to detect QApplication vs KApplication (namely, not in QApplication \
constructor).
- Activate KGlobalSettings only for QApp (not KApp) cases, because it is already done \
in KApplication constructor, and might actually conflict.
M +29 -4 kstyles/oxygen/oxygenstyle.cpp
M +9 -3 kstyles/oxygen/oxygenstyle.h
http://commits.kde.org/kde-workspace/4d468b7cca49d815b610b5631548349730590ad4
diff --git a/kstyles/oxygen/oxygenstyle.cpp b/kstyles/oxygen/oxygenstyle.cpp
index 45e2556..d761c78 100644
--- a/kstyles/oxygen/oxygenstyle.cpp
+++ b/kstyles/oxygen/oxygenstyle.cpp
@@ -155,6 +155,7 @@ namespace Oxygen
//______________________________________________________________
Style::Style( void ):
+ _kGlobalSettingsInitialized( false ),
_addLineButtons( DoubleButton ),
_subLineButtons( SingleButton ),
_singleButtonHeight( 14 ),
@@ -183,10 +184,6 @@ namespace Oxygen
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.connect( QString(), "/OxygenStyle", "org.kde.Oxygen.Style", \
"reparseConfiguration", this, SLOT( oxygenConfigurationChanged( void ) ) );
-// // for recent enough version of kde we use KGlobalSettings signal to \
detect palette changes
-// KGlobalSettings::self()->activate( KGlobalSettings::ListenForChanges );
-// connect( KGlobalSettings::self(), SIGNAL( kdisplayPaletteChanged( void ) \
), this, SLOT( globalPaletteChanged( void ) ) );
-
// call the slot directly; this initial call will set up things that also
// need to be reset when the system palette changes
oxygenConfigurationChanged();
@@ -258,6 +255,13 @@ namespace Oxygen
widget->setAttribute( Qt::WA_StyledBackground );
widget->installEventFilter( _topLevelManager );
+ // initialize connections to kGlobalSettings
+ /*
+ this musts be done in ::polish and not before,
+ in order to be able to detect Qt-KDE vs Qt-only applications
+ */
+ if( !_kGlobalSettingsInitialized ) initializeKGlobalSettings();
+
break;
default: break;
@@ -8272,6 +8276,27 @@ namespace Oxygen
}
}
+ //_____________________________________________________________
+ void Style::initializeKGlobalSettings( void )
+ {
+
+ if( qApp && !qApp->inherits( "KApplication" ) )
+ {
+ /*
+ for Qt, non-KDE applications, needs to explicitely activate \
KGlobalSettings. + On the other hand, it is done internally in \
kApplication constructor, + so no need to duplicate here.
+ */
+ KGlobalSettings::self()->activate( KGlobalSettings::ListenForChanges );
+ }
+
+ // connect palette changes to local slot, to make sure caches are cleared
+ connect( KGlobalSettings::self(), SIGNAL( kdisplayPaletteChanged( void ) ), \
this, SLOT( globalPaletteChanged( void ) ) ); +
+ // update flag
+ _kGlobalSettingsInitialized = true;
+
+ }
//______________________________________________________________
void Style::polishScrollArea( QAbstractScrollArea* scrollArea ) const
diff --git a/kstyles/oxygen/oxygenstyle.h b/kstyles/oxygen/oxygenstyle.h
index 6a1f13f..f8bd4a3 100644
--- a/kstyles/oxygen/oxygenstyle.h
+++ b/kstyles/oxygen/oxygenstyle.h
@@ -206,6 +206,9 @@ namespace Oxygen
protected:
+ //! initialize kGlobalSettings conections
+ void initializeKGlobalSettings( void );
+
//! helper
StyleHelper& helper( void ) const
{ return *_helper; }
@@ -814,16 +817,19 @@ namespace Oxygen
private:
- // scrollbar button types (for addLine and subLine )
+ //! true if KGlobalSettings signals are initialized
+ bool _kGlobalSettingsInitialized;
+
+ //! scrollbar button types (for addLine and subLine )
ScrollBarButtonType _addLineButtons;
ScrollBarButtonType _subLineButtons;
- // metrics for scrollbar buttons
+ //! metrics for scrollbar buttons
int _noButtonHeight;
int _singleButtonHeight;
int _doubleButtonHeight;
- // true if keyboard accelerators must be drawn
+ //! true if keyboard accelerators must be drawn
bool _showMnemonics;
//! helper
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic