korganizer

komessagebox.cpp
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5
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.
10
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.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24
25#include <tdemessagebox.h>
26#include <kdialogbase.h>
27#include <tqpushbutton.h>
28
29#include "komessagebox.h"
30
31int KOMessageBox::fourBtnMsgBox( TQWidget *parent, TQMessageBox::Icon type,
32 const TQString &text, const TQString &caption,
33 const KGuiItem &button1, const KGuiItem &button2,
34 const KGuiItem &button3, int options)
35{
36 KDialogBase *dialog= new KDialogBase( parent, "KOMessageBox", true,
37 caption.isEmpty() ? "" : caption,
38 KDialogBase::Yes | KDialogBase::No | KDialogBase::Ok | KDialogBase::Cancel,
39 KDialogBase::Yes,
40 true/*, button1, button2, button3*/);
41 dialog->setButtonOK( button3 );
42 dialog->setButtonText( KDialogBase::Yes, button1.text() );
43 dialog->setButtonText( KDialogBase::No, button2.text() );
44 TQObject::connect( dialog->actionButton( KDialogBase::Yes ), TQ_SIGNAL( clicked() ), dialog, TQ_SLOT(slotYes()));
45 TQObject::connect( dialog->actionButton( KDialogBase::No ), TQ_SIGNAL( clicked() ), dialog, TQ_SLOT(slotNo()));
46// TQObject::connect( dialog, TQ_SIGNAL( noClicked() ), dialog, TQ_SLOT(slotNo()));
47
48
49 bool checkboxResult = false;
50 int result = KMessageBox::createKMessageBox(dialog, type, text, TQStringList(),
51 TQString(), &checkboxResult, options);
52 switch (result) {
53 case KDialogBase::Yes: result = KMessageBox::Yes; break;
54 case KDialogBase::No: result = KMessageBox::No; break;
55 case KDialogBase::Ok: result = KMessageBox::Continue; break;
56 case KDialogBase::Cancel: result = KMessageBox::Cancel; break;
57 default: break;
58 }
59
60 return result;
61}
62
63