• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KFile

  • sources
  • kde-4.14
  • kdelibs
  • kfile
kfileplacesmodel.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2007 Kevin Ottens <ervin@kde.org>
3  Copyright (C) 2007 David Faure <faure@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 
19 */
20 #ifndef KFILEPLACESMODEL_H
21 #define KFILEPLACESMODEL_H
22 
23 #include <kfile_export.h>
24 
25 #include <QtCore/QAbstractItemModel>
26 #include <kurl.h>
27 #include <kbookmark.h>
28 #include <kicon.h>
29 
30 #include <solid/device.h>
31 
32 class QMimeData;
33 class QAction;
34 
40 class KFILE_EXPORT KFilePlacesModel : public QAbstractItemModel
41 {
42  Q_OBJECT
43 public:
44  enum AdditionalRoles {
45  UrlRole = 0x069CD12B,
46  HiddenRole = 0x0741CAAC,
47  SetupNeededRole = 0x059A935D,
48  FixedDeviceRole = 0x332896C1,
49  CapacityBarRecommendedRole = 0x1548C5C4
50  };
51 
52  KFilePlacesModel(QObject *parent=0);
53  ~KFilePlacesModel();
54 
55  KUrl url(const QModelIndex &index) const;
56  bool setupNeeded(const QModelIndex &index) const;
57  KIcon icon(const QModelIndex &index) const;
58  QString text(const QModelIndex &index) const;
59  bool isHidden(const QModelIndex &index) const;
60  bool isDevice(const QModelIndex &index) const;
61  Solid::Device deviceForIndex(const QModelIndex &index) const;
62  KBookmark bookmarkForIndex(const QModelIndex &index) const;
63 
64  QAction *teardownActionForIndex(const QModelIndex &index) const;
65  QAction *ejectActionForIndex(const QModelIndex &index) const;
66  void requestTeardown(const QModelIndex &index);
67  void requestEject(const QModelIndex &index);
68  void requestSetup(const QModelIndex &index);
69 
70  void addPlace(const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
71  void addPlace(const QString &text, const KUrl &url, const QString &iconName, const QString &appName, const QModelIndex &after);
72  void editPlace(const QModelIndex &index, const QString &text, const KUrl &url, const QString &iconName = QString(), const QString &appName = QString());
73  void removePlace(const QModelIndex &index) const;
74  void setPlaceHidden(const QModelIndex &index, bool hidden);
75 
76  int hiddenCount() const;
77 
87  QVariant data(const QModelIndex &index, int role) const;
88 
92  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
93 
97  QModelIndex parent(const QModelIndex &child) const;
98 
102  int rowCount(const QModelIndex &parent = QModelIndex()) const;
103 
107  int columnCount(const QModelIndex &parent = QModelIndex()) const;
108 
123  QModelIndex closestItem(const KUrl &url) const;
124 
125 
126  Qt::DropActions supportedDropActions() const;
127  Qt::ItemFlags flags(const QModelIndex &index) const;
128  QStringList mimeTypes() const;
129  QMimeData *mimeData(const QModelIndexList &indexes) const;
130  bool dropMimeData(const QMimeData *data, Qt::DropAction action,
131  int row, int column, const QModelIndex &parent);
132 
133 Q_SIGNALS:
134  void errorMessage(const QString &message);
135  void setupDone(const QModelIndex &index, bool success);
136 
137 private:
138  Q_PRIVATE_SLOT(d, void _k_initDeviceList())
139  Q_PRIVATE_SLOT(d, void _k_deviceAdded(const QString&))
140  Q_PRIVATE_SLOT(d, void _k_deviceRemoved(const QString&))
141  Q_PRIVATE_SLOT(d, void _k_itemChanged(const QString&))
142  Q_PRIVATE_SLOT(d, void _k_reloadBookmarks())
143  Q_PRIVATE_SLOT(d, void _k_storageSetupDone(Solid::ErrorType, QVariant))
144  Q_PRIVATE_SLOT(d, void _k_storageTeardownDone(Solid::ErrorType, QVariant))
145 
146  class Private;
147  Private * const d;
148  friend class Private;
149 };
150 
151 #endif
QModelIndex
QAbstractItemModel::rowCount
virtual int rowCount(const QModelIndex &parent) const =0
QAbstractItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
kurl.h
Solid::Device
KBookmark
QAbstractItemModel::dropMimeData
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
QMimeData
QAbstractItemModel::mimeTypes
virtual QStringList mimeTypes() const
KUrl
ErrorType
ErrorType
KFilePlacesModel::AdditionalRoles
AdditionalRoles
Definition: kfileplacesmodel.h:44
QObject
KIcon
QAbstractItemModel::supportedDropActions
virtual Qt::DropActions supportedDropActions() const
QAbstractItemModel::data
virtual QVariant data(const QModelIndex &index, int role) const =0
QString
QAbstractItemModel::mimeData
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
QStringList
kbookmark.h
Qt::DropActions
typedef DropActions
QAction
QAbstractItemModel::columnCount
virtual int columnCount(const QModelIndex &parent) const =0
QAbstractItemModel
QAbstractItemModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
device.h
kicon.h
QObject::parent
QObject * parent() const
kfile_export.h
QVariant
Qt::ItemFlags
typedef ItemFlags
KFilePlacesModel
This class is a list view model.
Definition: kfileplacesmodel.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:27:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KFile

Skip menu "KFile"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal