diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-07 10:52:49 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-07 10:52:49 -0500 |
| commit | 41e6189be431dbd41b9d41751b01708df06a9610 (patch) | |
| tree | e6b759bc49ff156caba12654b2e76b44c26626da /src/filetreemodel.cpp | |
| parent | 49a1e234ef35e34f92c6be6c95cb88b8b498245f (diff) | |
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
Diffstat (limited to 'src/filetreemodel.cpp')
| -rw-r--r-- | src/filetreemodel.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
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(); } |
