KFile
kfileplacesmodel.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 KFILEPLACESMODEL_H
00021 #define KFILEPLACESMODEL_H
00022
00023 #include <kfile_export.h>
00024
00025 #include <QtCore/QAbstractItemModel>
00026 #include <kurl.h>
00027 #include <kbookmark.h>
00028 #include <kicon.h>
00029
00030 #include <solid/device.h>
00031
00032 class QMimeData;
00033 class QAction;
00034
00040 class KFILE_EXPORT KFilePlacesModel : public QAbstractItemModel
00041 {
00042 Q_OBJECT
00043 public:
00044 enum AdditionalRoles {
00045 UrlRole = 0x069CD12B,
00046 HiddenRole = 0x0741CAAC,
00047 SetupNeededRole = 0x059A935D
00048 };
00049
00050 KFilePlacesModel(QObject *parent=0);
00051 ~KFilePlacesModel();
00052
00053 KUrl url(const QModelIndex &index) const;
00054 bool setupNeeded(const QModelIndex &index) const;
00055 KIcon icon(const QModelIndex &index) const;
00056 QString text(const QModelIndex &index) const;
00057 bool isHidden(const QModelIndex &index) const;
00058 bool isDevice(const QModelIndex &index) const;
00059 Solid::Device deviceForIndex(const QModelIndex &index) const;
00060 KBookmark bookmarkForIndex(const QModelIndex &index) const;
00061
00062 QAction *teardownActionForIndex(const QModelIndex &index) const;
00063 QAction *ejectActionForIndex(const QModelIndex &index) const;
00064 void requestTeardown(const QModelIndex &index);
00065 void requestEject(const QModelIndex &index);
00066 void requestSetup(const QModelIndex &index);
00067
00068 void addPlace(const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
00069 void editPlace(const QModelIndex &index, const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
00070 void removePlace(const QModelIndex &index) const;
00071 void setPlaceHidden(const QModelIndex &index, bool hidden);
00072
00073 int hiddenCount() const;
00074
00084 QVariant data(const QModelIndex &index, int role) const;
00085
00089 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
00090
00094 QModelIndex parent(const QModelIndex &child) const;
00095
00099 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00100
00104 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00105
00120 QModelIndex closestItem(const KUrl &url) const;
00121
00122
00123 Qt::DropActions supportedDropActions() const;
00124 Qt::ItemFlags flags(const QModelIndex &index) const;
00125 QStringList mimeTypes() const;
00126 QMimeData *mimeData(const QModelIndexList &indexes) const;
00127 bool dropMimeData(const QMimeData *data, Qt::DropAction action,
00128 int row, int column, const QModelIndex &parent);
00129
00130 Q_SIGNALS:
00131 void errorMessage(const QString &message);
00132 void setupDone(const QModelIndex &index, bool success);
00133
00134 private:
00135 Q_PRIVATE_SLOT(d, void _k_initDeviceList())
00136 Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString&))
00137 Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString&))
00138 Q_PRIVATE_SLOT(d, void _k_itemChanged(const QString&))
00139 Q_PRIVATE_SLOT(d, void _k_reloadBookmarks())
00140 Q_PRIVATE_SLOT(d, void _k_storageSetupDone(Solid::ErrorType, QVariant))
00141 Q_PRIVATE_SLOT(d, void _k_storageTeardownDone(Solid::ErrorType, QVariant))
00142
00143 class Private;
00144 Private * const d;
00145 friend class Private;
00146 };
00147
00148 #endif