File indexing completed on 2024-04-14 14:20:22
0001 /* This file is part of the KDE libraries 0002 Copyright (C) 1999 Waldo Bastian (bastian@kde.org) 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; version 2 0007 of the License. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "kmessagebox_queued.h" 0021 0022 #include "kdialogqueue_p.h" 0023 0024 namespace KMessageBox 0025 { 0026 0027 extern QDialogButtonBox::StandardButton KWIDGETSADDONS_EXPORT(*KMessageBox_exec_hook)(QDialog *); 0028 0029 QDialogButtonBox::StandardButton queued_dialog_exec(QDialog *dialog) 0030 { 0031 KDialogQueue::queueDialog(dialog); 0032 return QDialogButtonBox::NoButton; // We have to return something. 0033 } 0034 0035 void queuedDetailedError(QWidget *parent, const QString &text, 0036 const QString &details, 0037 const QString &caption) 0038 { 0039 return queuedDetailedErrorWId(parent ? parent->effectiveWinId() : 0, text, details, caption); 0040 } 0041 0042 void queuedDetailedErrorWId(WId parent_id, const QString &text, 0043 const QString &details, 0044 const QString &caption) 0045 { 0046 KMessageBox_exec_hook = &queued_dialog_exec; 0047 (void) detailedErrorWId(parent_id, text, details, caption); 0048 KMessageBox_exec_hook = nullptr; 0049 } 0050 0051 void queuedMessageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options) 0052 { 0053 return queuedMessageBoxWId(parent ? parent->effectiveWinId() : 0, type, text, caption, options); 0054 } 0055 0056 void queuedMessageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption, Options options) 0057 { 0058 KMessageBox_exec_hook = &queued_dialog_exec; 0059 (void) messageBoxWId(parent_id, type, text, caption, KStandardGuiItem::yes(), 0060 KStandardGuiItem::no(), KStandardGuiItem::cancel(), QString(), options); 0061 KMessageBox_exec_hook = nullptr; 0062 } 0063 0064 void queuedMessageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption) 0065 { 0066 return queuedMessageBoxWId(parent ? parent->effectiveWinId() : 0, type, text, caption); 0067 } 0068 0069 void queuedMessageBoxWId(WId parent_id, DialogType type, const QString &text, const QString &caption) 0070 { 0071 KMessageBox_exec_hook = &queued_dialog_exec; 0072 (void) messageBoxWId(parent_id, type, text, caption); 0073 KMessageBox_exec_hook = nullptr; 0074 } 0075 0076 } // KMessageBox