File indexing completed on 2024-04-14 14:19:47

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 2000 David Faure <faure@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Library General Public
0006     License as published by the Free Software Foundation; either
0007     version 2 of the License, or (at your option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful,
0010     but WITHOUT ANY WARRANTY; without even the implied warranty of
0011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     Library General Public License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to
0016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017     Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #include "kabstractdebugdialog.h"
0021 #include <kconfig.h>
0022 #include <kpushbutton.h>
0023 #include <QCheckBox>
0024 #include <QLayout>
0025 #include <klocale.h>
0026 #include <kstandardguiitem.h>
0027 #include <ktoolinvocation.h>
0028 #include <qdesktopservices.h>
0029 #include <QUrl>
0030 
0031 KAbstractDebugDialog::KAbstractDebugDialog(QWidget *parent)
0032     : KDialog(parent)
0033 {
0034     pConfig = new KConfig( "kdebugrc", KConfig::NoGlobals );
0035 }
0036 
0037 KAbstractDebugDialog::~KAbstractDebugDialog()
0038 {
0039     delete pConfig;
0040 }
0041 
0042 void KAbstractDebugDialog::buildButtons()
0043 {
0044     setButtons(KDialog::Help | KDialog::Ok | KDialog::Apply | KDialog::Cancel);
0045 
0046     connect(this, SIGNAL(helpClicked()), SLOT(slotShowHelp()));
0047     connect(this, SIGNAL(okClicked()), SLOT(accept()));
0048     connect(this, SIGNAL(applyClicked()), SLOT(slotApply()));
0049     connect(this, SIGNAL(cancelClicked()), SLOT(reject()));
0050 }
0051 
0052 void KAbstractDebugDialog::slotShowHelp()
0053 {
0054     QDesktopServices::openUrl(QUrl("help:/"));
0055 }
0056 
0057 void KAbstractDebugDialog::slotApply()
0058 {
0059     save();
0060     pConfig->sync();
0061 }
0062 
0063 void KAbstractDebugDialog::save()
0064 {
0065     doSave();
0066     KConfigGroup topGroup(pConfig, QString());
0067     topGroup.writeEntry("DisableAll", m_disableAll->isChecked());
0068 }
0069 
0070 void KAbstractDebugDialog::load()
0071 {
0072     doLoad();
0073     KConfigGroup topGroup(pConfig, QString());
0074     m_disableAll->setChecked(topGroup.readEntry("DisableAll", false));
0075 }
0076 
0077 #include "moc_kabstractdebugdialog.cpp"