diff options
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread.cpp | 14 | ||||
-rw-r--r-- | src/imports/folderlistmodel/fileinfothread_p.h | 2 | ||||
-rw-r--r-- | src/imports/folderlistmodel/plugin.cpp | 1 | ||||
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 27 | ||||
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.h | 3 |
5 files changed, 44 insertions, 3 deletions
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index ebdfba42a8..731eb45460 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -52,7 +52,8 @@ FileInfoThread::FileInfoThread(QObject *parent) showDirsFirst(false), showDotAndDotDot(false), showHidden(false), - showOnlyReadable(false) + showOnlyReadable(false), + caseSensitive(true) { #ifndef QT_NO_FILESYSTEMWATCHER watcher = new QFileSystemWatcher(this); @@ -190,6 +191,14 @@ void FileInfoThread::setShowOnlyReadable(bool on) condition.wakeAll(); } +void FileInfoThread::setCaseSensitive(bool on) +{ + QMutexLocker locker(&mutex); + caseSensitive = on; + folderUpdate = true; + condition.wakeAll(); +} + #ifndef QT_NO_FILESYSTEMWATCHER void FileInfoThread::updateFile(const QString &path) { @@ -228,7 +237,8 @@ void FileInfoThread::run() void FileInfoThread::getFileInfos(const QString &path) { QDir::Filters filter; - filter = QDir::CaseSensitive; + if (caseSensitive) + filter = QDir::CaseSensitive; if (showFiles) filter = filter | QDir::Files; if (showDirs) diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h index ee325fa50b..6a3e71b81c 100644 --- a/src/imports/folderlistmodel/fileinfothread_p.h +++ b/src/imports/folderlistmodel/fileinfothread_p.h @@ -68,6 +68,7 @@ public: void setShowDotAndDotDot(bool on); void setShowHidden(bool on); void setShowOnlyReadable(bool on); + void setCaseSensitive(bool on); public Q_SLOTS: #ifndef QT_NO_FILESYSTEMWATCHER @@ -102,6 +103,7 @@ private: bool showDotAndDotDot; bool showHidden; bool showOnlyReadable; + bool caseSensitive; }; #endif // FILEINFOTHREAD_P_H diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index a2536bdc7d..7280fcd1dc 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -52,6 +52,7 @@ public: qmlRegisterType<QQuickFolderListModel>(uri,1,0,"FolderListModel"); qmlRegisterType<QQuickFolderListModel>(uri,2,0,"FolderListModel"); qmlRegisterType<QQuickFolderListModel,1>(uri,2,1,"FolderListModel"); + qmlRegisterType<QQuickFolderListModel,2>(uri,2,2,"FolderListModel"); #endif } }; diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 0f4a5bda54..6c9b3eaf98 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -49,7 +49,7 @@ public: : q_ptr(q), sortField(QQuickFolderListModel::Name), sortReversed(false), showFiles(true), showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false), - showHidden(false) + showHidden(false), caseSensitive(true) { nameFilters << QLatin1String("*"); } @@ -70,6 +70,7 @@ public: bool showDotAndDotDot; bool showOnlyReadable; bool showHidden; + bool caseSensitive; ~QQuickFolderListModelPrivate() {} void init(); @@ -762,6 +763,30 @@ void QQuickFolderListModel::setShowOnlyReadable(bool on) } /*! + * \qmlproperty bool FolderListModel::caseSensitive + * \since 5.7 + * + * Use case sensitive pattern matching. + * + * By default, this property is true. + * + */ +bool QQuickFolderListModel::caseSensitive() const +{ + Q_D(const QQuickFolderListModel); + return d->caseSensitive; +} + +void QQuickFolderListModel::setCaseSensitive(bool on) +{ + Q_D(QQuickFolderListModel); + + if (on != d->caseSensitive) { + d->fileInfoThread.setCaseSensitive(on); + } +} + +/*! \qmlmethod var FolderListModel::get(int index, string property) Get the folder property for the given index. The following properties diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h index fcfec56c87..4b540742b4 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.h +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h @@ -67,6 +67,7 @@ class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot) Q_PROPERTY(bool showHidden READ showHidden WRITE setShowHidden REVISION 1) Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable) + Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION 2) Q_PROPERTY(int count READ count NOTIFY countChanged) //![class props] @@ -128,6 +129,8 @@ public: void setShowHidden(bool on); bool showOnlyReadable() const; void setShowOnlyReadable(bool on); + bool caseSensitive() const; + void setCaseSensitive(bool on); //![prop funcs] Q_INVOKABLE bool isFolder(int index) const; |