mirror of https://github.com/procxx/kepka.git
Submit MuteSettingsBox by Enter.
This commit is contained in:
parent
2a110f0d3e
commit
427ceb9a9a
|
@ -21,6 +21,10 @@ constexpr auto kForeverHours = 24 * 365;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
MuteSettingsBox::MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer)
|
||||||
|
: _peer(peer) {
|
||||||
|
}
|
||||||
|
|
||||||
void MuteSettingsBox::prepare() {
|
void MuteSettingsBox::prepare() {
|
||||||
setTitle(langFactory(lng_disable_notifications_from_tray));
|
setTitle(langFactory(lng_disable_notifications_from_tray));
|
||||||
auto y = 0;
|
auto y = 0;
|
||||||
|
@ -67,15 +71,25 @@ void MuteSettingsBox::prepare() {
|
||||||
- st::boxOptionListSkip
|
- st::boxOptionListSkip
|
||||||
+ st::defaultCheckbox.margin.bottom();
|
+ st::defaultCheckbox.margin.bottom();
|
||||||
|
|
||||||
addButton(langFactory(lng_box_ok), [this, group] {
|
_save = [=] {
|
||||||
auto muteForSeconds = group->value() * 3600;
|
const auto muteForSeconds = group->value() * 3600;
|
||||||
Auth().data().updateNotifySettings(
|
Auth().data().updateNotifySettings(
|
||||||
_peer,
|
_peer,
|
||||||
muteForSeconds);
|
muteForSeconds);
|
||||||
closeBox();
|
closeBox();
|
||||||
});
|
};
|
||||||
|
addButton(langFactory(lng_box_ok), _save);
|
||||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||||
|
|
||||||
setDimensions(st::boxWidth, y);
|
setDimensions(st::boxWidth, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MuteSettingsBox::keyPressEvent(QKeyEvent *e) {
|
||||||
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||||
|
if (_save) {
|
||||||
|
_save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// vi: ts=4 tw=80
|
// vi: ts=4 tw=80
|
||||||
|
|
|
@ -13,17 +13,17 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
|
||||||
* turning off notifications from a chat. The widget is opened by a context menu
|
* turning off notifications from a chat. The widget is opened by a context menu
|
||||||
* in the left list of dialogues. */
|
* in the left list of dialogues. */
|
||||||
class MuteSettingsBox : public BoxContent {
|
class MuteSettingsBox : public BoxContent {
|
||||||
Q_OBJECT
|
public:
|
||||||
|
MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer);
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer)
|
|
||||||
: _peer(peer) {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
|
||||||
private:
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
Fn<void()> _save;
|
||||||
|
|
||||||
};
|
};
|
||||||
// vi: ts=4 tw=80
|
// vi: ts=4 tw=80
|
||||||
|
|
Loading…
Reference in New Issue