Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMessageBoxWrapper Namespace Reference

Functions

int doNotAskAgainMessageBoxWrapper (QMessageBox *messageBox, const QString &identifier)
 doNotAskAgainMessageBoxWrapper takes a messagebox and an identifier and adds a Do Not Ask Again checkbox to the messagebox; then runs the checkbox and returns the return balue
 

Detailed Description

Wrap a QMessageBox

Function Documentation

◆ doNotAskAgainMessageBoxWrapper()

KRITAGLOBAL_EXPORT int KisMessageBoxWrapper::doNotAskAgainMessageBoxWrapper ( QMessageBox * messageBox,
const QString & identifier )

doNotAskAgainMessageBoxWrapper takes a messagebox and an identifier and adds a Do Not Ask Again checkbox to the messagebox; then runs the checkbox and returns the return balue

Parameters
messageBoxthe wrapped messagebox
identifiera unique identifier that is used to store the the check in the config file
Returns
the result of running the messagebox. If the messagebox is not shown, the return value is QMessageBox::Yes

Definition at line 19 of file KisMessageBoxWrapper.cpp.

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}