OSDN Git Service

Changed creation of QFileSystemModel. Object will now be created when the user first...
[lamexp/LameXP.git] / src / Model_FileSystem.cpp
index e5e8a64..507967e 100644 (file)
@@ -153,6 +153,7 @@ QFileSystemModelEx::QFileSystemModelEx()
 
 QFileSystemModelEx::~QFileSystemModelEx()
 {
+       removeAllFromCache();
        LAMEXP_DELETE(m_myIconProvider);
 }
 
@@ -205,6 +206,11 @@ QModelIndex QFileSystemModelEx::index(const QString &path, int column) const
        return QModelIndex();
 }
 
+void QFileSystemModelEx::flushCache(void)
+{
+       removeAllFromCache();
+}
+
 /* ------------------------ */
 /*  STATIC FUNCTIONS BELOW  */
 /* ------------------------ */
@@ -236,6 +242,12 @@ void QFileSystemModelEx::removeFromCache(const QString &path)
        s_hasSubfolderCache.remove(path);
 }
 
+void QFileSystemModelEx::removeAllFromCache(void)
+{
+       QMutexLocker lock(&s_hasSubfolderMutex);
+       s_hasSubfolderCache.clear();
+}
+
 bool QFileSystemModelEx::hasSubfolders(const QString &path)
 {
        if(!FindFirstFileExInitialized)