delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kdebugdialog / kabstractdebugdialog.cpp
blob8b6b026cf77542a9ddb13d7e7f535b6b2f9a0882
1 /* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "kabstractdebugdialog.h"
21 #include <kconfig.h>
22 #include <kpushbutton.h>
23 #include <QLayout>
24 #include <kapplication.h>
25 #include <klocale.h>
26 #include <kstandardguiitem.h>
27 #include <ktoolinvocation.h>
29 KAbstractDebugDialog::KAbstractDebugDialog( QWidget *parent, const char *name, bool modal )
30 : KDialog( parent)
32 setObjectName(name);
33 setModal(modal);
34 pConfig = new KConfig( "kdebugrc", KConfig::NoGlobals );
37 KAbstractDebugDialog::~KAbstractDebugDialog()
39 delete pConfig;
42 void KAbstractDebugDialog::buildButtons( QVBoxLayout * topLayout )
44 QHBoxLayout *hbox = new QHBoxLayout();
45 hbox->setSpacing( KDialog::spacingHint() );
46 topLayout->addLayout( hbox );
47 pHelpButton = new KPushButton( KStandardGuiItem::help() );
48 hbox->addWidget( pHelpButton );
49 hbox->addStretch(10);
50 QSpacerItem *spacer = new QSpacerItem(40, 0);
51 hbox->addItem(spacer);
52 pOKButton = new KPushButton( KStandardGuiItem::ok() );
53 hbox->addWidget( pOKButton );
54 pApplyButton = new KPushButton( KStandardGuiItem::apply() );
55 hbox->addWidget( pApplyButton );
56 pCancelButton = new KPushButton( KStandardGuiItem::cancel() );
57 hbox->addWidget( pCancelButton );
59 int w1 = pHelpButton->sizeHint().width();
60 int w2 = pOKButton->sizeHint().width();
61 int w3 = pCancelButton->sizeHint().width();
62 int w4 = qMax( w1, qMax( w2, w3 ) );
63 int w5 = pApplyButton->sizeHint().width();
64 w4 = qMax(w4, w5);
66 pHelpButton->setFixedWidth( w4 );
67 pOKButton->setFixedWidth( w4 );
68 pApplyButton->setFixedWidth( w4 );
69 pCancelButton->setFixedWidth( w4 );
71 connect( pHelpButton, SIGNAL( clicked() ), SLOT( slotShowHelp() ) );
72 connect( pOKButton, SIGNAL( clicked() ), SLOT( accept() ) );
73 connect( pApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) );
74 connect( pCancelButton, SIGNAL( clicked() ), SLOT( reject() ) );
77 void KAbstractDebugDialog::slotShowHelp()
79 if (kapp)
80 KToolInvocation::invokeHelp();
83 void KAbstractDebugDialog::slotApply()
85 save();
86 pConfig->sync();
89 #include "kabstractdebugdialog.moc"