aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/folderlistmodel
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-07-22 17:25:01 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-23 08:36:26 +0200
commitcf62652614676f58f9c45102a67a497c81805a36 (patch)
treebabef8e5c5049e0a71e88b7eab2928e46736f650 /src/imports/folderlistmodel
parent0181dc283f6a783783b7e622b4e2dc241edd8a54 (diff)
FolderListModel provides file URLs and the QML FileDialog uses them
This saves a conversion step in the FileDialog and rounds out the FolderListModel API. Task-number: QTBUG-32039 Change-Id: I63bc54cb91673aafba08d0d9f132073c129f0c18 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp5
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 4dbbcf359d..016c96e0bf 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -325,6 +325,7 @@ QQuickFolderListModel::QQuickFolderListModel(QObject *parent)
d->roleNames[FileLastModifiedRole] = "fileModified";
d->roleNames[FileLastReadRole] = "fileAccessed";
d->roleNames[FileIsDirRole] = "fileIsDir";
+ d->roleNames[FileUrlRole] = "fileURL";
d->init();
}
@@ -366,6 +367,9 @@ QVariant QQuickFolderListModel::data(const QModelIndex &index, int role) const
case FileIsDirRole:
rv = d->data.at(index.row()).isDir();
break;
+ case FileUrlRole:
+ rv = QUrl::fromLocalFile(d->data.at(index.row()).filePath());
+ break;
default:
break;
}
@@ -753,6 +757,7 @@ void QQuickFolderListModel::setShowOnlyReadable(bool on)
\list
\li \c fileName
\li \c filePath
+ \li \c fileURL
\li \c fileBaseName
\li \c fileSuffix
\li \c fileSize
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h
index 43af77adf5..68541f1735 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.h
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h
@@ -90,7 +90,8 @@ public:
FileSizeRole = Qt::UserRole + 5,
FileLastModifiedRole = Qt::UserRole + 6,
FileLastReadRole = Qt::UserRole +7,
- FileIsDirRole = Qt::UserRole + 8
+ FileIsDirRole = Qt::UserRole + 8,
+ FileUrlRole = Qt::UserRole + 9
};
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;