[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevplatform] util: Fix storing/restoring of environment settings
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2011-11-30 20:57:51
Message-ID: 20111130205751.EC5AFA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit a7afb39d8d64e4c2944f0df556706f7b0b84cab9 by Andreas Pakulat.
Committed on 30/11/2011 at 21:54.
Pushed by apaku into branch 'master'.

Fix storing/restoring of environment settings

This works around a change in kdelibs that was done to fix
KConfigDialogManager's behaviour with Qt4.8 and normal Q/KComboBox. With
that change the user-property is not considered anymore for Q/KComboBox
and instead the hardcoded index/text-handling part is done. That breaks
our own KComboBox subclass since we relied on the fact that our own
user-property would override that hardcoded stuff.

After looking at the kconfigdialogmanager sources I noticed that it
supports a special property "kcfg_property" which can point to a
property-name and then is considered first as the property to store
into the config file. With that we can again restore the behaviour of
storing the currentProfile to the config file.

This will work on all kdelibs back to sometime 2009, which covers KDE
4.5 and later at least, which is enough since the code requires 4.6 anyway.

M  +9    -0    util/environmentselectionwidget.cpp

http://commits.kde.org/kdevplatform/a7afb39d8d64e4c2944f0df556706f7b0b84cab9

diff --git a/util/environmentselectionwidget.cpp b/util/environmentselectio=
nwidget.cpp
index e74ffc5..63fdebc 100644
--- a/util/environmentselectionwidget.cpp
+++ b/util/environmentselectionwidget.cpp
@@ -33,6 +33,15 @@ class EnvironmentSelectionWidgetPrivate
 EnvironmentSelectionWidget::EnvironmentSelectionWidget( QWidget *parent )
     : KComboBox( parent ), d( new EnvironmentSelectionWidgetPrivate )
 {
+    // Taken from kdelibs/kdeui/dialogs/kconfigdialogmanager.cpp (no idea =
wether this is documented)
+    // Commits d44186bce4670d2985fb6aba8dba59bbd2c4c77a and 8edc1932ecc623=
70d9a31836dfa9b2bd0175a293
+    // introduced a regression in kdelibs to fix problems running some app=
s against Qt4.8. Unfortunately
+    // this fix breaks exactly our use-case, which is to store the text-va=
lue in kconfig instead of
+    // the index even though the combobox is editable. Since that change t=
he special combobox-code in
+    // kconfigdialogmanager.cpp is run before check a user-property and he=
nce our user-property is
+    // ignored. Setting this special kcfg_property to the name of our user=
-property again overrides
+    // the hardcoded combobox-behaviour - until the next one breaks things=
 in kdelibs :|
+    setProperty("kcfg_property", QByteArray("currentProfile"));
 }
 =

 EnvironmentSelectionWidget::~EnvironmentSelectionWidget()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic