KIO
kdevicelistmodel.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2006 Michael Larouche <michael.larouche@kdemail.net> 00003 2007 Kevin Ottens <ervin@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 00019 */ 00020 #ifndef KDEVICELISTMODEL_H 00021 #define KDEVICELISTMODEL_H 00022 00023 #include <kio/kio_export.h> 00024 00025 #include <QtCore/QAbstractItemModel> 00026 00027 #include <solid/device.h> 00028 #include <solid/predicate.h> 00029 00039 class KIO_EXPORT KDeviceListModel : public QAbstractItemModel 00040 { 00041 Q_OBJECT 00042 public: 00043 explicit KDeviceListModel(QObject *parent=0); 00044 explicit KDeviceListModel(const QString &predicate, QObject *parent=0); 00045 explicit KDeviceListModel(const Solid::Predicate &predicate, 00046 QObject *parent=0); 00047 ~KDeviceListModel(); 00048 00058 QVariant data(const QModelIndex &index, int role) const; 00059 00071 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 00072 00076 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; 00077 00078 QModelIndex rootIndex() const; 00079 00083 QModelIndex parent(const QModelIndex &child) const; 00084 00088 int rowCount(const QModelIndex &parent = QModelIndex()) const; 00089 00093 int columnCount(const QModelIndex &parent = QModelIndex()) const; 00094 00095 Solid::Device deviceForIndex( const QModelIndex& index ) const; 00096 00097 00098 Q_SIGNALS: 00099 void modelInitialized(); 00100 00101 private: 00102 Q_PRIVATE_SLOT(d, void _k_initDeviceList()) 00103 Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString &)) 00104 Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString &)) 00105 00106 class Private; 00107 Private * const d; 00108 }; 00109 00110 #endif
KDE 4.6 API Reference