mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 14:36:01 +03:00
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)
This commit is contained in:
parent
0d2fb0754c
commit
70c8803a79
2 changed files with 23 additions and 2 deletions
|
@ -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();
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
class QTreeWidgetItem;
|
||||
class QTreeWidget;
|
||||
class QNetworkReply;
|
||||
class QLabel;
|
||||
namespace OCC {
|
||||
|
||||
|
@ -45,6 +46,7 @@ private slots:
|
|||
void slotUpdateDirectories(const QStringList &);
|
||||
void slotItemExpanded(QTreeWidgetItem *);
|
||||
void slotItemChanged(QTreeWidgetItem*,int);
|
||||
void slotLscolFinishedWithError(QNetworkReply*);
|
||||
private:
|
||||
void recursiveInsert(QTreeWidgetItem* parent, QStringList pathTrail, QString path, qint64 size);
|
||||
QString _folderPath;
|
||||
|
|
Loading…
Reference in a new issue