Show trash tab only when trashing enabled

This commit is contained in:
Athozus 2023-06-15 19:20:14 +02:00
parent ab47f9b0eb
commit 6b59b9780e
No known key found for this signature in database
GPG key ID: B50895022E8484BF
3 changed files with 32 additions and 17 deletions

View file

@ -1,23 +1,28 @@
-- translation -- translation
local S = minetest.get_translator("mail") local S = minetest.get_translator("mail")
local drafts_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] ..
S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. "," .. S("Trash") .. [[;3;false;false]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;edit;]] .. S("Edit") .. [[]
button[6,1.70;2.5,0.5;delete;]] .. S("Delete") .. [[]
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[]
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;drafts;#999,]] .. S("To") .. "," .. S("Subject")
function mail.show_drafts(name) function mail.show_drafts(name)
local trash_tab = ""
if mail.get_setting(name, "trash_move_enable") then
trash_tab = "," .. S("Trash")
end
local drafts_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] ..
S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;3;false;false]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;edit;]] .. S("Edit") .. [[]
button[6,1.70;2.5,0.5;delete;]] .. S("Delete") .. [[]
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
button[6,8.7;2.5,0.5;options;]] .. S("Options") .. [[]
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
tablecolumns[color;text;text]
table[0,0.7;5.75,9.35;drafts;#999,]] .. S("To") .. "," .. S("Subject")
local formspec = { drafts_formspec } local formspec = { drafts_formspec }
local entry = mail.get_storage_entry(name) local entry = mail.get_storage_entry(name)
local messages = entry.drafts local messages = entry.drafts

View file

@ -13,9 +13,14 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
local sortfield = ({"from","subject","time"})[sortfieldindex] local sortfield = ({"from","subject","time"})[sortfieldindex]
local messages = mail.sort_messages(entry.inbox, sortfield, sortdirection == "2", filter) local messages = mail.sort_messages(entry.inbox, sortfield, sortdirection == "2", filter)
local trash_tab = ""
if mail.get_setting(name, "trash_move_enable") then
trash_tab = "," .. S("Trash")
end
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[ local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] .. tabheader[0.3,1;boxtab;]] ..
S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. "," .. S("Trash") .. [[;1;false;false] S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;1;false;false]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[] button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[] button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]

View file

@ -13,9 +13,14 @@ function mail.show_outbox(name, sortfieldindex, sortdirection, filter)
local sortfield = ({"to","subject","time"})[sortfieldindex] local sortfield = ({"to","subject","time"})[sortfieldindex]
local messages = mail.sort_messages(entry.outbox, sortfield, sortdirection == "2", filter) local messages = mail.sort_messages(entry.outbox, sortfield, sortdirection == "2", filter)
local trash_tab = ""
if mail.get_setting(name, "trash_move_enable") then
trash_tab = "," .. S("Trash")
end
local outbox_formspec = "size[8.5,10;]" .. mail.theme .. [[ local outbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
tabheader[0.3,1;boxtab;]] .. tabheader[0.3,1;boxtab;]] ..
S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. "," .. S("Trash") .. [[;2;false;false] S("Inbox") .. "," .. S("Outbox").. "," .. S("Drafts") .. trash_tab .. [[;2;false;false]
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[] button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[] button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]