[Pkg-owncloud-commits] [owncloud-client] 406/470: Remote folder selection: improve path typing #4745 #4746

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 0829a94c929596d3dd0441fc6fbe69ac9af8fc78
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Apr 27 10:37:17 2016 +0200

    Remote folder selection: improve path typing #4745 #4746
    
    * Scroll to the target typed path
    * Show non-404 errors that were triggered by typing paths
---
 src/gui/folderwizard.cpp | 21 ++++++++++++++++++++-
 src/gui/folderwizard.h   |  1 +
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index c566842..3e10c48 100644
--- a/src/gui/folderwizard.cpp
+++ b/src/gui/folderwizard.cpp
@@ -306,6 +306,7 @@ bool FolderWizardRemotePath::selectByPath(QString path)
     }
 
     _ui.folderTreeWidget->setCurrentItem(it);
+    _ui.folderTreeWidget->scrollToItem(it);
     return true;
 }
 
@@ -374,8 +375,11 @@ void FolderWizardRemotePath::slotLsColFolderEntry()
         path = path.mid(1);
 
     LsColJob *job = runLsColJob(path);
-    // no error handling, no updating, we do this manually
+    // No error handling, no updating, we do this manually
+    // because of extra logic in the typed-path case.
     disconnect(job, 0, this, 0);
+    connect(job, SIGNAL(finishedWithError(QNetworkReply*)),
+            SLOT(slotTypedPathError(QNetworkReply*)));
     connect(job, SIGNAL(directoryListingSubfolders(QStringList)),
             SLOT(slotTypedPathFound(QStringList)));
 }
@@ -386,6 +390,21 @@ 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)
 {
     LsColJob *job = new LsColJob(_account, path, this);
diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h
index 1796555..bbed262 100644
--- a/src/gui/folderwizard.h
+++ b/src/gui/folderwizard.h
@@ -98,6 +98,7 @@ protected slots:
     void slotFolderEntryEdited(const QString& text);
     void slotLsColFolderEntry();
     void slotTypedPathFound(const QStringList& subpaths);
+    void slotTypedPathError(QNetworkReply* reply);
 private:
     LsColJob* runLsColJob(const QString& path);
     void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path);

-- 
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