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

KDEUI

knotification.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2005-2006 Olivier Goffart <ogoffart at kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 
00020 #ifndef KNOTIFICATION_H
00021 #define KNOTIFICATION_H
00022 
00023 #include <kdeui_export.h>
00024 #include <kcomponentdata.h>
00025 
00026 #include <QtGui/QPixmap>
00027 #include <QtCore/QObject>
00028 #include <QtCore/QPair>
00029 
00030 class QWidget;
00031 class QDBusError;
00032 
00176 class KDEUI_EXPORT KNotification : public QObject
00177 {
00178         Q_OBJECT
00179 
00180 public:
00199     typedef QPair<QString,QString> Context;
00200     typedef QList< Context > ContextList;
00201 
00202     enum NotificationFlag
00203     {
00210         RaiseWidgetOnActivation=0x01,
00211 
00215         CloseOnTimeout=0x00,
00216         
00222         Persistent=0x02,
00223 
00234         CloseWhenWidgetActivated=0x04,
00238         Persistant = Persistent,
00243         DefaultEvent=0xF000
00244         
00245     };
00246     
00247     Q_DECLARE_FLAGS(NotificationFlags , NotificationFlag)
00248 
00249     
00252     enum StandardEvent { Notification , Warning , Error , Catastrophe };
00268     explicit KNotification(const QString & eventId , QWidget *widget=0L, const NotificationFlags &flags=CloseOnTimeout);
00269 
00270     ~KNotification();
00271 
00281     QWidget *widget() const;
00282     
00289     void setWidget(QWidget *widget);
00290     
00291     
00295     QString eventId() const;
00296 
00302     QString title() const;
00303 
00311     void setTitle(const QString &title);
00312 
00317     QString text() const ;
00318     
00327     void setText(const QString &text);
00328     
00333     QPixmap pixmap() const;
00338     void setPixmap(const QPixmap &pix);
00339     
00343     QStringList actions() const;
00344     
00349     void setActions(const QStringList& actions);
00350     
00354     ContextList contexts() const;
00360     void setContexts( const ContextList &contexts);
00365     void addContext( const Context & context);
00371     void addContext( const QString & context_key, const QString & context_value );
00372     
00376     NotificationFlags flags() const;
00377     
00382     void setFlags(const NotificationFlags &flags);
00383 
00388     void setComponentData(const KComponentData &componentData);
00389 
00390    Q_SIGNALS:
00394     void activated();
00399     void activated(unsigned int action);
00400     
00404     void action1Activated();
00405     
00409     void action2Activated();
00410 
00414     void action3Activated();
00415 
00419     void closed();
00420 
00424     void ignored();
00425 
00426 public Q_SLOTS:
00431     void activate(unsigned int action=0);
00432 
00438     void close();
00439 
00444     void raiseWidget();
00445 
00454     void ref();
00460     void deref();
00461     
00465     void sendEvent();
00466     
00471     void update();
00472 
00473 private Q_SLOTS:
00474     void slotReceivedId(int);
00475     void slotReceivedIdError(const QDBusError&);
00476     
00477 private:
00478     struct Private;
00479     Private *const d;
00480     
00481 protected:
00485     virtual bool eventFilter( QObject * watched, QEvent * event );
00486 
00487 
00488 public:
00512         static KNotification *event(const QString &eventId , const QString &text = QString(),
00513                 const QPixmap &pixmap = QPixmap(), QWidget *widget = 0L,
00514                 const NotificationFlags &flags = CloseOnTimeout,
00515                 const KComponentData &componentData = KComponentData());
00516 
00529     static KNotification *event( StandardEvent eventId , const QString& text=QString(),
00530                                  const QPixmap& pixmap=QPixmap(), QWidget *widget=0L,
00531                                  const NotificationFlags& flags=CloseOnTimeout);
00532     
00539     static void beep( const QString& reason = QString() , QWidget *widget=0L);
00540     
00541     //prevent warning
00542     using QObject::event;
00543 };
00544 
00545 Q_DECLARE_OPERATORS_FOR_FLAGS(KNotification::NotificationFlags)
00546 
00547 #endif

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal