diff options
| author | Kevin Ottens <[email protected]> | 2007-04-02 17:31:38 +0000 |
|---|---|---|
| committer | Kevin Ottens <[email protected]> | 2007-04-02 17:31:38 +0000 |
| commit | c2c6f743a58c90d9d0f5e46eadee296e9b7b492c (patch) | |
| tree | 0575194b0089d219af7e02fdee71cd507a3c3be3 /src | |
| parent | cebf9958fdf31c4adcea289bfff832338c12fff3 (diff) | |
Add some conveniences.
svn path=/trunk/KDE/kdebase/apps/; revision=649451
Diffstat (limited to 'src')
| -rw-r--r-- | src/kfileplacesmodel.cpp | 10 | ||||
| -rw-r--r-- | src/kfileplacesmodel.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/kfileplacesmodel.cpp b/src/kfileplacesmodel.cpp index cdbfee244..273830b3e 100644 --- a/src/kfileplacesmodel.cpp +++ b/src/kfileplacesmodel.cpp @@ -89,6 +89,16 @@ bool KFilePlacesModel::mountNeeded(const QModelIndex &index) const return data(index, MountNeededRole).toBool(); } +KIcon KFilePlacesModel::icon(const QModelIndex &index) const +{ + return KIcon(data(index, Qt::DecorationRole).value<QIcon>()); +} + +QString KFilePlacesModel::text(const QModelIndex &index) const +{ + return data(index, Qt::DisplayRole).toString(); +} + QVariant KFilePlacesModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) diff --git a/src/kfileplacesmodel.h b/src/kfileplacesmodel.h index 7c77db679..fb3803ba6 100644 --- a/src/kfileplacesmodel.h +++ b/src/kfileplacesmodel.h @@ -23,6 +23,7 @@ #include <QAbstractItemModel> #include <kurl.h> +#include <kicon.h> /** * This class is a list view model. Each entry represents a "place" @@ -44,6 +45,8 @@ public: KUrl url(const QModelIndex &index) const; bool mountNeeded(const QModelIndex &index) const; + KIcon icon(const QModelIndex &index) const; + QString text(const QModelIndex &index) const; /** * @brief Get a visible data based on Qt role for the given index. |
