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

Applets

devicenotifier.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Alexis Ménard <darktears31@gmail.com>           *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00018  ***************************************************************************/
00019 
00020 #ifndef DEVICENOTIFIER_H
00021 #define DEVICENOTIFIER_H
00022 
00023 #include <solid/solidnamespace.h>
00024 #include <plasma/applet.h>
00025 #include <plasma/dataengine.h>
00026 #include <plasma/animator.h>
00027 #include <plasma/dialog.h>
00028 #include <KIcon>
00029 #include <QModelIndex>
00030 #include <QGraphicsProxyWidget>
00031 #include <QGraphicsGridLayout>
00032 #include <QTimer>
00033 #include <QListView>
00034 
00035 #include "ui_deviceNotifierConfig.h"
00036 
00037 class QStandardItemModel;
00038 class QGraphicsLinearLayout;
00039 
00040 namespace Notifier
00041 {
00042     class NotifierView;
00043 }
00044 
00045 //desktop view
00046 namespace Plasma
00047 {
00048     class Icon;
00049 }
00050 
00051 class DeviceNotifier : public Plasma::Applet
00052 {
00053     Q_OBJECT
00054 
00055     public:
00056         struct ItemType
00057         {
00058             Plasma::Icon *icon;
00059             QStringList predicateFiles;
00060             QString text;
00061             QString udi;
00062         };
00063 
00064         enum SpecificRoles {
00065             SolidUdiRole = Qt::UserRole + 1,
00066             PredicateFilesRole = Qt::UserRole + 2,
00067             ActionRole = Qt::UserRole + 3,
00068             IconNameRole = Qt::UserRole + 4,
00069             ScopeRole = Qt::UserRole + 5,
00070             SubTitleMandatoryRole = Qt::UserRole + 6
00071         };
00072 
00073         DeviceNotifier(QObject *parent, const QVariantList &args);
00074         ~DeviceNotifier();
00075 
00076         void init();
00077         void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &rect);
00078         void constraintsEvent(Plasma::Constraints constraints);
00079     public slots:
00080         void onSourceAdded(const QString &name);
00081         void onSourceRemoved(const QString &name);
00082         void dataUpdated(const QString &source, Plasma::DataEngine::Data data);
00083         void configAccepted();
00084         void slotOnItemClicked(const QModelIndex &);
00085         void onTimerExpired();
00086         void onClickNotifier();
00087 
00088     protected:
00089         void createConfigurationInterface(KConfigDialog *parent);
00090 
00091     private slots:
00092         void storageEjectDone(Solid::ErrorType error, QVariant errorData);
00093         void storageTeardownDone(Solid::ErrorType error, QVariant errorData);
00094         void resetIcon();
00095     void updateColors();
00096 
00097     private:
00098         QModelIndex indexForUdi(const QString &udi) const;
00099         void initSysTray();
00100 
00101         Plasma::DataEngine *m_solidEngine;
00102         Plasma::DataEngine *m_solidDeviceEngine;
00103         QStandardItemModel *m_hotplugModel;
00104 
00105         Plasma::Dialog *m_widget;
00106         Plasma::Icon *m_icon;
00107         QLabel *m_label;
00108         QGraphicsProxyWidget * m_proxy;
00109         int m_displayTime;
00110         int m_numberItems;
00111         int m_itemsValidity;
00112         Notifier::NotifierView *m_notifierView;
00113         QTimer *m_timer;
00114         bool isNotificationEnabled;
00115         QGraphicsLinearLayout *m_layout;
00116 
00118         Ui::solidNotifierConfig ui;
00119 
00120 };
00121 
00122 K_EXPORT_PLASMA_APPLET(devicenotifier, DeviceNotifier)
00123 
00124 #endif

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference 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