[Pkg-owncloud-commits] [owncloud-client] 57/84: Selective Sync: Fix request loop and show error in view (#5154)
Sandro Knauß
hefee at moszumanska.debian.org
Fri Oct 21 22:51:54 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee pushed a commit to branch master
in repository owncloud-client.
commit 3cdcd8dea0cc5eaf62f474b51529a9ec5cf7a136
Author: Markus Goetz <markus at woboq.com>
Date: Tue Sep 6 11:11:03 2016 +0200
Selective Sync: Fix request loop and show error in view (#5154)
I got into a situation where the model would endlessly request the directory
contents from the server because we did not notice yet that the server
is actually in maintenance mode while we were expanding the tree view when
changing the tab to the account or when just expanding it by clicking.
(cherry picked from commit 524220d0907713408298a36df18bd04635ce5563)
---
src/gui/folderstatusmodel.cpp | 11 ++++++++++-
src/gui/folderstatusmodel.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 746708b..6fab109 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -164,7 +164,8 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
switch(role) {
case Qt::DisplayRole:
if (x->_hasError) {
- return tr("Error while loading the list of folders from the server.");
+ return QVariant(tr("Error while loading the list of folders from the server.")
+ + QString("\n") + x->_lastErrorString);
} else {
return tr("Fetching folder list from server...");
}
@@ -498,6 +499,10 @@ bool FolderStatusModel::canFetchMore(const QModelIndex& parent) const
auto info = infoForIndex(parent);
if (!info || info->_fetched || info->_fetching)
return false;
+ if (info->_hasError) {
+ // Keep showing the error to the user, it will be hidden when the account reconnects
+ return false;
+ }
return true;
}
@@ -548,6 +553,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
if (parentInfo->hasLabel()) {
beginRemoveRows(idx, 0 ,0);
+ parentInfo->_lastErrorString.clear();
parentInfo->_hasError = false;
parentInfo->_fetchingLabel = false;
endRemoveRows();
@@ -675,6 +681,9 @@ void FolderStatusModel::slotLscolFinishedWithError(QNetworkReply* r)
}
auto parentInfo = infoForIndex(idx);
if (parentInfo) {
+ qDebug() << r->errorString();
+ parentInfo->_lastErrorString = r->errorString();
+
if (r->error() == QNetworkReply::ContentNotFoundError) {
parentInfo->_fetched = true;
} else {
diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h
index f12de02..312e978 100644
--- a/src/gui/folderstatusmodel.h
+++ b/src/gui/folderstatusmodel.h
@@ -63,6 +63,7 @@ public:
bool _fetched; // If we did the LSCOL for this folder already
bool _fetching; // Whether a LSCOL job is currently running
bool _hasError; // If the last fetching job ended in an error
+ QString _lastErrorString;
bool _fetchingLabel; // Whether a 'fetching in progress' label is shown.
bool _isUndecided; // undecided folders are the big folders that the user has not accepted yet
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list