• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

Enumerations | Functions
KMessage Namespace Reference

Enumerations

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

Functions

void message (KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
 
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.nosp@m.el.l.nosp@m.arouc.nosp@m.he@k.nosp@m.demai.nosp@m.l.ne.nosp@m.t

Enumeration Type Documentation

enum KMessage::MessageType
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 51 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 92 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 86 of file kmessage.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal