aboutsummaryrefslogtreecommitdiff
path: root/clients/bokftui.c
diff options
context:
space:
mode:
Diffstat (limited to 'clients/bokftui.c')
-rw-r--r--clients/bokftui.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/clients/bokftui.c b/clients/bokftui.c
index 3258f22..f7500bf 100644
--- a/clients/bokftui.c
+++ b/clients/bokftui.c
@@ -320,6 +320,7 @@ static void update_status(struct app *a)
/* Create a new fiscal year. Returns the new id (>0) or 0. */
static int64_t fy_new_form(struct app *a)
{
+ static int sel = 0;
char label[32] = "", start[16] = "", end[16] = "";
char *resp =
client_rpc(&a->conn, "fiscal_year.list", a->session, a->org, "{}");
@@ -372,7 +373,7 @@ static int64_t fy_new_form(struct app *a)
ff[2].value = end;
ff[2].cap = sizeof end;
ff[2].kind = TUI_F_DATE;
- int r = tui_form_run("Nytt räkenskapsår", ff, 3, 1);
+ int r = tui_form_run("Nytt räkenskapsår", ff, 3, 1, &sel);
if (r == TUI_FORM_BACK)
return 0;
if (r != TUI_FORM_REFRESH && r != TUI_FORM_SUBMIT)
@@ -4130,6 +4131,7 @@ static void board_screen(struct app *a)
static void company_screen(struct app *a)
{
+ static int sel = 0;
const int nf = (int)(sizeof COMPANY_FIELDS / sizeof COMPANY_FIELDS[0]);
int owner = a->role[0] && strcmp(a->role, "owner") == 0;
for (;;) {
@@ -4164,7 +4166,7 @@ static void company_screen(struct app *a)
free(resp);
ff[nf].label = "Styrelseledamöter";
ff[nf].kind = TUI_F_ACTION;
- int r = tui_form_run("Företagsuppgifter", ff, nf + 1, owner);
+ int r = tui_form_run("Företagsuppgifter", ff, nf + 1, owner, &sel);
if (r >= 0 && r < nf) {
if (!company_field_valid(&COMPANY_FIELDS[r], vals[r])) {
tui_message("Ogiltigt värde", "%s", COMPANY_FIELDS[r].label);
@@ -4204,6 +4206,7 @@ static const char *const SETTING_LABELS[] = { "Standardserie",
static void settings_screen(struct app *a)
{
+ static int sel = 0;
const int nset = (int)(sizeof SETTING_KEYS / sizeof SETTING_KEYS[0]);
for (;;) {
if (g_quit)
@@ -4231,7 +4234,7 @@ static void settings_screen(struct app *a)
ff[i].kind = TUI_F_TEXT;
}
free(resp);
- int r = tui_form_run("Inställningar", ff, nset, 1);
+ int r = tui_form_run("Inställningar", ff, nset, 1, &sel);
if (r >= 0) {
yyjson_mut_doc *d = yyjson_mut_doc_new(NULL);
yyjson_mut_val *o = yyjson_mut_obj(d);
@@ -4472,6 +4475,7 @@ static void bokslut_plan(struct app *a, const char *fond, const char *rate,
view. New years inherit the stable fields. */
static void bokslut_screen(struct app *a)
{
+ static int sel = 0;
static const char *const labels[6] = {
"Väsentliga händelser",
"Årsstämma (YYYY-MM-DD)",
@@ -4574,7 +4578,7 @@ static void bokslut_screen(struct app *a)
" bokslutsplan ^Enter = bokför planen (frågar"
" först) Esc/q = tillbaka ^C = avsluta");
int r = tui_form_run_actions("Bokslut", ff, nf + 2, can_edit, acts, 5,
- NULL);
+ NULL, &sel);
if (r >= 0 && r < nf) {
yyjson_mut_doc *d = yyjson_mut_doc_new(NULL);
yyjson_mut_val *o = yyjson_mut_obj(d);
@@ -5606,6 +5610,7 @@ static int try_login(struct app *a, const char *user, const char *pass,
static int login_screen(struct app *a)
{
+ static int sel = 0;
char socket_path[256], user[64], pass[128];
snprintf(socket_path, sizeof socket_path, "%s", a->socket);
const char *env_pass = getenv("BOKFD_PASSWORD");
@@ -5631,7 +5636,7 @@ static int login_screen(struct app *a)
ff[3].kind = TUI_F_ACTION;
for (;;) {
- int r = tui_form_run("bokf — inloggning", ff, 4, 1);
+ int r = tui_form_run("bokf — inloggning", ff, 4, 1, &sel);
if (r == TUI_FORM_BACK) {
if (g_quit) {
endwin();