From: Hannah von Reth Date: Fri, 18 Sep 2020 11:42:42 +0000 (+0200) Subject: Don't show 404 errors when manually creating folder sync pair. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~56 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=356192fb1dd7e310cc606532c45672d7adc63bd5;p=nextcloud-desktop.git Don't show 404 errors when manually creating folder sync pair. Fixes: #7724 --- diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index dc5b1f371..fd40ef611 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -108,7 +108,7 @@ bool FolderWizardLocalPath::isComplete() const _ui.warnLabel->setWordWrap(true); if (isOk) { _ui.warnLabel->hide(); - _ui.warnLabel->setText(QString()); + _ui.warnLabel->clear(); } else { _ui.warnLabel->show(); QString warnings = formatWarnings(warnStrings); @@ -228,8 +228,17 @@ void FolderWizardRemotePath::slotHandleMkdirNetworkError(QNetworkReply *reply) } } -void FolderWizardRemotePath::slotHandleLsColNetworkError(QNetworkReply * /*reply*/) +void FolderWizardRemotePath::slotHandleLsColNetworkError(QNetworkReply *reply) { + // Ignore 404s, otherwise users will get annoyed by error popups + // when not typing fast enough. It's still clear that a given path + // was not found, because the 'Next' button is disabled and no entry + // is selected in the tree view. + int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (httpCode == 404) { + showWarn(QString()); // hides the warning pane + return; + } auto job = qobject_cast(sender()); ASSERT(job); showWarn(tr("Failed to list a folder. Error: %1") @@ -389,7 +398,7 @@ void FolderWizardRemotePath::slotLsColFolderEntry() // because of extra logic in the typed-path case. disconnect(job, nullptr, this, nullptr); connect(job, &LsColJob::finishedWithError, - this, &FolderWizardRemotePath::slotTypedPathError); + this, &FolderWizardRemotePath::slotHandleLsColNetworkError); connect(job, &LsColJob::directoryListingSubfolders, this, &FolderWizardRemotePath::slotTypedPathFound); } @@ -400,21 +409,6 @@ void FolderWizardRemotePath::slotTypedPathFound(const QStringList &subpaths) selectByPath(_ui.folderEntry->text()); } -void FolderWizardRemotePath::slotTypedPathError(QNetworkReply *reply) -{ - // Ignore 404s, otherwise users will get annoyed by error popups - // when not typing fast enough. It's still clear that a given path - // was not found, because the 'Next' button is disabled and no entry - // is selected in the tree view. - int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if (httpCode == 404) { - showWarn(""); // hides the warning pane - return; - } - - slotHandleLsColNetworkError(reply); -} - LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) { auto *job = new LsColJob(_account, path, this); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index 0a9328b51..80cb2b8c1 100644 --- a/src/gui/folderwizard.h +++ b/src/gui/folderwizard.h @@ -102,7 +102,6 @@ protected slots: void slotFolderEntryEdited(const QString &text); void slotLsColFolderEntry(); void slotTypedPathFound(const QStringList &subpaths); - void slotTypedPathError(QNetworkReply *reply); private: LsColJob *runLsColJob(const QString &path);