KMessage

KMessage Namespace Reference

Enumerations

enum  MessageType {
  Error, Information, Warning, Sorry,
  Fatal
}
 

Functions

KCOREADDONS_EXPORT void message (KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
 
KCOREADDONS_EXPORT void setMessageHandler (KMessageHandler *handler)
 

Detailed Description

Display an informative message using a KMessageHandler.

This class does not define how to display a message, it is just a clean interface for developers to use. The job is done by the current KMessageHandler set in the class.

If no KMessageHandler is currently registered in KMessage, the message will be outputed to stderr.

Use KMessage::setMessageHandler() to use a KMessageHandler.

KMessage::setMessageHandler( new KMessageBoxHandler(this) );
// some operation
KMessage::message( KMessage::Error, i18n("Could not load service. Use kbuildsycoca to fix the service database."), i18n("KService") );

Some KMessageHandler are already done such as KMessageBoxMessageHandler and KPassivePopupMessageHandler.

Author
MichaĆ«l Larouche micha[email protected]el.l[email protected]arouc[email protected][email protected][email protected]demai[email protected]l.ne[email protected]t

Enumeration Type Documentation

Enumerator
Error 

Error message.

Display critical information that affect the behavior of the application.

Information 

Information message.

Display useful information to the user.

Warning 

Warning message.

Display a message that could affect the behavior of the application.

Sorry 

Sorry message.

Display a message explaining that a task couldn't be accomplished.

Fatal 

Fatal message.

Display a message before the application fail and close itself.

Definition at line 40 of file kmessage.h.

Function Documentation

void KMessage::message ( KMessage::MessageType  messageType,
const QString text,
const QString caption = QString() 
)

Display a long message of a certain type.

A long message span on multiple lines and can have a caption.

Parameters
messageTypeCurrrent type of message. See MessageType enum.
textLong message to be displayed.
captionCaption to be used. This is optional.

Definition at line 81 of file kmessage.cpp.

void KMessage::setMessageHandler ( KMessageHandler handler)

Set the current KMessageHandler Note that this method takes ownership of the KMessageHandler.

Parameters
handlerInstance of a real KMessageHandler.
Warning
This function isn't thread-safe. You don't want to change the message handler during the program's execution anyways. Do so only at start-up.

Definition at line 75 of file kmessage.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jul 3 2020 23:01:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.