diff --git a/src/main.h b/src/main.h index c458f1d..0c2f53b 100644 --- a/src/main.h +++ b/src/main.h @@ -52,6 +52,7 @@ enum state { S_ERR, S_NEXT_ACTION, S_WAIT_REGISTER_CONFIRMATION, + S_WAIT_USER_DESCRIPTION, /* Legacy */ WAIT_SERVER_INIT, WAIT_SERVER, diff --git a/src/query.c b/src/query.c index 7d16aab..fda3ed0 100644 --- a/src/query.c +++ b/src/query.c @@ -140,13 +140,12 @@ void wait_register(query_args_t *q_args) { int upload_confirm_cb(app_t *app, char *query, int q_len) { if (!strncmp("finished\n", query, sizeof("finished\n") - 1)) { - /* TODO: DESCRIPTION HERE */ w_notification("File upload", dc_normal, "File %s is uploaded to the server!", app->query_args->file->name); - clear_file_in_query(app->query_args); - app->query_args->state = S_FILE_LIST; - app->modal.needs_destroy = true; + main_window_set(app, mw_f_desc); + /* clear_file_in_query(app->query_args); */ + app->query_args->state = S_WAIT_USER_DESCRIPTION; return 0; } return 1; /* TODO: Error case */ diff --git a/src/widget/dialogue.c b/src/widget/dialogue.c index f9de915..990c2fb 100644 --- a/src/widget/dialogue.c +++ b/src/widget/dialogue.c @@ -333,6 +333,7 @@ void w_dialogue_destroy(w_dialogue_t *d, void *_app) { d->win = NULL; d->is_initiated = false; d->needs_destroy = false; + d->needs_update = false; app->active_callback = (w_cb_t)app->main_ui.cb_b_press; app->query_args->active_dialogue = NULL; u_d_arr_ptr_free(&(d->id_map)); diff --git a/src/windows/main_window.c b/src/windows/main_window.c index 52245c7..7031ec3 100644 --- a/src/windows/main_window.c +++ b/src/windows/main_window.c @@ -10,6 +10,9 @@ void main_window_set(app_t *app, enum main_window_type type) { if (app->main_ui.ui != NULL) { main_window_destroy(app); } + if (app->modal.is_initiated) { + w_dialogue_destroy(&(app->modal), app); + } app->main_ui.type = type; switch (type) { case mw_fl_server: diff --git a/src/windows/text_edit.c b/src/windows/text_edit.c index c48e655..0fadb54 100644 --- a/src/windows/text_edit.c +++ b/src/windows/text_edit.c @@ -13,6 +13,9 @@ #include #include #include +#include "../server.h" +#include "../file_processor.h" +#include "../windows/main_window.h" #include "d_array.h" #include "text_edit.h" @@ -188,6 +191,9 @@ static int32_t process_user_input(app_t *app, w_cb_args_t *d_args) { app->query_args->file->description[text_pos] = '\03'; /* ETX symbol */ strncpy(app->query_args->file->description + text_pos, ":END:\n", sizeof(":END:\n")); + server_send_string(app->query_args, app->query_args->file->description); + clear_file_in_query(app->query_args); + main_window_set(app, mw_fl_server); /* Save */ break; case KEY_F(8):