kcontrol: fix regression in kdebug module

I'm not sure when it broke but it was recently, deffinetly after
the 4.17.0 release
This commit is contained in:
Ivailo Monev 2015-10-01 08:44:13 +03:00
parent 0cf8c59f82
commit cc92940676
3 changed files with 25 additions and 15 deletions

View file

@ -73,8 +73,11 @@ KCMDebug::KCMDebug( QWidget* parent, const QVariantList& )
pConfig = new KConfig( "kdebugrc", KConfig::NoGlobals );
for( QMap<QString,QString>::const_iterator it = mAreaMap.begin(); it != mAreaMap.end(); ++it ) {
QTreeWidgetItem* item = new QTreeWidgetItem(m_areaWidget, QStringList() << it.value());
QMapIterator<QString,QString> it(mAreaMap);
while (it.hasNext() ) {
it.next();
QTreeWidgetItem* item = new QTreeWidgetItem(m_areaWidget);
item->setText(0, it.value());
item->setData(0, Qt::UserRole, it.key().simplified());
}
@ -102,9 +105,9 @@ KCMDebug::KCMDebug( QWidget* parent, const QVariantList& )
connect(pAbortFatal, SIGNAL(stateChanged(int)),
this, SLOT(slotAbortFatalChanged()));
// Hack!
m_disableAll = m_disableAll2;
connect(m_disableAll, SIGNAL(toggled(bool)), this, SLOT(slotDisableAllChanged()));
m_disableAll->setTristate(false);
connect(m_disableAll, SIGNAL(stateChanged(int)),
this, SLOT(slotDisableAllChanged(int)));
// Get initial values
showArea(QString("0"));
@ -170,11 +173,16 @@ void KCMDebug::load()
{
KConfigGroup topGroup(pConfig, QString());
m_disableAll->setChecked(topGroup.readEntry("DisableAll", true));
m_loaded = true;
emit changed( false );
}
void KCMDebug::save()
{
if (!m_loaded) {
return;
}
kDebug();
KConfigGroup group = pConfig->group( mCurrentDebugArea ); // Group name = debug area code
group.writeEntry( "InfoOutput", pInfoCombo->currentIndex() );
group.writePathEntry( "InfoFilename", pInfoFile->text() );
@ -209,7 +217,6 @@ void KCMDebug::defaults()
void KCMDebug::slotApply()
{
save();
pConfig->sync();
}
void KCMDebug::showArea(const QString& areaName)
@ -233,10 +240,10 @@ void KCMDebug::showArea(const QString& areaName)
slotDestinationChanged();
}
void KCMDebug::slotDisableAllChanged()
void KCMDebug::slotDisableAllChanged(const int checked)
{
kDebug();
bool enabled = !m_disableAll->isChecked();
const bool enabled = !checked;
kDebug() << checked;
m_areaWidget->setEnabled(enabled);
pInfoGroup->setEnabled(enabled);
pWarnGroup->setEnabled(enabled);
@ -245,7 +252,7 @@ void KCMDebug::slotDisableAllChanged()
pAbortFatal->setEnabled(enabled);
KConfigGroup topGroup(pConfig, QString());
if (m_disableAll->checkState() == topGroup.readEntry("DisableAll", false)) {
if (checked == topGroup.readEntry("DisableAll", false)) {
emit changed( false );
} else {
emit changed( true );

View file

@ -53,7 +53,7 @@ public:
virtual void defaults();
protected Q_SLOTS:
void slotDisableAllChanged();
void slotDisableAllChanged(const int);
void slotDebugAreaChanged(QTreeWidgetItem*);
void slotDestinationChanged();
void slotAbortFatalChanged();
@ -64,12 +64,12 @@ private:
void readAreas();
QString mCurrentDebugArea;
bool m_loaded; // hack to avoid saving before loading
QMap<QString /*area name*/, QString /*description*/> mAreaMap;
protected:
KConfig* pConfig;
QCheckBox* m_disableAll;
};
#endif

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>481</width>
<height>447</height>
<height>466</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -133,10 +133,13 @@
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="m_disableAll2">
<widget class="QCheckBox" name="m_disableAll">
<property name="text">
<string>Disable all debug output</string>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
@ -229,7 +232,7 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_disableAll2</tabstop>
<tabstop>m_disableAll</tabstop>
<tabstop>m_areaWidget</tabstop>
<tabstop>pInfoCombo</tabstop>
<tabstop>pInfoFile</tabstop>