From 253e9257e1f586d1c1dfa585aa6f862d310cdec3 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 12 Aug 2014 14:46:05 +0200 Subject: Introspect qrc files in FolderListModel. And don't use "file watchers" for resource file paths, otherwise it generates the following warning: QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory Change-Id: I6b75c9195fb2b2ba7b3e0bb7d146fc5cd343927e Task-number: QTBUG-40307 Reviewed-by: Shawn Rutledge --- src/imports/folderlistmodel/fileinfothread.cpp | 6 ++++-- src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/imports') diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index f7587c25f5..2d53b211ad 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -92,7 +92,8 @@ void FileInfoThread::removePath(const QString &path) { QMutexLocker locker(&mutex); #ifndef QT_NO_FILESYSTEMWATCHER - watcher->removePath(path); + if (!path.startsWith(QLatin1Char(':'))) + watcher->removePath(path); #endif currentPath.clear(); } @@ -103,7 +104,8 @@ void FileInfoThread::setPath(const QString &path) QMutexLocker locker(&mutex); #ifndef QT_NO_FILESYSTEMWATCHER - watcher->addPath(path); + if (!path.startsWith(QLatin1Char(':'))) + watcher->addPath(path); #endif currentPath = path; needUpdate = true; diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 5d84d7e5ba..5fc9d98d36 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -536,8 +536,8 @@ void QQuickFolderListModel::classBegin() void QQuickFolderListModel::componentComplete() { Q_D(QQuickFolderListModel); - - if (!d->currentDir.isValid() || !d->currentDir.isLocalFile() || !QDir().exists(d->currentDir.toLocalFile())) + QString localPath = QQmlFile::urlToLocalFileOrQrc(d->currentDir); + if (localPath.isEmpty() || !QDir(localPath).exists()) setFolder(QUrl::fromLocalFile(QDir::currentPath())); } -- cgit v1.2.3