/usr/include/kmessage.h is in kdelibs5-dev 4:4.14.16-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /* This file is part of the KDE libraries
Copyright (C) 2006 Michaël Larouche <michael.larouche@kdemail.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDECORE_KMESSAGE_H
#define KDECORE_KMESSAGE_H
#include <kdecore_export.h>
#include <QtCore/QString>
class KMessageHandler;
/**
* @brief 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.
*
* @code
* 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") );
* @endcode
*
* Some KMessageHandler are already done such as KMessageBoxMessageHandler and KPassivePopupMessageHandler.
* @author Michaël Larouche <michael.larouche@kdemail.net>
*/
namespace KMessage
{
enum MessageType
{
/**
* Error message.
* Display critical information that affect the behavior of the application.
*/
Error,
/**
* Information message.
* Display useful information to the user.
*/
Information,
/**
* Warning message.
* Display a message that could affect the behavior of the application.
*/
Warning,
/**
* Sorry message.
* Display a message explaining that a task couldn't be accomplished.
*/
Sorry,
/**
* Fatal message.
* Display a message before the application fail and close itself.
*/
Fatal
};
/**
* @brief Display a long message of a certain type.
* A long message span on multiple lines and can have a caption.
*
* @param messageType Currrent type of message. See MessageType enum.
* @param text Long message to be displayed.
* @param caption Caption to be used. This is optional.
*/
KDECORE_EXPORT void message(KMessage::MessageType messageType, const QString &text, const QString &caption = QString());
/**
* @brief Set the current KMessageHandler
* Note that this method takes ownership of the KMessageHandler.
* @param 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 <b>only</b> at start-up.
*/
KDECORE_EXPORT void setMessageHandler(KMessageHandler *handler);
}
/**
* \class KMessageHandler kmessage.h <KMessageHandler>
*
* @brief Abstract class for KMessage handler.
* This class define how KMessage display a message.
*
* Reimplement the virtual methods then set your custom
* KMessageHandler using KMessage::setMessageHandler()
*
* @author Michaël Larouche <michael.larouche@kdemail.net>
*/
class KDECORE_EXPORT KMessageHandler
{
public:
virtual ~KMessageHandler() {}
/**
* @brief Display a long message of a certain type.
* A long message span on multiple lines and can have a caption.
*
* @param type Currrent type of message. See MessageType enum.
* @param text Long message to be displayed.
* @param caption Caption to be used. This is optional.
*/
virtual void message(KMessage::MessageType type, const QString &text, const QString &caption) = 0;
};
#endif
// kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on;
|