KMessageBox return values

Aurélien Gâteau agateau at kde.org
Wed Oct 2 13:39:20 UTC 2013


Hi,

Working on KMessageBox namespace, I noticed all methods returns int, despite 
the namespace declaring a ButtonCode enum. I gave a try at changing the type 
of the return values to KMessageBox::ButtonCode. This would bring better type 
safety, is still source-compatible (existing code which uses an int to store 
the result still works) and should be done before the first kf5 release since 
it changes the public API.

It mostly works, except for one tricky method: createKMessageBox(). This 
method returns a QDialogButtonBox::StandardButton in most cases, except if the 
dialog is queued or if NoExec is passed in the "options" parameter, in which 
case it returns KMessageBox::Cancel.

I would like to change this behavior to return QDialogButtonBox::NoButton 
instead of KMessageBox::Cancel, making it possible to change 
createKMessageBox() return type to QDialogButtonBox::StandardButton.

What do you think?

Aurélien


More information about the Kde-frameworks-devel mailing list