From 41e6189be431dbd41b9d41751b01708df06a9610 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 7 Feb 2020 10:52:49 -0500 Subject: disconnect any proxies when fully loading disable model when resetting, enable it back after the directory refresh so the tree doesn't appear in a weird state in between --- src/filetreemodel.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/filetreemodel.cpp') diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp index 912e2007..169d0a02 100644 --- a/src/filetreemodel.cpp +++ b/src/filetreemodel.cpp @@ -137,7 +137,7 @@ void* makeInternalPointer(FileTreeItem* item) FileTreeModel::FileTreeModel(OrganizerCore& core, QObject* parent) : - QAbstractItemModel(parent), m_core(core), + QAbstractItemModel(parent), m_core(core), m_enabled(true), m_root(FileTreeItem::createDirectory(nullptr, L"", L"")), m_flags(NoFlags), m_fullyLoaded(false) { @@ -183,6 +183,16 @@ void FileTreeModel::ensureFullyLoaded() } } +bool FileTreeModel::enabled() const +{ + return m_enabled; +} + +void FileTreeModel::setEnabled(bool b) +{ + m_enabled = b; +} + bool FileTreeModel::showArchives() const { return (m_flags.testFlag(Archives) && m_core.getArchiveParsing()); @@ -243,6 +253,10 @@ bool FileTreeModel::hasChildren(const QModelIndex& parent) const bool FileTreeModel::canFetchMore(const QModelIndex& parent) const { + if (!m_enabled) { + return false; + } + if (auto* item=itemFromIndex(parent)) { return !item->isLoaded(); } -- cgit v1.3.1