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 void requestTeardown(const QModelIndex &index);
00064 void requestSetup(const QModelIndex &index);
00065
00066 void addPlace(const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
00067 void editPlace(const QModelIndex &index, const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
00068 void removePlace(const QModelIndex &index) const;
00069 void setPlaceHidden(const QModelIndex &index, bool hidden);
00070
00071 int hiddenCount() const;
00072
00082 QVariant data(const QModelIndex &index, int role) const;
00083
00087 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
00088
00092 QModelIndex parent(const QModelIndex &child) const;
00093
00097 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00098
00102 int columnCount(const QModelIndex &parent = QModelIndex()) const;
00103
00118 QModelIndex closestItem(const KUrl &url) const;
00119
00120
00121 Qt::DropActions supportedDropActions() const;
00122 Qt::ItemFlags flags(const QModelIndex &index) const;
00123 QStringList mimeTypes() const;
00124 QMimeData *mimeData(const QModelIndexList &indexes) const;
00125 bool dropMimeData(const QMimeData *data, Qt::DropAction action,
00126 int row, int column, const QModelIndex &parent);
00127
00128 Q_SIGNALS:
00129 void errorMessage(const QString &message);
00130 void setupDone(const QModelIndex &index, bool success);
00131
00132 private:
00133 Q_PRIVATE_SLOT(d, void _k_initDeviceList())
00134 Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString&))
00135 Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString&))
00136 Q_PRIVATE_SLOT(d, void _k_itemChanged(const QString&))
00137 Q_PRIVATE_SLOT(d, void _k_reloadBookmarks())
00138 Q_PRIVATE_SLOT(d, void _k_storageSetupDone(Solid::ErrorType, QVariant))
00139 Q_PRIVATE_SLOT(d, void _k_storageTeardownDone(Solid::ErrorType, QVariant))
00140
00141 class Private;
00142 Private * const d;
00143 friend class Private;
00144 };
00145
00146 #endif