Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / plasma / applets / devicenotifier / devicenotifier.h
blobdbf130d0f0351872793c33fd6b2d439fa4c8149b
1 /***************************************************************************
2 * Copyright (C) 2007 by Alexis Ménard <darktears31@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program 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 *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
20 #ifndef DEVICENOTIFIER_H
21 #define DEVICENOTIFIER_H
23 #include <plasma/applet.h>
24 #include <plasma/dataengine.h>
25 #include <plasma/phase.h>
26 #include <plasma/dialog.h>
27 #include <KIcon>
28 #include <QModelIndex>
29 #include <QGraphicsProxyWidget>
30 #include <QGraphicsGridLayout>
31 #include <QTimer>
32 #include <QListView>
34 #include "ui_deviceNotifierConfig.h"
36 class QStandardItemModel;
37 class KDialog;
39 //desktop view
40 namespace Plasma
42 class BoxLayout;
43 class Icon;
46 class DeviceNotifier : public Plasma::Applet
48 Q_OBJECT
50 public:
51 struct ItemType
53 Plasma::Icon *icon;
54 QStringList predicateFiles;
55 QString text;
56 QString udi;
59 DeviceNotifier(QObject *parent, const QVariantList &args);
60 ~DeviceNotifier();
62 void init();
63 Qt::Orientations expandingDirections() const;
64 QSizeF contentSizeHint() const;
65 void hoverEnterEvent (QGraphicsSceneHoverEvent *event);
66 void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &rect);
67 public slots:
68 void onSourceAdded(const QString &name);
69 void onSourceRemoved(const QString &name);
70 void dataUpdated(const QString &source, Plasma::DataEngine::Data data);
71 void showConfigurationInterface();
72 void configAccepted();
73 void slotOnItemClicked(const QModelIndex &);
74 void onTimerExpired();
75 void onClickNotifier();
77 private:
78 QModelIndex indexForUdi(const QString &udi) const;
79 void initDesktop();
80 void initSysTray();
82 Plasma::DataEngine *m_solidEngine;
83 QStandardItemModel *m_hotplugModel;
85 Plasma::Dialog *m_widget;
86 Plasma::Icon *m_icon;
87 //QGraphicsGridLayout *m_layout;
88 Plasma::BoxLayout *m_layout;
89 QGraphicsProxyWidget * m_proxy;
90 KDialog *m_dialog;
91 int m_displayTime;
92 int m_numberItems;
93 int m_itemsValidity;
94 QTimer *m_timer;
95 bool isOnDesktop;
96 bool isNotificationEnabled;
98 /// Designer Config file
99 Ui::solidNotifierConfig ui;
103 K_EXPORT_PLASMA_APPLET(devicenotifier, DeviceNotifier)
105 #endif