2 This file is part of KOrganizer.
4 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
25 #include "komessagebox.h"
27 #include <kmessagebox.h>
29 #include <kpushbutton.h>
31 int KOMessageBox::fourBtnMsgBox( QWidget
*parent
, QMessageBox::Icon type
,
33 const QString
&caption
,
34 const KGuiItem
&button1
,
35 const KGuiItem
&button2
,
36 const KGuiItem
&button3
,
37 KMessageBox::Options options
)
39 KDialog
*dialog
= new KDialog( parent
);
40 dialog
->setCaption( caption
);
41 dialog
->setButtons( KDialog::Yes
| KDialog::No
| KDialog::Ok
| KDialog::Cancel
);
42 dialog
->setObjectName( "KOMessageBox" );
43 dialog
->setDefaultButton( KDialog::Yes
);
44 dialog
->setButtonGuiItem( KDialog::Ok
, button3
);
45 dialog
->setButtonGuiItem( KDialog::Yes
, button1
);
46 dialog
->setButtonGuiItem( KDialog::No
, button2
);
47 // QObject::connect( dialog, SIGNAL( yesClicked() ), dialog, SLOT(slotYes()));
48 // QObject::connect( dialog, SIGNAL( noClicked() ), dialog, SLOT(slotNo()));
51 bool checkboxResult
= false;
52 int result
= KMessageBox::createKMessageBox(dialog
, type
, text
, QStringList(),
53 QString(), &checkboxResult
, options
);
55 case KDialog::Yes
: result
= KMessageBox::Yes
; break;
56 case KDialog::No
: result
= KMessageBox::No
; break;
57 case KDialog::Ok
: result
= KMessageBox::Continue
; break;
58 case KDialog::Cancel
: result
= KMessageBox::Cancel
; break;