Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-02-06 14:25:58 +0300
committerOlivier Goffart <ogoffart@woboq.com>2015-02-06 14:27:54 +0300
commit70c8803a79e9df0ea9adcc6d1016730cdf9bb09e (patch)
tree9778ccd8537dc049d4ff664301da984192041e76 /src/gui/selectivesyncdialog.cpp
parent0d2fb0754c178208d159be7fb77b491cc6a97fe9 (diff)
SelectiveSync: show a message in case of error or if there is no subfolder
Usefull when the folder does not exist (for example in case the theme has a defaultServerFolder that does not yet exist, #2788) But also to avoid confusion (issue #2663)
Diffstat (limited to 'src/gui/selectivesyncdialog.cpp')
-rw-r--r--src/gui/selectivesyncdialog.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp
index 243558a32..6652bbe16 100644
--- a/src/gui/selectivesyncdialog.cpp
+++ b/src/gui/selectivesyncdialog.cpp
@@ -58,6 +58,8 @@ void SelectiveSyncTreeView::refreshFolders()
LsColJob *job = new LsColJob(_account, _folderPath, this);
connect(job, SIGNAL(directoryListingSubfolders(QStringList)),
this, SLOT(slotUpdateDirectories(QStringList)));
+ connect(job, SIGNAL(finishedWithError(QNetworkReply*)),
+ this, SLOT(slotLscolFinishedWithError(QNetworkReply*)));
job->start();
clear();
_loading->show();
@@ -135,9 +137,16 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
QScopedValueRollback<bool> isInserting(_inserting);
_inserting = true;
- _loading->hide();
-
QTreeWidgetItem *root = topLevelItem(0);
+
+ if (!root && list.size() <= 1) {
+ _loading->setText(tr("No subfolders currently on the server."));
+ _loading->resize(_loading->sizeHint()); // because it's not in a layout
+ return;
+ } else {
+ _loading->hide();
+ }
+
if (!root) {
root = new QTreeWidgetItem(this);
root->setText(0, _rootName);
@@ -175,6 +184,16 @@ void SelectiveSyncTreeView::slotUpdateDirectories(const QStringList&list)
root->setExpanded(true);
}
+void SelectiveSyncTreeView::slotLscolFinishedWithError(QNetworkReply *r)
+{
+ if (r->error() == QNetworkReply::ContentNotFoundError) {
+ _loading->setText(tr("No subfolders currently on the server."));
+ } else {
+ _loading->setText(tr("An error occured while loading the list of sub folders."));
+ }
+ _loading->resize(_loading->sizeHint()); // because it's not in a layout
+}
+
void SelectiveSyncTreeView::slotItemExpanded(QTreeWidgetItem *item)
{
QString dir = item->data(0, Qt::UserRole).toString();