/***************************************************************************
 *   Copyright (C) 2023 by Friedrich W. H. Kossebau                        *
 *   kossebau@kde.org                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#ifndef KMESSAGEBOX_KDESVNCOMPAT
#define KMESSAGEBOX_KDESVNCOMPAT

#include <kwidgetsaddons_version.h>
#include <KMessageBox>

// Temporary private porting helper to avoid if-else cluttering of the codebase.
// Once KF5_DEP_VERSION >= 5.100 is reached:
// * rm all #include <KMessageBox_KDESvnCompat>
// * git rm KMessageBox_KDESvnCompat
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 100, 0)
namespace KMessageBox {

inline constexpr auto PrimaryAction = KMessageBox::Yes;
inline constexpr auto SecondaryAction = KMessageBox::No;

inline ButtonCode questionTwoActions(QWidget* parent, const QString& text, const QString& title,
                                     const KGuiItem& primaryAction, const KGuiItem& secondaryAction,
                                     const QString& dontAskAgainName = QString(), Options options = Notify)
{
    return questionYesNo(parent, text, title, primaryAction, secondaryAction, dontAskAgainName, options);
}

inline ButtonCode questionTwoActionsCancel(QWidget* parent, const QString& text, const QString& title,
                                           const KGuiItem& primaryAction, const KGuiItem& secondaryAction,
                                           const KGuiItem& cancelAction = KStandardGuiItem::cancel(),
                                           const QString& dontAskAgainName = QString(), Options options = Notify)
{
    return questionYesNoCancel(parent, text, title, primaryAction, secondaryAction, cancelAction, dontAskAgainName,
                               options);
}

inline ButtonCode warningTwoActionsList(QWidget* parent, const QString& text, const QStringList& strlist,
                                        const QString& title, const KGuiItem& primaryAction,
                                        const KGuiItem& secondaryAction, const QString& dontAskAgainName = QString(),
                                        Options options = Options(Notify | Dangerous))
{
    return warningYesNoList(parent, text, strlist, title, primaryAction, secondaryAction, dontAskAgainName, options);
}

}
#endif

#endif // KMESSAGEBOX_KDEVCOMPAT
