[Pkg-owncloud-commits] [owncloud-client] 127/171: Share dialog: Error reporting with password policy #4209

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:59 UTC 2016


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

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit 4d52838e2be909c45d85796199789200d42d9f53
Author: Christian Kamm <mail at ckamm.de>
Date:   Tue Jan 19 14:03:13 2016 +0100

    Share dialog: Error reporting with password policy #4209
---
 src/gui/share.cpp           |  2 +-
 src/gui/share.h             |  9 ++++++++-
 src/gui/sharelinkwidget.cpp | 16 +++++++++++++---
 src/gui/sharelinkwidget.h   |  2 +-
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/gui/share.cpp b/src/gui/share.cpp
index fcdf1b1..f362dd3 100644
--- a/src/gui/share.cpp
+++ b/src/gui/share.cpp
@@ -201,7 +201,7 @@ void ShareManager::slotLinkShareCreated(const QVariantMap &reply)
      * meant that a share was password protected
      */
     if (code == 403) {
-        emit linkShareRequiresPassword();
+        emit linkShareRequiresPassword(message);
         return;
     } 
 
diff --git a/src/gui/share.h b/src/gui/share.h
index 0811e38..234986f 100644
--- a/src/gui/share.h
+++ b/src/gui/share.h
@@ -259,10 +259,17 @@ public:
 signals:
     void shareCreated(const QSharedPointer<Share> &share);
     void linkShareCreated(const QSharedPointer<LinkShare> &share);
-    void linkShareRequiresPassword();
     void sharesFetched(const QList<QSharedPointer<Share>> &shares);
     void serverError(int code, const QString &message);
 
+    /** Emitted when creating a link share with password fails.
+     *
+     * @param message the error message reported by the server
+     *
+     * See createLinkShare().
+     */
+    void linkShareRequiresPassword(const QString &message);
+
 private slots:
     void slotSharesFetched(const QVariantMap &reply);
     void slotLinkShareCreated(const QVariantMap &reply);
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp
index c5c5b0c..1d14eb7 100644
--- a/src/gui/sharelinkwidget.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -140,13 +140,14 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
 
     connect(_manager, SIGNAL(sharesFetched(QList<QSharedPointer<Share>>)), SLOT(slotSharesFetched(QList<QSharedPointer<Share>>)));
     connect(_manager, SIGNAL(linkShareCreated(QSharedPointer<LinkShare>)), SLOT(slotCreateShareFetched(const QSharedPointer<LinkShare>)));
-    connect(_manager, SIGNAL(linkShareRequiresPassword()), SLOT(slotCreateShareRequiresPassword()));
+    connect(_manager, SIGNAL(linkShareRequiresPassword(QString)), SLOT(slotCreateShareRequiresPassword(QString)));
     connect(_manager, SIGNAL(serverError(int, QString)), SLOT(displayError(int, QString)));
 }
 
 void ShareLinkWidget::setExpireDate(const QDate &date)
 {
     _pi_date->startAnimation();
+    _ui->errorLabel->hide();
     _share->setExpireDate(date);
 }
 
@@ -185,6 +186,7 @@ void ShareLinkWidget::setPassword(const QString &password)
 {
     _pi_link->startAnimation();
     _pi_password->startAnimation();
+    _ui->errorLabel->hide();
 
     _ui->checkBox_password->setEnabled(false);
     _ui->lineEdit_password->setEnabled(false);
@@ -378,6 +380,7 @@ void ShareLinkWidget::slotCheckBoxShareLinkClicked()
 
         _pi_link->startAnimation();
         _ui->checkBox_shareLink->setEnabled(false);
+        _ui->errorLabel->hide();
         _manager->createLinkShare(_sharePath);
     } else {
 
@@ -403,18 +406,24 @@ void ShareLinkWidget::slotCreateShareFetched(const QSharedPointer<LinkShare> sha
     getShares();
 }
 
-void ShareLinkWidget::slotCreateShareRequiresPassword()
+void ShareLinkWidget::slotCreateShareRequiresPassword(const QString& message)
 {
     // there needs to be a password
-    _pi_editing->stopAnimation();
+    _pi_link->stopAnimation();
+    _pi_password->stopAnimation();
     _ui->checkBox_password->setChecked(true);
     _ui->checkBox_password->setEnabled(false);
     _ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
+    _ui->lineEdit_password->setEnabled(true);
     _ui->lineEdit_password->setFocus();
     _ui->pushButton_copy->hide();
     _ui->widget_shareLink->show();
     _ui->checkBox_expire->setEnabled(false);
     _ui->checkBox_editing->setEnabled(false);
+    if (!message.isEmpty()) {
+        _ui->errorLabel->setText(message);
+        _ui->errorLabel->show();
+    }
 
     _passwordRequired = true;
 
@@ -477,6 +486,7 @@ void ShareLinkWidget::setPublicUpload(bool publicUpload)
 {
     _ui->checkBox_editing->setEnabled(false);
     _pi_editing->startAnimation();
+    _ui->errorLabel->hide();
 
     _share->setPublicUpload(publicUpload);
 }
diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h
index 6ca2dde..9fa3e3d 100644
--- a/src/gui/sharelinkwidget.h
+++ b/src/gui/sharelinkwidget.h
@@ -56,7 +56,7 @@ public:
 private slots:
     void slotSharesFetched(const QList<QSharedPointer<Share>> &shares);
     void slotCreateShareFetched(const QSharedPointer<LinkShare> share);
-    void slotCreateShareRequiresPassword();
+    void slotCreateShareRequiresPassword(const QString& message);
     void slotDeleteShareFetched();
     void slotPasswordSet();
     void slotExpireSet();

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