ui: fixes bugs after unsuccessful file upload
This commit is contained in:
@@ -5,12 +5,16 @@
|
|||||||
#include <widget.h>
|
#include <widget.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
static void (*active_callback_backup)(w_cb_args_t *) = NULL;
|
||||||
|
|
||||||
void app_draw_modal(app_t *app) {
|
void app_draw_modal(app_t *app) {
|
||||||
if (app->modal.needs_destroy ||
|
if (app->modal.needs_destroy ||
|
||||||
(app->query_args->state == S_WAIT_SERVER && app->modal.is_initiated)) {
|
(app->query_args->state == S_WAIT_SERVER && app->modal.is_initiated)) {
|
||||||
w_dialogue_destroy(&(app->modal), app);
|
w_dialogue_destroy(&(app->modal), app);
|
||||||
|
app->active_callback = active_callback_backup;
|
||||||
}
|
}
|
||||||
if (!app->modal.is_initiated) {
|
if (!app->modal.is_initiated) {
|
||||||
|
active_callback_backup = app->active_callback;
|
||||||
switch (app->query_args->state) {
|
switch (app->query_args->state) {
|
||||||
case S_ASK_SEVER_IP:
|
case S_ASK_SEVER_IP:
|
||||||
m_asa_init(app);
|
m_asa_init(app);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ void upload_props_dialogue_modal_cb(w_cb_args_t *args) {
|
|||||||
FREE_MLC(app->query_args->file->name);
|
FREE_MLC(app->query_args->file->name);
|
||||||
FREE_MLC(app->query_args->file->path)
|
FREE_MLC(app->query_args->file->path)
|
||||||
FREE_MLC(app->query_args->file);
|
FREE_MLC(app->query_args->file);
|
||||||
|
app->modal.needs_destroy = true;
|
||||||
app->query_args->state = S_WAIT_SERVER;
|
app->query_args->state = S_WAIT_SERVER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ void query_loop(app_t *app) {
|
|||||||
w_alert("error while processing user input");
|
w_alert("error while processing user input");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
d_args.resp_data.code = cbrc_none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,6 +185,11 @@ int process_query(app_t *app) {
|
|||||||
if (!file_upload_start(query_args)) {
|
if (!file_upload_start(query_args)) {
|
||||||
query_args->state = S_UPLOAD_FILE;
|
query_args->state = S_UPLOAD_FILE;
|
||||||
} else {
|
} else {
|
||||||
|
if (app->query_args->file != NULL) {
|
||||||
|
FREE_MLC(app->query_args->file->name);
|
||||||
|
FREE_MLC(app->query_args->file->path)
|
||||||
|
FREE_MLC(app->query_args->file);
|
||||||
|
}
|
||||||
query_args->state = WAIT_CLIENT;
|
query_args->state = WAIT_CLIENT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ bool w_checkbox_default_key_action(w_cb_args_t *args) {
|
|||||||
w_g_el_t *g_el = args->active_el;
|
w_g_el_t *g_el = args->active_el;
|
||||||
w_checkbox_t *cbx = g_el->element;
|
w_checkbox_t *cbx = g_el->element;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case '\40':
|
case '\40': /* SPACE */
|
||||||
cbx->value = !cbx->value;
|
cbx->value = !cbx->value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <widget.h>
|
#include <widget.h>
|
||||||
#include <widget_core.h>
|
#include <widget_core.h>
|
||||||
|
|
||||||
|
static void (*active_callback_backup)(w_cb_args_t *) = NULL;
|
||||||
|
|
||||||
void incr_active_id(w_dialogue_t *d) {
|
void incr_active_id(w_dialogue_t *d) {
|
||||||
w_g_el_t *active_el = NULL;
|
w_g_el_t *active_el = NULL;
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -133,6 +135,8 @@ void w_dialogue_callback_default(w_cb_args_t *args) {
|
|||||||
new_args.element = d->g_action;
|
new_args.element = d->g_action;
|
||||||
}
|
}
|
||||||
w_group_cb_default(&new_args);
|
w_group_cb_default(&new_args);
|
||||||
|
/* copy new result to the parental structure */
|
||||||
|
mempcpy(&(args->resp_data), &(new_args.resp_data), sizeof(new_args.resp_data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user