• Skip to content
  • Skip to link menu
KDE 4.2 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 
00168 class KDEUI_EXPORT KNotification : public QObject
00169 {
00170         Q_OBJECT
00171 
00172 public:
00191     typedef QPair<QString,QString> Context;
00192     typedef QList< Context > ContextList;
00193 
00194     enum NotificationFlag
00195     {
00202         RaiseWidgetOnActivation=0x01,
00203 
00207         CloseOnTimeout=0x00,
00208         
00214         Persistent=0x02,
00215 
00226         CloseWhenWidgetActivated=0x04,
00230         Persistant = Persistent,
00235         DefaultEvent=0xF000
00236         
00237     };
00238     
00239     Q_DECLARE_FLAGS(NotificationFlags , NotificationFlag)
00240 
00241     
00244     enum StandardEvent { Notification , Warning , Error , Catastrophe };
00260     explicit KNotification(const QString & eventId , QWidget *widget=0L, const NotificationFlags &flags=CloseOnTimeout);
00261 
00262     ~KNotification();
00263 
00273     QWidget *widget() const;
00274     
00281     void setWidget(QWidget *widget);
00282     
00283     
00287     QString eventId() const;
00288     
00293     QString text() const ;
00294     
00303     void setText(const QString &text);
00304     
00309     QPixmap pixmap() const;
00314     void setPixmap(const QPixmap &pix);
00315     
00319     QStringList actions() const;
00320     
00325     void setActions(const QStringList& actions);
00326     
00330     ContextList contexts() const;
00336     void setContexts( const ContextList &contexts);
00341     void addContext( const Context & context);
00347     void addContext( const QString & context_key, const QString & context_value );
00348     
00352     NotificationFlags flags() const;
00353     
00358     void setFlags(const NotificationFlags &flags);
00359 
00364     void setComponentData(const KComponentData &componentData);
00365 
00366    Q_SIGNALS:
00370     void activated();
00375     void activated(unsigned int action);
00376     
00380     void action1Activated();
00381     
00385     void action2Activated();
00386 
00390     void action3Activated();
00391 
00395     void closed();
00396 
00400     void ignored();
00401 
00402 public Q_SLOTS:
00407     void activate(unsigned int action=0);
00408 
00414     void close();
00415 
00420     void raiseWidget();
00421 
00430     void ref();
00436     void deref();
00437     
00441     void sendEvent();
00442     
00447     void update();
00448 
00449 private Q_SLOTS:
00450     void slotReceivedId(int);
00451     void slotReceivedIdError(const QDBusError&);
00452     
00453 private:
00454     struct Private;
00455     Private *const d;
00456     
00457 protected:
00461     virtual bool eventFilter( QObject * watched, QEvent * event );
00462 
00463 
00464 public:
00488         static KNotification *event(const QString &eventId , const QString &text = QString(),
00489                 const QPixmap &pixmap = QPixmap(), QWidget *widget = 0L,
00490                 const NotificationFlags &flags = CloseOnTimeout,
00491                 const KComponentData &componentData = KComponentData());
00492 
00505     static KNotification *event( StandardEvent eventId , const QString& text=QString(),
00506                                  const QPixmap& pixmap=QPixmap(), QWidget *widget=0L,
00507                                  const NotificationFlags& flags=CloseOnTimeout);
00508     
00515     static void beep( const QString& reason = QString() , QWidget *widget=0L);
00516     
00517     //prevent warning
00518     using QObject::event;
00519 };
00520 
00521 Q_DECLARE_OPERATORS_FOR_FLAGS(KNotification::NotificationFlags)
00522 
00523 #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
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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