Applets
notifierdialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef NOTIFIERDIALOG_H
00021 #define NOTIFIERDIALOG_H
00022
00023
00024 #include <QWidget>
00025 #include <QStringList>
00026
00027
00028 #include <solid/solidnamespace.h>
00029
00030
00031
00032 #include <QTreeView>
00033
00034 class QModelIndex;
00035 class QStandardItemModel;
00036 class QStandardItem;
00037 class QLabel;
00038
00039
00040 class DeviceNotifier;
00041
00042
00043 namespace Plasma
00044 {
00045 class Icon;
00046 class Dialog;
00047 }
00048 namespace Solid
00049 {
00050 class Device;
00051 }
00052 namespace Notifier
00053 {
00054 class NotifierView;
00055
00060 class NotifierDialog : public QObject
00061 {
00062 Q_OBJECT
00063
00064 public:
00065
00066
00068 enum SpecificRoles {
00069 SolidUdiRole = Qt::UserRole + 1,
00070 PredicateFilesRole = Qt::UserRole + 2,
00071 ActionRole = Qt::UserRole + 3,
00072 IconNameRole = Qt::UserRole + 4,
00073 ScopeRole = Qt::UserRole + 5,
00074 SubTitleMandatoryRole = Qt::UserRole + 6
00075 };
00076
00083 NotifierDialog(DeviceNotifier * notifier,QObject *parent = 0);
00084
00088 virtual ~NotifierDialog();
00089
00093 QWidget * dialog();
00094
00098 void hide();
00099
00103 void show();
00104
00109 void insertDevice(const QString &name);
00110
00111 void setUnMount(bool unmount,const QString &name);
00112
00119 void setDeviceData(const QString &name, QVariant data, int role);
00120
00126 QVariant getDeviceData(const QString &name, int role);
00127
00132 void removeDevice(const QString &name);
00133
00138 void removeDevice(int index);
00139
00144 int countDevices();
00145
00150 QString getDeviceUdi(int index);
00151
00152 signals :
00153
00154 void itemSelected();
00155
00156 private slots:
00161 void slotOnItemClicked(const QModelIndex & index);
00162
00168 void storageEjectDone(Solid::ErrorType error, QVariant errorData);
00169
00175 void storageTeardownDone(Solid::ErrorType error, QVariant errorData);
00176
00180 void resetNotifierIcon();
00181
00186 void updateColors();
00187
00188
00189 private :
00193 void buildDialog();
00194
00199 QModelIndex indexForUdi(const QString &udi) const;
00200
00202 QStandardItemModel *m_hotplugModel;
00203
00204
00205 QWidget *m_widget;
00207 NotifierView *m_notifierView;
00208
00210 QLabel * m_label;
00211
00213 DeviceNotifier * m_notifier;
00214
00216 QStandardItem *m_rootItem;
00217
00222 QStandardItem* searchOrCreateDeviceCategory(const QString &categoryName);
00223
00228 QString getCategoryNameOfDevice(const Solid::Device& device);
00229 };
00230
00231 }
00232
00233 #endif
00234