[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [PATCHes] KRdb and KControl
From: Karol Szwed <gallium () iprimus ! com ! au>
Date: 2002-11-01 15:33:46
[Download RAW message or body]
Hi,
The trivial kcontrol patch ensures that kcm plugins get their palette set when
the application palette is changed. This makes changing color schemes work
properly as kcmcolors gets its own palette set too.
The KRdb patch makes exported colors (via xrdb / gtkrc) use the
yet-to-be-applied palette instead of the old (previous) one.
Please test.
--Karol
["kcontrol.patch" (text/x-diff)]
Index: dockcontainer.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/dockcontainer.h,v
retrieving revision 1.16
diff -u -p -r1.16 dockcontainer.h
--- dockcontainer.h 2002/03/02 13:25:22 1.16
+++ dockcontainer.h 2002/11/01 15:13:08
@@ -37,7 +37,8 @@ public:
QWidget *baseWidget() { return _basew; }
bool dockModule(ConfigModule *module);
-
+ ConfigModule* module() const { return _module; };
+
QSize minimumSizeHint() const;
QSize sizeHint() const { return minimumSizeHint(); }
Index: modules.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/modules.cpp,v
retrieving revision 1.40
diff -u -p -r1.40 modules.cpp
--- modules.cpp 2002/07/15 17:37:11 1.40
+++ modules.cpp 2002/11/01 15:13:09
@@ -228,6 +228,12 @@ void ConfigModule::rootExited(KProcess *
emit childClosed();
}
+void ConfigModule::setPalette( const QPalette& pal )
+{
+ if (_module)
+ _module->setPalette( pal );
+}
+
const KAboutData *ConfigModule::aboutData() const
{
if (!_module) return 0;
@@ -269,3 +275,4 @@ void ConfigModuleList::readDesktopEntrie
}
}
}
+
Index: modules.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/modules.h,v
retrieving revision 1.14
diff -u -p -r1.14 modules.h
--- modules.h 2002/07/15 16:56:35 1.14
+++ modules.h 2002/11/01 15:13:09
@@ -53,6 +53,7 @@ public:
ProxyWidget *module();
const KAboutData *aboutData() const;
+ void setPalette( const QPalette& pal );
public slots:
Index: toplevel.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/toplevel.cpp,v
retrieving revision 1.110
diff -u -p -r1.110 toplevel.cpp
--- toplevel.cpp 2002/09/22 21:57:54 1.110
+++ toplevel.cpp 2002/11/01 15:13:10
@@ -519,3 +519,9 @@ QString TopLevel::handleAmpersand( QStri
}
return modulename;
}
+
+void TopLevel::paletteChange( const QPalette& /* oldPal */ )
+{
+ if (_dock && _dock->module())
+ _dock->module()->setPalette( kapp->palette() );
+}
Index: toplevel.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/toplevel.h,v
retrieving revision 1.33
diff -u -p -r1.33 toplevel.h
--- toplevel.h 2002/09/22 21:57:54 1.33
+++ toplevel.h 2002/11/01 15:13:10
@@ -50,6 +50,7 @@ public:
protected:
void setupActions();
+ void paletteChange( const QPalette& oldPal );
protected slots:
void activateModule(const QString& name);
["krdb.cpp.patch" (text/x-diff)]
Index: krdb.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/krdb/krdb.cpp,v
retrieving revision 1.41
diff -u -p -r1.41 krdb.cpp
--- krdb.cpp 2002/10/26 14:34:06 1.41
+++ krdb.cpp 2002/11/01 15:02:30
@@ -71,13 +71,10 @@ static void applyGtkStyles(bool active)
// -----------------------------------------------------------------------------
-static void applyQtColors( KSimpleConfig& kglobals, QSettings& settings )
+static void applyQtColors( KSimpleConfig& kglobals, QSettings& settings, QPalette& \
newPal ) {
QStringList actcg, inactcg, discg;
- // Rebuild the application palette that is about to be set.
- QPalette newPal = KApplication::createApplicationPalette();
-
/* export kde color settings */
int i;
for (i = 0; i < QColorGroup::NColorRoles; i++)
@@ -352,12 +349,15 @@ static void createGtkrc( bool exportColo
void runRdb( uint flags )
{
+ // Obtain the application palette that is about to be set.
+ QPalette newPal = KApplication::createApplicationPalette();
+
// Export colors to non-(KDE/Qt) apps (e.g. Motif, GTK+ apps)
if (flags & KRdbExportColors)
{
KGlobal::dirs()->addResourceType("appdefaults", \
KStandardDirs::kde_default("data") + "kdisplay/app-defaults/");
- QColorGroup cg = kapp->palette().active();
+ QColorGroup cg = newPal.active();
KGlobal::locale()->insertCatalogue("krdb");
createGtkrc( true, cg );
@@ -447,13 +447,13 @@ void runRdb( uint flags )
if ( exportQtColors || exportQtSettings )
{
QSettings* settings = new QSettings;
- KSimpleConfig kglobals("kdeglobals", true); /* open read-only */
+ KSimpleConfig kglobals("kdeglobals", true); /* open read-only */
if ( exportQtColors )
- applyQtColors( kglobals, *settings ); // For kcmcolors
+ applyQtColors( kglobals, *settings, newPal ); // For kcmcolors
if ( exportQtSettings )
- applyQtSettings( kglobals, *settings ); // For kcmstyle
+ applyQtSettings( kglobals, *settings ); // For kcmstyle
delete settings;
QApplication::flushX();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic