KMessage

KDE 4.9 PyKDE API Reference

- KDE's Python API

# KMessage Namespace Reference

`from PyKDE4.kdecore.KMessage import *`

## 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 <michael.larouche@kdemail.net>

## Enumerations
MessageType | { Error, Information, Warning, Sorry, Fatal }
## Functions
| message (KMessage.MessageType messageType, QString text, QString caption=QString())
| setMessageHandler (KMessageHandler handler)

## Enumeration Documentation

MessageType

Enumerator:

  Error |
  Information |
  Warning |
  Sorry |
  Fatal |

## Function Documentation

message | ( | KMessage.MessageType | messageType,
|  | QString | text,
|  | QString | caption=QString()
| ) |  |  |

Display a long message of a certain type. A long message span on multiple lines and can have a caption.

Parameters:

  | messageType | Currrent type of message. See MessageType enum.
  | text | Long message to be displayed.
  | caption | Caption to be used. This is optional.

setMessageHandler | ( | KMessageHandler | handler
| ) |  |  |

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

Parameters:

  | handler | Instance 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.