new realization of cancel download [need review]
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#include "../server.h"
|
||||
#include "../windows/file_list.h"
|
||||
#include "alert.h"
|
||||
#include "dialogue.h"
|
||||
#include "group.h"
|
||||
#include "utils.h"
|
||||
#include "../windows/file_list.h"
|
||||
#include <ncursesw/ncurses.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -13,11 +13,11 @@
|
||||
void dwn_pr_modal_cb(w_cb_args_t *args) {
|
||||
/* only cancel action */
|
||||
int32_t key = *((int32_t *)args->data);
|
||||
|
||||
|
||||
if (key != '\n') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
app_t *app = args->app;
|
||||
w_dialogue_t *d = &(app->modal);
|
||||
/* TODO: forward actual file name */
|
||||
@@ -32,9 +32,9 @@ void dwn_pr_modal_cb(w_cb_args_t *args) {
|
||||
bool response =
|
||||
w_bool_ask("Cancel file download", "Yes", "No", false,
|
||||
"You're going to cancel download\n Are you sure?");
|
||||
server_send_string(app->query_args, "cancel\n");
|
||||
FILE_CLEAN(app);
|
||||
d->needs_destroy = true;
|
||||
if (response) {
|
||||
app->query_args->file->signal = sig_cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user