1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

LibGUI: Don't show "last saved" information for never-saved documents

When showing the "unsaved changes" dialog for an empty path, we should
say "last saved at ..." since that would be a lie.
This commit is contained in:
Andreas Kling 2022-01-04 18:07:06 +01:00
parent 219339d2a5
commit 0c09617b48
Notes: sideshowbarker 2024-07-17 21:40:02 +09:00

View file

@ -37,7 +37,7 @@ int MessageBox::ask_about_unsaved_changes(Window* parent_window, StringView path
builder.appendff("\"{}\"", LexicalPath::basename(path));
builder.append(" before closing?");
if (last_unmodified_timestamp.has_value()) {
if (!path.is_empty() && last_unmodified_timestamp.has_value()) {
auto age = (Time::now_monotonic() - *last_unmodified_timestamp).to_seconds();
builder.appendff("\nLast saved {} second{} ago.", age, age == 1 ? "" : "s");
}