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

KDEUI

  • kdeui
  • dialogs
kmessageboxmessagehandler.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2006 Michaƫl Larouche <michael.larouche@kdemail.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; version 2
7 of the License.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#include "kmessageboxmessagehandler.h"
20
21#include <kmessagebox.h>
22
23class KMessageBoxMessageHandlerPrivate
24{
25 public:
26 KMessageBoxMessageHandlerPrivate(KMessageBoxMessageHandler *q)
27 : q(q)
28 {
29 }
30
31 void showMessageBox(KMessage::MessageType messageType, const QString &text, const QString &caption);
32 QWidget *parentWidget();
33
34 KMessageBoxMessageHandler *q;
35};
36
37
38KMessageBoxMessageHandler::KMessageBoxMessageHandler(QWidget *parent)
39 : QObject(parent), d(new KMessageBoxMessageHandlerPrivate(this))
40{
41}
42
43KMessageBoxMessageHandler::~KMessageBoxMessageHandler()
44{
45 delete d;
46}
47
48void KMessageBoxMessageHandler::message(KMessage::MessageType messageType, const QString &text, const QString &caption)
49{
50 d->showMessageBox(messageType, text, caption);
51}
52
53void KMessageBoxMessageHandlerPrivate::showMessageBox(KMessage::MessageType messageType,
54 const QString &text, const QString &caption)
55{
56 KMessageBox::DialogType dlgType;
57
58 switch (messageType)
59 {
60 case KMessage::Information:
61 default:
62 dlgType = KMessageBox::Information;
63 break;
64 case KMessage::Error:
65 case KMessage::Fatal:
66 dlgType = KMessageBox::Error;
67 break;
68 case KMessage::Warning:
69 case KMessage::Sorry:
70 dlgType = KMessageBox::Sorry;
71 break;
72 }
73
74 KMessageBox::queuedMessageBox(parentWidget(), dlgType, text, caption);
75}
76
77QWidget *KMessageBoxMessageHandlerPrivate::parentWidget()
78{
79 return qobject_cast<QWidget*>(q->parent());
80}
81
82#include "kmessageboxmessagehandler.moc"
83// kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on;
KMessageBoxMessageHandler
This is a convience KMessageHandler that use KMessageBox.
Definition: kmessageboxmessagehandler.h:35
KMessageBoxMessageHandler::message
virtual void message(KMessage::MessageType messageType, const QString &text, const QString &caption)
Definition: kmessageboxmessagehandler.cpp:48
KMessageBoxMessageHandler::KMessageBoxMessageHandler
KMessageBoxMessageHandler(QWidget *parent=0)
Create a new KMessageBoxMessageHandler.
Definition: kmessageboxmessagehandler.cpp:38
KMessageBoxMessageHandler::~KMessageBoxMessageHandler
virtual ~KMessageBoxMessageHandler()
Destroys the KMessageBoxMessageHandler.
Definition: kmessageboxmessagehandler.cpp:43
KMessageBox::queuedMessageBox
static void queuedMessageBox(QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options)
Like messageBox.
Definition: kmessagebox.cpp:1114
KMessageBox::DialogType
DialogType
Definition: kmessagebox.h:78
KMessageBox::Error
@ Error
Definition: kmessagebox.h:86
KMessageBox::Sorry
@ Sorry
Definition: kmessagebox.h:85
KMessageBox::Information
@ Information
Definition: kmessagebox.h:83
QObject
QWidget
kmessagebox.h
kmessageboxmessagehandler.h
caption
QString caption()
KMessage::MessageType
MessageType
KMessage::Warning
Warning
KMessage::Information
Information
KMessage::Sorry
Sorry
KMessage::Error
Error
KMessage::Fatal
Fatal
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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