]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add some conveniences.
authorKevin Ottens <ervin@kde.org>
Mon, 2 Apr 2007 17:31:38 +0000 (17:31 +0000)
committerKevin Ottens <ervin@kde.org>
Mon, 2 Apr 2007 17:31:38 +0000 (17:31 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=649451

src/kfileplacesmodel.cpp
src/kfileplacesmodel.h

index cdbfee244743a496d67d1712ede56279ce54222a..273830b3ebc4f64004021ef7f2014cbd21d2c7d6 100644 (file)
@@ -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())
index 7c77db67951112124582420046d86b08f3457e02..fb3803ba68a7b676de7ac553a47aa7e5005ef0dc 100644 (file)
@@ -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.