KFile
kfileplacesmodel.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2007 Kevin Ottens <ervin@kde.org> 00003 Copyright (C) 2007 David Faure <faure@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 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 FixedDeviceRole = 0x332896C1, 00049 CapacityBarRecommendedRole = 0x1548C5C4 00050 }; 00051 00052 KFilePlacesModel(QObject *parent=0); 00053 ~KFilePlacesModel(); 00054 00055 KUrl url(const QModelIndex &index) const; 00056 bool setupNeeded(const QModelIndex &index) const; 00057 KIcon icon(const QModelIndex &index) const; 00058 QString text(const QModelIndex &index) const; 00059 bool isHidden(const QModelIndex &index) const; 00060 bool isDevice(const QModelIndex &index) const; 00061 Solid::Device deviceForIndex(const QModelIndex &index) const; 00062 KBookmark bookmarkForIndex(const QModelIndex &index) const; 00063 00064 QAction *teardownActionForIndex(const QModelIndex &index) const; 00065 QAction *ejectActionForIndex(const QModelIndex &index) const; 00066 void requestTeardown(const QModelIndex &index); 00067 void requestEject(const QModelIndex &index); 00068 void requestSetup(const QModelIndex &index); 00069 00070 void addPlace(const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString()); 00071 void addPlace(const QString &text, const KUrl &url, const QString &iconName, const QString &appName, const QModelIndex &after); 00072 void editPlace(const QModelIndex &index, const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString()); 00073 void removePlace(const QModelIndex &index) const; 00074 void setPlaceHidden(const QModelIndex &index, bool hidden); 00075 00076 int hiddenCount() const; 00077 00087 QVariant data(const QModelIndex &index, int role) const; 00088 00092 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; 00093 00097 QModelIndex parent(const QModelIndex &child) const; 00098 00102 int rowCount(const QModelIndex &parent = QModelIndex()) const; 00103 00107 int columnCount(const QModelIndex &parent = QModelIndex()) const; 00108 00123 QModelIndex closestItem(const KUrl &url) const; 00124 00125 00126 Qt::DropActions supportedDropActions() const; 00127 Qt::ItemFlags flags(const QModelIndex &index) const; 00128 QStringList mimeTypes() const; 00129 QMimeData *mimeData(const QModelIndexList &indexes) const; 00130 bool dropMimeData(const QMimeData *data, Qt::DropAction action, 00131 int row, int column, const QModelIndex &parent); 00132 00133 Q_SIGNALS: 00134 void errorMessage(const QString &message); 00135 void setupDone(const QModelIndex &index, bool success); 00136 00137 private: 00138 Q_PRIVATE_SLOT(d, void _k_initDeviceList()) 00139 Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString&)) 00140 Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString&)) 00141 Q_PRIVATE_SLOT(d, void _k_itemChanged(const QString&)) 00142 Q_PRIVATE_SLOT(d, void _k_reloadBookmarks()) 00143 Q_PRIVATE_SLOT(d, void _k_storageSetupDone(Solid::ErrorType, QVariant)) 00144 Q_PRIVATE_SLOT(d, void _k_storageTeardownDone(Solid::ErrorType, QVariant)) 00145 00146 class Private; 00147 Private * const d; 00148 friend class Private; 00149 }; 00150 00151 #endif
KDE 4.6 API Reference