Warning, /sdk/kdesvn/src/KMessageBox_KDESvnCompat is written in an unsupported language. File is not indexed.

0001 /***************************************************************************
0002  *   Copyright (C) 2023 by Friedrich W. H. Kossebau                        *
0003  *   kossebau@kde.org                                                      *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program 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         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 
0021 #ifndef KMESSAGEBOX_KDESVNCOMPAT
0022 #define KMESSAGEBOX_KDESVNCOMPAT
0023 
0024 #include <kwidgetsaddons_version.h>
0025 #include <KMessageBox>
0026 
0027 // Temporary private porting helper to avoid if-else cluttering of the codebase.
0028 // Once KF5_DEP_VERSION >= 5.100 is reached:
0029 // * rm all #include <KMessageBox_KDESvnCompat>
0030 // * git rm KMessageBox_KDESvnCompat
0031 #if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
0032 namespace KMessageBox {
0033 
0034 inline constexpr auto PrimaryAction = KMessageBox::Yes;
0035 inline constexpr auto SecondaryAction = KMessageBox::No;
0036 
0037 inline ButtonCode questionTwoActions(QWidget* parent, const QString& text, const QString& title,
0038                                      const KGuiItem& primaryAction, const KGuiItem& secondaryAction,
0039                                      const QString& dontAskAgainName = QString(), Options options = Notify)
0040 {
0041     return questionYesNo(parent, text, title, primaryAction, secondaryAction, dontAskAgainName, options);
0042 }
0043 
0044 inline ButtonCode questionTwoActionsCancel(QWidget* parent, const QString& text, const QString& title,
0045                                            const KGuiItem& primaryAction, const KGuiItem& secondaryAction,
0046                                            const KGuiItem& cancelAction = KStandardGuiItem::cancel(),
0047                                            const QString& dontAskAgainName = QString(), Options options = Notify)
0048 {
0049     return questionYesNoCancel(parent, text, title, primaryAction, secondaryAction, cancelAction, dontAskAgainName,
0050                                options);
0051 }
0052 
0053 inline ButtonCode warningTwoActionsList(QWidget* parent, const QString& text, const QStringList& strlist,
0054                                         const QString& title, const KGuiItem& primaryAction,
0055                                         const KGuiItem& secondaryAction, const QString& dontAskAgainName = QString(),
0056                                         Options options = Options(Notify | Dangerous))
0057 {
0058     return warningYesNoList(parent, text, strlist, title, primaryAction, secondaryAction, dontAskAgainName, options);
0059 }
0060 
0061 }
0062 #endif
0063 
0064 #endif // KMESSAGEBOX_KDEVCOMPAT