2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Start scrollable CalendarBox.

This commit is contained in:
John Preston
2021-11-11 15:44:12 +04:00
parent f13e28a9c5
commit be7cd51740
11 changed files with 288 additions and 229 deletions

View File

@@ -704,20 +704,22 @@ void EditRestrictedBox::showRestrictUntil() {
: base::unixtime::parse(getRealUntilValue()).date();
auto month = highlighted;
_restrictUntilBox = Ui::show(
Box<Ui::CalendarBox>(
month,
highlighted,
[this](const QDate &date) {
Box<Ui::CalendarBox>(Ui::CalendarBoxArgs{
.month = month,
.highlighted = highlighted,
.callback = [=](const QDate &date) {
setRestrictUntil(
static_cast<int>(date.startOfDay().toSecsSinceEpoch()));
}),
},
.finalize = [=](not_null<Ui::CalendarBox*> box) {
box->addLeftButton(
tr::lng_rights_chat_banned_forever(),
[=] { setRestrictUntil(0); });
},
.minDate = tomorrow,
.maxDate = QDate::currentDate().addDays(kMaxRestrictDelayDays),
}),
Ui::LayerOption::KeepOther);
_restrictUntilBox->setMaxDate(
QDate::currentDate().addDays(kMaxRestrictDelayDays));
_restrictUntilBox->setMinDate(tomorrow);
_restrictUntilBox->addLeftButton(
tr::lng_rights_chat_banned_forever(),
[=] { setRestrictUntil(0); });
}
void EditRestrictedBox::setRestrictUntil(TimeId until) {