File indexing completed on 2024-10-27 04:51:03
0001 /* 0002 SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0005 */ 0006 0007 #include "pimmessagebox.h" 0008 0009 #include <QDialog> 0010 #include <QPushButton> 0011 0012 QDialogButtonBox::StandardButton PIMMessageBox::fourBtnMsgBox(QWidget *parent, 0013 QMessageBox::Icon type, 0014 const QString &text, 0015 const QString &caption, 0016 const QString &button1Text, 0017 const QString &button2Text, 0018 const QString &button3Text, 0019 KMessageBox::Options options) 0020 { 0021 auto dialog = new QDialog(parent); 0022 dialog->setWindowTitle(caption); 0023 auto box = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel | QDialogButtonBox::Ok, parent); 0024 dialog->setObjectName(QLatin1StringView("PIMMessageBox")); 0025 box->button(QDialogButtonBox::Ok)->setText(button3Text); 0026 box->button(QDialogButtonBox::Yes)->setText(button1Text); 0027 box->button(QDialogButtonBox::No)->setText(button2Text); 0028 box->button(QDialogButtonBox::Yes)->setDefault(true); 0029 0030 bool checkboxResult = false; 0031 const QDialogButtonBox::StandardButton result = KMessageBox::createKMessageBox(dialog, box, type, text, QStringList(), QString(), &checkboxResult, options); 0032 return result; 0033 }