mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Use NCInputDateField in ShareDetailsPage
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
56b87c72c1
commit
d2900bad11
1 changed files with 16 additions and 13 deletions
|
@ -64,7 +64,7 @@ Page {
|
|||
readonly property string passwordPlaceholder: "●●●●●●●●●●"
|
||||
|
||||
readonly property var expireDate: shareModelData.expireDate // Don't use int as we are limited
|
||||
readonly property var maximumExpireDate: shareModelData.enforcedMaximumExpireDate
|
||||
readonly property var maximumExpireDate: shareModelData.enforcedMaximumExpireDate // msecs epoch
|
||||
|
||||
readonly property string linkShareLabel: shareModelData.linkShareLabel ?? ""
|
||||
|
||||
|
@ -127,7 +127,7 @@ Page {
|
|||
//
|
||||
// So to ensure that the text of the spin box is correctly updated, force an update of the
|
||||
// contents of the expire date text field.
|
||||
expireDateSpinBox.updateText();
|
||||
expireDateField.updateText();
|
||||
waitingForExpireDateChange = false;
|
||||
}
|
||||
|
||||
|
@ -734,26 +734,29 @@ Page {
|
|||
NCInputDateField {
|
||||
id: expireDateField
|
||||
|
||||
date: root.expireDate
|
||||
onDateChanged: {
|
||||
const value = valueFromText(text, expireDateSpinBox.locale);
|
||||
root.setExpireDate(value * dayInMSecs);
|
||||
root.waitingForExpireDateChange = true;
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
height: visible ? implicitHeight : 0
|
||||
|
||||
maximumDate: root.maximumExpireDate
|
||||
minimumDate: {
|
||||
dateInMs: root.expireDate
|
||||
maximumDateMs: root.maximumExpireDate
|
||||
minimumDateMs: {
|
||||
const currentDate = new Date();
|
||||
const currentYear = currentDate.getFullYear();
|
||||
const currentMonth = currentDate.getMonth();
|
||||
const currentMonthDay = currentDate.getDate();
|
||||
// Start of day at 00:00:0000 UTC
|
||||
return new Date(Date.UTC(currentDate.getFullYear(),
|
||||
currentDate.getMonth(),
|
||||
currentDate.getDate() + 1));
|
||||
return Date.UTC(currentYear, currentMonth, currentMonthDay + 1);
|
||||
}
|
||||
|
||||
enabled: root.expireDateEnabled &&
|
||||
!root.waitingForExpireDateChange &&
|
||||
!root.waitingForExpireDateEnabledChange
|
||||
|
||||
onUserAcceptedDate: {
|
||||
root.setExpireDate(dateInMs);
|
||||
root.waitingForExpireDateChange = true;
|
||||
}
|
||||
|
||||
NCBusyIndicator {
|
||||
anchors.fill: parent
|
||||
visible: root.waitingForExpireDateEnabledChange ||
|
||||
|
|
Loading…
Reference in a new issue