Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMessageBoxWrapper.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Halla Rempt <halla@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8#include <QMessageBox>
9#include <QString>
10#include <QCheckBox>
11
12#include <kconfig.h>
13#include <kconfiggroup.h>
14#include <ksharedconfig.h>
15#include <klocalizedstring.h>
16
18
19int doNotAskAgainMessageBoxWrapper(QMessageBox *messageBox, const QString &identifier)
20{
21 KConfigGroup cfg(KSharedConfig::openConfig(), "DoNotAskAgain");
22 bool showMessage = cfg.readEntry(identifier, true);
23 if (showMessage) {
24 QCheckBox *cb = new QCheckBox(i18n("Don't ask this again"));
25 messageBox->setCheckBox(cb);
26 const int res = messageBox->exec();
27 cfg.writeEntry(identifier, cb->checkState() == Qt::CheckState::Unchecked);
28 return res;
29 }
30 else {
31 return QMessageBox::Yes;
32 }
33}
34
35
36}
int doNotAskAgainMessageBoxWrapper(QMessageBox *messageBox, const QString &identifier)
doNotAskAgainMessageBoxWrapper takes a messagebox and an identifier and adds a Do Not Ask Again check...