[Pkg-owncloud-commits] [owncloud-client] 353/470: Use expireDate if returned by the OCS Share API
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:25 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 598941948ce6bb7bd7417e4e09435dd93c6401eb
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date: Tue Apr 19 11:22:32 2016 +0200
Use expireDate if returned by the OCS Share API
If an app modifies the expiration date (for example the password policy
app) then on more recent versions of the server we will get the share
object back REST style. We should use that info!
Fixes #4409
---
src/gui/share.cpp | 14 ++++++++++++--
src/gui/share.h | 2 +-
src/gui/sharelinkwidget.cpp | 4 ++++
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/gui/share.cpp b/src/gui/share.cpp
index a72fe7c..e3c6594 100644
--- a/src/gui/share.cpp
+++ b/src/gui/share.cpp
@@ -180,9 +180,19 @@ void LinkShare::setExpireDate(const QDate &date)
job->setExpireDate(getId(), date);
}
-void LinkShare::slotExpireDateSet(const QVariantMap&, const QVariant &value)
+void LinkShare::slotExpireDateSet(const QVariantMap& reply, const QVariant &value)
{
- _expireDate = value.toDate();
+ auto data = reply.value("ocs").toMap().value("data").toMap();
+
+ /*
+ * If the reply provides a data back (more REST style)
+ * they use this date.
+ */
+ if (data.value("expiration").isValid()) {
+ _expireDate = QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00");
+ } else {
+ _expireDate = value.toDate();
+ }
emit expireDateSet();
}
diff --git a/src/gui/share.h b/src/gui/share.h
index 1d22933..e022624 100644
--- a/src/gui/share.h
+++ b/src/gui/share.h
@@ -190,7 +190,7 @@ signals:
private slots:
void slotPasswordSet(const QVariantMap&, const QVariant &value);
void slotPublicUploadSet(const QVariantMap&, const QVariant &value);
- void slotExpireDateSet(const QVariantMap&, const QVariant &value);
+ void slotExpireDateSet(const QVariantMap& reply, const QVariant &value);
void slotSetPasswordError(int statusCode, const QString &message);
private:
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp
index d7c1755..7591b93 100644
--- a/src/gui/sharelinkwidget.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -153,6 +153,10 @@ void ShareLinkWidget::setExpireDate(const QDate &date)
void ShareLinkWidget::slotExpireSet()
{
+ auto date = _share->getExpireDate();
+ if (date.isValid()) {
+ _ui->calendar->setDate(date);
+ }
_pi_date->stopAnimation();
}
--
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