Folder Model: don't try to fetch data if the account is disconnected
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 16:32:34 +0000 (18:32 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 16:32:34 +0000 (18:32 +0200)
Now that it expands automatically, it would do lots of query to the
server when the account is disconnected. (all resulting in 401)

src/gui/folderstatusmodel.cpp

index 5cfa63683cfbe90c19883cd40cdabd12501bc9af..d0e4905ebb9811555ccb6d68b47f403287a3d957 100644 (file)
@@ -466,6 +466,9 @@ bool FolderStatusModel::hasChildren(const QModelIndex& parent) const
 
 bool FolderStatusModel::canFetchMore(const QModelIndex& parent) const
 {
+    if (_accountState->state() != AccountState::Connected) {
+        return false;
+    }
     auto info = infoForIndex(parent);
     if (!info || info->_fetched || info->_fetching)
         return false;