Skip to content

Commit 7f0157a

Browse files
committed
compose: make dialogs bigger in height
Otherwise they might be hidden in small screens. Signed-off-by: Manos Pitsidianakis <[email protected]>
1 parent 7e800a8 commit 7f0157a

2 files changed

Lines changed: 38 additions & 19 deletions

File tree

meli/src/mail/compose.rs

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ enum ViewMode {
131131
EmbeddedPty,
132132
SelectRecipients(UIDialog<Address>),
133133
#[cfg(feature = "gpgme")]
134-
SelectEncryptKey(bool, gpg::KeySelection),
134+
SelectKey(bool, gpg::KeySelection),
135135
Send(UIConfirmationDialog),
136136
WaitingForSendResult(UIDialog<char>, JoinHandle<Result<()>>),
137137
}
@@ -1075,30 +1075,50 @@ impl Component for Composer {
10751075
.draw(grid, inner_area, context);
10761076
}
10771077
ViewMode::Send(ref mut s) => {
1078-
s.draw(grid, body_area, context);
1078+
let inner_area = area.center_inside((
1079+
area.width().saturating_sub(2),
1080+
area.height().saturating_sub(2),
1081+
));
1082+
s.draw(grid, inner_area, context);
10791083
}
10801084
#[cfg(feature = "gpgme")]
1081-
ViewMode::SelectEncryptKey(
1085+
ViewMode::SelectKey(
10821086
_,
10831087
gpg::KeySelection::Loaded {
10841088
ref mut widget,
10851089
keys: _,
10861090
},
10871091
) => {
1088-
widget.draw(grid, body_area, context);
1092+
let inner_area = area.center_inside((
1093+
area.width().saturating_sub(2),
1094+
area.height().saturating_sub(2),
1095+
));
1096+
widget.draw(grid, inner_area, context);
10891097
}
10901098
#[cfg(feature = "gpgme")]
1091-
ViewMode::SelectEncryptKey(_, _) => {}
1099+
ViewMode::SelectKey(_, _) => {}
10921100
ViewMode::SelectRecipients(ref mut s) => {
1093-
s.draw(grid, body_area, context);
1101+
let inner_area = area.center_inside((
1102+
area.width().saturating_sub(2),
1103+
area.height().saturating_sub(2),
1104+
));
1105+
s.draw(grid, inner_area, context);
10941106
}
10951107
ViewMode::Discard(_, ref mut s) => {
1108+
let inner_area = area.center_inside((
1109+
area.width().saturating_sub(2),
1110+
area.height().saturating_sub(2),
1111+
));
10961112
/* Let user choose whether to quit with/without saving or cancel */
1097-
s.draw(grid, body_area, context);
1113+
s.draw(grid, inner_area, context);
10981114
}
10991115
ViewMode::WaitingForSendResult(ref mut s, _) => {
1116+
let inner_area = area.center_inside((
1117+
area.width().saturating_sub(2),
1118+
area.height().saturating_sub(2),
1119+
));
11001120
/* Let user choose whether to wait for success or cancel */
1101-
s.draw(grid, body_area, context);
1121+
s.draw(grid, inner_area, context);
11021122
}
11031123
}
11041124

@@ -1278,10 +1298,9 @@ impl Component for Composer {
12781298
self.set_dirty(true);
12791299
}
12801300
#[cfg(feature = "gpgme")]
1281-
(
1282-
ViewMode::SelectEncryptKey(_, ref mut selector),
1283-
UIEvent::ComponentUnrealize(ref id),
1284-
) if *id == selector.id() => {
1301+
(ViewMode::SelectKey(_, ref mut selector), UIEvent::ComponentUnrealize(ref id))
1302+
if *id == selector.id() =>
1303+
{
12851304
self.mode = ViewMode::Edit;
12861305
self.set_dirty(true);
12871306
return true;
@@ -1410,7 +1429,7 @@ impl Component for Composer {
14101429
}
14111430
#[cfg(feature = "gpgme")]
14121431
(
1413-
ViewMode::SelectEncryptKey(is_encrypt, ref mut selector),
1432+
ViewMode::SelectKey(is_encrypt, ref mut selector),
14141433
UIEvent::FinishedUIDialog(id, result),
14151434
) if *id == selector.id() => {
14161435
if let Some(Some(key)) = result.downcast_mut::<Option<melib::gpgme::Key>>() {
@@ -1427,7 +1446,7 @@ impl Component for Composer {
14271446
return true;
14281447
}
14291448
#[cfg(feature = "gpgme")]
1430-
(ViewMode::SelectEncryptKey(_, ref mut selector), _) => {
1449+
(ViewMode::SelectKey(_, ref mut selector), _) => {
14311450
if selector.process_event(event, context) {
14321451
self.set_dirty(true);
14331452
return true;
@@ -1717,7 +1736,7 @@ impl Component for Composer {
17171736
}) {
17181737
Ok(widget) => {
17191738
self.gpg_state.sign_mail = Some(ActionFlag::from(true));
1720-
self.mode = ViewMode::SelectEncryptKey(false, widget);
1739+
self.mode = ViewMode::SelectKey(false, widget);
17211740
}
17221741
Err(err) => {
17231742
context.replies.push_back(UIEvent::Notification {
@@ -1758,7 +1777,7 @@ impl Component for Composer {
17581777
}) {
17591778
Ok(widget) => {
17601779
self.gpg_state.encrypt_mail = Some(ActionFlag::from(true));
1761-
self.mode = ViewMode::SelectEncryptKey(true, widget);
1780+
self.mode = ViewMode::SelectKey(true, widget);
17621781
}
17631782
Err(err) => {
17641783
context.replies.push_back(UIEvent::Notification {
@@ -2286,7 +2305,7 @@ impl Component for Composer {
22862305
widget.is_dirty() || self.pager.is_dirty() || self.form.is_dirty()
22872306
}
22882307
#[cfg(feature = "gpgme")]
2289-
ViewMode::SelectEncryptKey(_, ref widget) => {
2308+
ViewMode::SelectKey(_, ref widget) => {
22902309
widget.is_dirty() || self.pager.is_dirty() || self.form.is_dirty()
22912310
}
22922311
ViewMode::Send(ref widget) => {
@@ -2310,7 +2329,7 @@ impl Component for Composer {
23102329
widget.set_dirty(value);
23112330
}
23122331
#[cfg(feature = "gpgme")]
2313-
ViewMode::SelectEncryptKey(_, ref mut widget) => {
2332+
ViewMode::SelectKey(_, ref mut widget) => {
23142333
widget.set_dirty(value);
23152334
}
23162335
ViewMode::Send(ref mut widget) => {

meli/src/utilities/dialogs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ impl<T: PartialEq + std::fmt::Debug + Clone + Sync + Send, F: 'static + Sync + S
581581
// padding
582582
+ 3
583583
// buttons row
584-
+ if self.single_only { 1 } else { 5 };
584+
+ if self.single_only { 3 } else { 5 };
585585
if !self.content.resize_with_context(width, height, context) {
586586
self.dirty = false;
587587
return;

0 commit comments

Comments
 (0)