|
|
|
@ -81,10 +81,12 @@ impl ContactManager {
|
|
|
|
|
if !self.content.resize_with_context(100, 1, context) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let mut area = self.content.area();
|
|
|
|
|
let area = self.content.area();
|
|
|
|
|
|
|
|
|
|
let (x, _) = self.content.grid_mut().write_string(
|
|
|
|
|
"Last edited: ",
|
|
|
|
|
if self.card.external_resource() {
|
|
|
|
|
self.mode = ViewMode::ReadOnly;
|
|
|
|
|
self.content.grid_mut().write_string(
|
|
|
|
|
"This contact's origin is external and cannot be edited within meli.",
|
|
|
|
|
self.theme_default.fg,
|
|
|
|
|
self.theme_default.bg,
|
|
|
|
|
self.theme_default.attrs,
|
|
|
|
@ -92,9 +94,9 @@ impl ContactManager {
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
);
|
|
|
|
|
area = area.skip_cols(x);
|
|
|
|
|
let (x, y) = self.content.grid_mut().write_string(
|
|
|
|
|
&self.card.last_edited(),
|
|
|
|
|
} else {
|
|
|
|
|
let (x, _) = self.content.grid_mut().write_string(
|
|
|
|
|
"Last edited: ",
|
|
|
|
|
self.theme_default.fg,
|
|
|
|
|
self.theme_default.bg,
|
|
|
|
|
self.theme_default.attrs,
|
|
|
|
@ -102,16 +104,12 @@ impl ContactManager {
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
);
|
|
|
|
|
area = area.skip(x, y);
|
|
|
|
|
|
|
|
|
|
if self.card.external_resource() {
|
|
|
|
|
self.mode = ViewMode::ReadOnly;
|
|
|
|
|
self.content.grid_mut().write_string(
|
|
|
|
|
"This contact's origin is external and cannot be edited within meli.",
|
|
|
|
|
&self.card.last_edited(),
|
|
|
|
|
self.theme_default.fg,
|
|
|
|
|
self.theme_default.bg,
|
|
|
|
|
self.theme_default.attrs,
|
|
|
|
|
area,
|
|
|
|
|
area.skip_cols(x),
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
);
|
|
|
|
@ -166,15 +164,12 @@ impl Component for ContactManager {
|
|
|
|
|
|
|
|
|
|
if self.is_dirty() {
|
|
|
|
|
grid.clear_area(area, self.theme_default);
|
|
|
|
|
grid.copy_area(self.content.grid(), area.skip_rows(2), self.content.area());
|
|
|
|
|
grid.copy_area(self.content.grid(), area, self.content.area());
|
|
|
|
|
self.dirty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.form.draw(
|
|
|
|
|
grid,
|
|
|
|
|
area.skip_rows(2 + self.content.area().height()),
|
|
|
|
|
context,
|
|
|
|
|
);
|
|
|
|
|
self.form
|
|
|
|
|
.draw(grid, area.skip_rows(self.content.area().height()), context);
|
|
|
|
|
if let ViewMode::Discard(ref mut selector) = self.mode {
|
|
|
|
|
/* Let user choose whether to quit with/without saving or cancel */
|
|
|
|
|
selector.draw(grid, area, context);
|
|
|
|
|