From: Kevin Ottens Date: Mon, 2 Apr 2007 17:31:38 +0000 (+0000) Subject: Add some conveniences. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/c2c6f743a58c90d9d0f5e46eadee296e9b7b492c?ds=inline Add some conveniences. svn path=/trunk/KDE/kdebase/apps/; revision=649451 --- 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()); +} + +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 #include +#include /** * 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.