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

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com)
0003     Copyright (C) 2006 Olivier Goffart <ogoffart@kde.org>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Library General Public
0007     License as published by the Free Software Foundation; either
0008     version 2 of the License, or (at your option) any later version.
0009 
0010     This library is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     Library General Public License for more details.
0014 
0015     You should have received a copy of the GNU Library General Public License
0016     along with this library; see the file COPYING.LIB.  If not, write to
0017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018     Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #include "kdialogbuttonbox.h"
0022 
0023 #include <kguiitem.h>
0024 #include <kpushbutton.h>
0025 #include <QList>
0026 
0027 KDialogButtonBox::KDialogButtonBox(QWidget *parent, Qt::Orientation _orientation)
0028     :  QDialogButtonBox(_orientation, parent), d(nullptr)
0029 {
0030 }
0031 
0032 KDialogButtonBox::~KDialogButtonBox() {}
0033 
0034 QPushButton *KDialogButtonBox::addButton(const QString &text, ButtonRole role, QObject *receiver,  const char *slot)
0035 {
0036     QPushButton *pb = addButton(text, role);
0037 
0038     if (pb && receiver && slot) {
0039         QObject::connect(pb, SIGNAL(clicked()), receiver, slot);
0040     }
0041 
0042     return pb;
0043 }
0044 
0045 KPushButton *KDialogButtonBox::addButton(const KGuiItem &guiitem, ButtonRole role, QObject *receiver,  const char *slot)
0046 {
0047     KPushButton *pb = new KPushButton(this);
0048     KGuiItem::assign(pb, guiitem);
0049     QDialogButtonBox::addButton(pb, role);
0050 
0051     if (receiver && slot) {
0052         QObject::connect(pb, SIGNAL(clicked()), receiver, slot);
0053     }
0054 
0055     return pb;
0056 }
0057 
0058 #include "moc_kdialogbuttonbox.cpp"