core/ui separation

Frans Englich englich at kde.org
Thu May 18 17:13:36 BST 2006


On Thursday 18 May 2006 12:09, Matthias Kretz wrote:
> On Thursday, 18. May 2006 13:09, David Faure wrote:
> > - errors and warnings. I like the idea of an ErrorHandler class that
> > would be derived from in kdeui (maybe as a singleton instanciated by
> > kapplication, which will be in kdeui, and which can be instanciated
> > manually otherwise).
>
> So we'd create something that is similar to the KMessageBox API (without
> the QWidget and KGuiItem parameter)? A non-GUI application could make use
> of a lot of the KMessageBox functionality as well.
>
> A sketch of what it could look like:
>
> kdecore:
> ========
> class KMessageHandler
> {
> public:
> 	virtual void error( const QString& text, const QString& caption, Options
> options ) = 0;
> };

I would generalize it a bit:

Instead of calling the function error(), I would call it message()(also mimics 
the class name). It would also be passed an enum:

MessageType
{
	Debug		= 1,
	Informational	= 2,
	Warning		= 4,
	Error		= 8,
	Fatal		= 16
};

I don't know what the Options above was, but perhaps it was something similar.

I would also like such a class to inherit KShared or similar, and spec all 
related APIs with smart pointers. Makes life much simpler, imho.

Perhaps of interest: DOM Core level 3 has APIs for things like this. 
DOMErrorHandler, DOMError, DOMLocator:

http://www.w3.org/TR/DOM-Level-3-Core/core.html#ERROR-Interfaces-DOMErrorHandler


Cheers,

		Frans




More information about the kde-core-devel mailing list