KMessage/KMessageHandler: a core/ui seperation for displaying message.

Matt Rogers mattr at kde.org
Sun May 28 20:01:11 BST 2006


On Sunday 28 May 2006 12:06, Michaƫl Larouche wrote:
> I rencently wanted to make a notification framework for Kopete4 to replace
> all the KMessageBox in the code. Then Olivier Goffart remembered me of the
> thread "core/ui separation".
>
> So I've made the required classes to separate the message display.
>
> kdecore: KMessage and KMessageHandler
> KMessage is the "frontend" API static class developers use the display a
> message. You must supply a KMessageHandler to work properly.
>
> KMessageHandler is the abstract class for the message handle.
>
> kdeui: KMessageBoxMessageHandler and KPassivePopupMessageHandler
> Those are obvious, there are KMessageHandler implementation that developers
> can use right away.
>
> So it is used like
>
> KMessage::setMessageHandler( new KMessageBoxHandler(this) );
> KMessage::message(  KMessage::Information, i18n("Information"),
> i18n("Caption") );
>
> Applications can develop custom KMessageHandler for fine grained control in
> their application, like amaroK could use it with their KDE::StatusBar
> class.
>
> The patch include:
> -KMessage,KMessageHandler,KMessageBoxMessageHandler,KPassivePopupMessageHan
>dler -KMessage_Test in kdeui/tets

Why are you making KMessage::internalShowStdOutMessage a generic logging 
mechanism? We have kDebug for debug messages, so we should remove any sort of 
debug message handling from KMessage. Also, I'd remove the all caps prefixes, 
and just make them normal case.

I would rename KMessageHandler::shortMessage to statusMessage. You could also 
remove it entirely and provide a way to disable the caption in 
KMessageHandler::message
--
Matt




More information about the kde-core-devel mailing list