• Skip to content
  • Skip to link menu
KDE 4.1 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 
00164 class KDEUI_EXPORT KNotification : public QObject
00165 {
00166         Q_OBJECT
00167 
00168 public:
00187     typedef QPair<QString,QString> Context;
00188     typedef QList< Context > ContextList;
00189 
00190     enum NotificationFlag
00191     {
00198         RaiseWidgetOnActivation=0x01,
00199 
00203         CloseOnTimeout=0x00,
00204         
00210         Persistent=0x02,
00211 
00222         CloseWhenWidgetActivated=0x04,
00226         Persistant = Persistent,
00231         DefaultEvent=0xF000
00232         
00233     };
00234     
00235     Q_DECLARE_FLAGS(NotificationFlags , NotificationFlag)
00236 
00237     
00240     enum StandardEvent { Notification , Warning , Error , Catastrophe };
00256     explicit KNotification(const QString & eventId , QWidget *widget=0L, const NotificationFlags &flags=CloseOnTimeout);
00257 
00258     ~KNotification();
00259 
00269     QWidget *widget() const;
00270     
00277     void setWidget(QWidget *widget);
00278     
00279     
00283     QString eventId() const;
00284     
00289     QString text() const ;
00290     
00299     void setText(const QString &text);
00300     
00305     QPixmap pixmap() const;
00310     void setPixmap(const QPixmap &pix);
00311     
00315     QStringList actions() const;
00316     
00321     void setActions(const QStringList& actions);
00322     
00326     ContextList contexts() const;
00332     void setContexts( const ContextList &contexts);
00337     void addContext( const Context & context);
00343     void addContext( const QString & context_key, const QString & context_value );
00344     
00348     NotificationFlags flags() const;
00349     
00354     void setFlags(const NotificationFlags &flags);
00355 
00360     void setComponentData(const KComponentData &componentData);
00361 
00362    Q_SIGNALS:
00366     void activated();
00371     void activated(unsigned int action);
00372     
00376     void action1Activated();
00377     
00381     void action2Activated();
00382 
00386     void action3Activated();
00387 
00391     void closed();
00392 
00396     void ignored();
00397 
00398 public Q_SLOTS:
00403     void activate(unsigned int action=0);
00404 
00410     void close();
00411 
00416     void raiseWidget();
00417 
00426     void ref();
00432     void deref();
00433     
00437     void sendEvent();
00438     
00443     void update();
00444 
00445 private Q_SLOTS:
00446     void slotReceivedId(int);
00447     void slotReceivedIdError(const QDBusError&);
00448     
00449 private:
00450     struct Private;
00451     Private *const d;
00452     
00453 protected:
00457     virtual bool eventFilter( QObject * watched, QEvent * event );
00458 
00459 
00460 public:
00484         static KNotification *event(const QString &eventId , const QString &text = QString(),
00485                 const QPixmap &pixmap = QPixmap(), QWidget *widget = 0L,
00486                 const NotificationFlags &flags = CloseOnTimeout,
00487                 const KComponentData &componentData = KComponentData());
00488 
00501     static KNotification *event( StandardEvent eventId , const QString& text=QString(),
00502                                  const QPixmap& pixmap=QPixmap(), QWidget *widget=0L,
00503                                  const NotificationFlags& flags=CloseOnTimeout);
00504     
00511     static void beep( const QString& reason = QString() , QWidget *widget=0L);
00512     
00513     //prevent warning
00514     using QObject::event;
00515 };
00516 
00517 Q_DECLARE_OPERATORS_FOR_FLAGS(KNotification::NotificationFlags)
00518 
00519 #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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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