diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kdebugdialog/kabstractdebugdialog.cpp | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdebugdialog/kabstractdebugdialog.cpp')
-rw-r--r-- | kdebugdialog/kabstractdebugdialog.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/kdebugdialog/kabstractdebugdialog.cpp b/kdebugdialog/kabstractdebugdialog.cpp new file mode 100644 index 000000000..76dca8f61 --- /dev/null +++ b/kdebugdialog/kabstractdebugdialog.cpp @@ -0,0 +1,85 @@ +/* This file is part of the KDE libraries + Copyright (C) 2000 David Faure <faure@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "kabstractdebugdialog.h" +#include <kconfig.h> +#include <kpushbutton.h> +#include <qlayout.h> +#include <kapplication.h> +#include <klocale.h> +#include <kstdguiitem.h> + +KAbstractDebugDialog::KAbstractDebugDialog( QWidget *parent, const char *name, bool modal ) + : KDialog( parent, name, modal ) +{ + pConfig = new KConfig( "kdebugrc" ); +} + +KAbstractDebugDialog::~KAbstractDebugDialog() +{ + delete pConfig; +} + +void KAbstractDebugDialog::buildButtons( QVBoxLayout * topLayout ) +{ + QHBoxLayout *hbox = new QHBoxLayout( KDialog::spacingHint() ); + topLayout->addLayout( hbox ); + pHelpButton = new KPushButton( KStdGuiItem::help(), this ); + hbox->addWidget( pHelpButton ); + hbox->addStretch(10); + QSpacerItem *spacer = new QSpacerItem(40, 0); + hbox->addItem(spacer); + pOKButton = new KPushButton( KStdGuiItem::ok(), this ); + hbox->addWidget( pOKButton ); + pApplyButton = new KPushButton( KStdGuiItem::apply(), this ); + hbox->addWidget( pApplyButton ); + pCancelButton = new KPushButton( KStdGuiItem::cancel(), this ); + hbox->addWidget( pCancelButton ); + + int w1 = pHelpButton->sizeHint().width(); + int w2 = pOKButton->sizeHint().width(); + int w3 = pCancelButton->sizeHint().width(); + int w4 = QMAX( w1, QMAX( w2, w3 ) ); + int w5 = pApplyButton->sizeHint().width(); + w4 = QMAX(w4, w5); + + pHelpButton->setFixedWidth( w4 ); + pOKButton->setFixedWidth( w4 ); + pApplyButton->setFixedWidth( w4 ); + pCancelButton->setFixedWidth( w4 ); + + connect( pHelpButton, SIGNAL( clicked() ), SLOT( slotShowHelp() ) ); + connect( pOKButton, SIGNAL( clicked() ), SLOT( accept() ) ); + connect( pApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); + connect( pCancelButton, SIGNAL( clicked() ), SLOT( reject() ) ); +} + +void KAbstractDebugDialog::slotShowHelp() +{ + if (kapp) + kapp->invokeHelp(); +} + +void KAbstractDebugDialog::slotApply() +{ + save(); + pConfig->sync(); +} + +#include "kabstractdebugdialog.moc" |