Don't show 404 errors when manually creating folder sync pair.
authorHannah von Reth <hannah.vonreth@owncloud.com>
Fri, 18 Sep 2020 11:42:42 +0000 (13:42 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:20 +0000 (10:59 +0100)
Fixes: #7724
src/gui/folderwizard.cpp
src/gui/folderwizard.h

index dc5b1f371e7e643819f81fb8d4a88691c465396b..fd40ef611149ac0b3130f159af1d34fe2a5b67c4 100644 (file)
@@ -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<LsColJob *>(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);
index 0a9328b519d97cd5173cb8aea74513ec503ff01a..80cb2b8c138dac181a3ad01cc12f2ac1ac864518 100644 (file)
@@ -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);