aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/folderlistmodel
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-06-24 11:26:22 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-06-24 11:48:46 +0200
commit1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch)
treeb2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/imports/folderlistmodel
parent8217ec1b888f3ff93f004801b018c5f85362c484 (diff)
parente1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff)
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp13
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h4
-rw-r--r--src/imports/folderlistmodel/plugins.qmltypes8
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp32
4 files changed, 42 insertions, 15 deletions
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index 64a4b02e91..ad09f54381 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -57,7 +57,7 @@ FileInfoThread::FileInfoThread(QObject *parent)
sortUpdate(false),
showDirs(true),
showDirsFirst(false),
- showDotDot(false),
+ showDotAndDotDot(false),
showOnlyReadable(false)
{
#ifndef QT_NO_FILESYSTEMWATCHER
@@ -158,11 +158,12 @@ void FileInfoThread::setShowDirsFirst(bool show)
condition.wakeAll();
}
-void FileInfoThread::setShowDotDot(bool on)
+void FileInfoThread::setShowDotAndDotDot(bool on)
{
QMutexLocker locker(&mutex);
- showDotDot = on;
+ showDotAndDotDot = on;
folderUpdate = true;
+ needUpdate = true;
condition.wakeAll();
}
@@ -212,10 +213,12 @@ void FileInfoThread::run()
void FileInfoThread::getFileInfos(const QString &path)
{
QDir::Filters filter;
- filter = QDir::Files | QDir::NoDot | QDir::CaseSensitive;
+ filter = QDir::Files | QDir::CaseSensitive;
if (showDirs)
filter = filter | QDir::AllDirs | QDir::Drives;
- if ((path == rootPath) || !showDotDot)
+ if (!showDotAndDotDot)
+ filter = filter | QDir::NoDot | QDir::NoDotDot;
+ else if (path == rootPath)
filter = filter | QDir::NoDotDot;
if (showOnlyReadable)
filter = filter | QDir::Readable;
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index f9340ca75d..cf6572a279 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -72,7 +72,7 @@ public:
void setNameFilters(const QStringList & nameFilters);
void setShowDirs(bool showFolders);
void setShowDirsFirst(bool show);
- void setShowDotDot(bool on);
+ void setShowDotAndDotDot(bool on);
void setShowOnlyReadable(bool on);
public Q_SLOTS:
@@ -104,7 +104,7 @@ private:
bool sortUpdate;
bool showDirs;
bool showDirsFirst;
- bool showDotDot;
+ bool showDotAndDotDot;
bool showOnlyReadable;
};
diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes
index fabeb9e4b1..20914f4108 100644
--- a/src/imports/folderlistmodel/plugins.qmltypes
+++ b/src/imports/folderlistmodel/plugins.qmltypes
@@ -3,13 +3,17 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
-// This file was auto-generated with the command 'qmlplugindump Qt.labs.folderlistmodel 2.0'.
+// This file was auto-generated with the command 'qmlplugindump -notrelocatable Qt.labs.folderlistmodel 2.0'.
Module {
Component {
name: "QQuickFolderListModel"
prototype: "QAbstractListModel"
- exports: ["FolderListModel 1.0", "FolderListModel 2.0"]
+ exports: [
+ "Qt.labs.folderlistmodel/FolderListModel 1.0",
+ "Qt.labs.folderlistmodel/FolderListModel 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
Enum {
name: "SortField"
values: {
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 421e215066..85b59e9c73 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -55,7 +55,7 @@ class QQuickFolderListModelPrivate
public:
QQuickFolderListModelPrivate(QQuickFolderListModel *q)
: q_ptr(q),
- sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDots(false), showOnlyReadable(false)
+ sortField(QQuickFolderListModel::Name), sortReversed(false), showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false)
{
nameFilters << QLatin1String("*");
}
@@ -72,7 +72,7 @@ public:
bool sortReversed;
bool showDirs;
bool showDirsFirst;
- bool showDots;
+ bool showDotAndDotDot;
bool showOnlyReadable;
~QQuickFolderListModelPrivate() {}
@@ -279,7 +279,27 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
The following example shows a FolderListModel being used to provide a list
of QML files in a \l ListView:
- \snippet qml/folderlistmodel.qml 0
+ \qml
+ import QtQuick 2.0
+ import Qt.labs.folderlistmodel 1.0
+
+ ListView {
+ width: 200; height: 400
+
+ FolderListModel {
+ id: folderModel
+ nameFilters: ["*.qml"]
+ }
+
+ Component {
+ id: fileDelegate
+ Text { text: fileName }
+ }
+
+ model: folderModel
+ delegate: fileDelegate
+ }
+ \endqml
\section1 Path Separators
@@ -661,15 +681,15 @@ void QQuickFolderListModel::setShowDirsFirst(bool on)
bool QQuickFolderListModel::showDotAndDotDot() const
{
Q_D(const QQuickFolderListModel);
- return d->showDots;
+ return d->showDotAndDotDot;
}
void QQuickFolderListModel::setShowDotAndDotDot(bool on)
{
Q_D(QQuickFolderListModel);
- if (on != d->showDots) {
- d->fileInfoThread.setShowDotDot(on);
+ if (on != d->showDotAndDotDot) {
+ d->fileInfoThread.setShowDotAndDotDot(on);
}
}