kcontrol: save kdebug KCM changes when the output file changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-11-06 11:50:14 +02:00
parent 000dfaa7e3
commit 4f40e8fa19
2 changed files with 62 additions and 21 deletions

View file

@ -87,25 +87,59 @@ KCMDebug::KCMDebug( QWidget* parent, const QVariantList& )
destList.append( i18n("Syslog") );
destList.append( i18n("None") );
connect( m_areaWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
SLOT(slotDebugAreaChanged(QTreeWidgetItem*)) );
connect(pInfoCombo, SIGNAL(activated(int)),
this, SLOT(slotDestinationChanged()));
pInfoCombo->addItems( destList );
connect(pWarnCombo, SIGNAL(activated(int)),
this, SLOT(slotDestinationChanged()));
pWarnCombo->addItems( destList );
connect(pErrorCombo, SIGNAL(activated(int)),
this, SLOT(slotDestinationChanged()));
pErrorCombo->addItems( destList );
connect(pFatalCombo, SIGNAL(activated(int)),
this, SLOT(slotDestinationChanged()));
pFatalCombo->addItems( destList );
connect(pAbortFatal, SIGNAL(stateChanged(int)),
this, SLOT(slotAbortFatalChanged()));
connect(
m_areaWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(slotDebugAreaChanged(QTreeWidgetItem*))
);
connect(m_disableAll, SIGNAL(stateChanged(int)),
this, SLOT(slotDisableAllChanged(int)));
connect(
pInfoCombo, SIGNAL(activated(int)),
this, SLOT(slotOutputChanged())
);
connect(
pInfoFile, SIGNAL(textEdited(QString)),
this, SLOT(slotOutputFileChanged(QString))
);
pInfoCombo->addItems(destList);
connect(
pWarnCombo, SIGNAL(activated(int)),
this, SLOT(slotOutputChanged())
);
connect(
pWarnFile, SIGNAL(textEdited(QString)),
this, SLOT(slotOutputFileChanged(QString))
);
pWarnCombo->addItems(destList);
connect(
pErrorCombo, SIGNAL(activated(int)),
this, SLOT(slotOutputChanged())
);
connect(
pErrorFile, SIGNAL(textEdited(QString)),
this, SLOT(slotOutputFileChanged(QString))
);
pErrorCombo->addItems(destList);
connect(
pFatalCombo, SIGNAL(activated(int)),
this, SLOT(slotOutputChanged())
);
connect(
pFatalFile, SIGNAL(textEdited(QString)),
this, SLOT(slotOutputFileChanged(QString))
);
pFatalCombo->addItems(destList);
connect(
pAbortFatal, SIGNAL(stateChanged(int)),
this, SLOT(slotAbortFatalChanged())
);
connect(
m_disableAll, SIGNAL(stateChanged(int)),
this, SLOT(slotDisableAllChanged(int))
);
// Get initial values
load();
@ -225,7 +259,7 @@ void KCMDebug::showArea(const QString& areaName)
pFatalFile->setText( group.readPathEntry("FatalFilename","kdebug.log") );
//pFatalShow->setText( group.readEntry( "FatalShow" ) );
pAbortFatal->setChecked( group.readEntry( "AbortFatal", 1 ) );
slotDestinationChanged();
slotOutputChanged();
}
void KCMDebug::slotDisableAllChanged(const int checked)
@ -257,7 +291,7 @@ void KCMDebug::slotDebugAreaChanged(QTreeWidgetItem* item)
showArea(areaName);
}
void KCMDebug::slotDestinationChanged()
void KCMDebug::slotOutputChanged()
{
pInfoFile->setEnabled(pInfoCombo->currentIndex() == 0);
pWarnFile->setEnabled(pWarnCombo->currentIndex() == 0);
@ -266,6 +300,12 @@ void KCMDebug::slotDestinationChanged()
save();
}
void KCMDebug::slotOutputFileChanged(const QString &text)
{
Q_UNUSED(text);
save();
}
void KCMDebug::slotAbortFatalChanged()
{
save();

View file

@ -54,7 +54,8 @@ public:
protected Q_SLOTS:
void slotDisableAllChanged(const int);
void slotDebugAreaChanged(QTreeWidgetItem*);
void slotDestinationChanged();
void slotOutputChanged();
void slotOutputFileChanged(const QString &);
void slotAbortFatalChanged();
void slotApply();