summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorAdrian Lees <adrian@aemulor.com>2009-02-02 00:06:31 +0000
committerAdrian Lees <adrian@aemulor.com>2009-02-02 00:06:31 +0000
commit15e8ba0270fac14839fd4dda65418904bfd0c880 (patch)
tree3967ca33f543add1b7b838486092381460e1260b /riscos
parenta15d9876caa4a0b3a31f1c7fafb724be984d95fb (diff)
downloadnetsurf-15e8ba0270fac14839fd4dda65418904bfd0c880.tar.gz
netsurf-15e8ba0270fac14839fd4dda65418904bfd0c880.tar.bz2
Selection menu and save/download tweaks
svn path=/trunk/netsurf/; revision=6349
Diffstat (limited to 'riscos')
-rw-r--r--riscos/download.c10
-rw-r--r--riscos/menus.c10
-rw-r--r--riscos/save.c56
3 files changed, 48 insertions, 28 deletions
diff --git a/riscos/download.c b/riscos/download.c
index 55496451f..628789e6c 100644
--- a/riscos/download.c
+++ b/riscos/download.c
@@ -1198,7 +1198,12 @@ void ro_gui_download_remember_dir(const char *path)
char *lastdot = NULL;
char *p = path;
while (*p >= 0x20) {
- if (*p == '.') lastdot = p;
+ if (*p == '.') {
+ /* don't remember the directory if it's a temporary file */
+ if (!lastdot && p == path + 12 &&
+ !memcmp(path, "<Wimp$Scrap>", 12)) break;
+ lastdot = p;
+ }
p++;
}
if (lastdot) {
@@ -1297,7 +1302,8 @@ bool ro_gui_download_save(struct gui_download_window *dw,
dw->saved = true;
strncpy(dw->path, file_name, sizeof dw->path);
- ro_gui_download_remember_dir(file_name);
+ if (!dw->send_dataload || dw->save_message.data.data_xfer.est_size != -1)
+ ro_gui_download_remember_dir(file_name);
/* grey out file icon */
error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON,
diff --git a/riscos/menus.c b/riscos/menus.c
index 0f9277d24..cc88f905e 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -2099,9 +2099,9 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
break;
case BROWSER_SELECTION:
- /* make menu available if there's a selection or an input field for pasting */
+ /* make menu available if there's anything that /could/ be selected */
ro_gui_menu_set_entry_shaded(current_menu, action,
- !(c && (bw->paste_callback || (bw->sel && selection_defined(bw->sel)))));
+ !c || (c->type != CONTENT_HTML && c->type != CONTENT_TEXTPLAIN));
break;
case BROWSER_SELECTION_SAVE:
if (c && (!bw->sel || !selection_defined(bw->sel))) c = NULL;
@@ -2110,10 +2110,14 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
ro_gui_save_prepare(GUI_SAVE_TEXT_SELECTION, NULL, bw->sel, NULL, NULL);
break;
case BROWSER_SELECTION_COPY:
- case BROWSER_SELECTION_CUT:
ro_gui_menu_set_entry_shaded(current_menu, action,
!(c && bw->sel && selection_defined(bw->sel)));
break;
+ case BROWSER_SELECTION_CUT:
+ ro_gui_menu_set_entry_shaded(current_menu, action,
+ !(c && bw->sel && selection_defined(bw->sel)
+ && !selection_read_only(bw->sel)));
+ break;
case BROWSER_SELECTION_PASTE:
ro_gui_menu_set_entry_shaded(current_menu, action, !(c && bw->paste_callback));
break;
diff --git a/riscos/save.c b/riscos/save.c
index 900d6b651..d5dca1f1e 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -323,14 +323,16 @@ bool ro_gui_save_ok(wimp_w w)
ro_gui_convert_save_path(path, sizeof path, name);
gui_save_sourcew = w;
saving_from_dialog = true;
+ gui_save_send_dataload = false;
gui_save_close_after = xwimp_get_pointer_info(&pointer)
|| !(pointer.buttons & wimp_CLICK_ADJUST);
- if (!ro_gui_save_content(gui_save_content, path, !option_confirm_overwrite)) {
- memcpy(&gui_save_message.data.data_xfer.file_name, path, 1 + strlen(path));
- gui_save_send_dataload = false;
- return false;
+ memcpy(&gui_save_message.data.data_xfer.file_name, path, 1 + strlen(path));
+
+ if (ro_gui_save_content(gui_save_content, path, !option_confirm_overwrite)) {
+ ro_gui_save_done();
+ return true;
}
- return true;
+ return false;
}
@@ -941,24 +943,32 @@ void ro_gui_save_done(void)
}
if (saving_from_dialog) {
- /* */
- char *sp = gui_save_message.data.data_xfer.file_name;
- char *ep = sp + sizeof(gui_save_message.data.data_xfer.file_name);
- char *lastdot = NULL;
- char *p = sp;
-
- while (p < ep && *p >= 0x20) {
- if (*p == '.') lastdot = p;
- p++;
- }
- if (lastdot) {
- /* remember the directory */
- char *new_dir = realloc(save_dir, (lastdot+1)-sp);
- if (new_dir) {
- save_dir_len = lastdot - sp;
- memcpy(new_dir, sp, save_dir_len);
- new_dir[save_dir_len] = '\0';
- save_dir = new_dir;
+ /* remember the save directory if saving to the Filer */
+ if (!gui_save_send_dataload ||
+ gui_save_message.data.data_xfer.est_size != -1) {
+ char *sp = gui_save_message.data.data_xfer.file_name;
+ char *ep = sp + sizeof(gui_save_message.data.data_xfer.file_name);
+ char *lastdot = NULL;
+ char *p = sp;
+
+ while (p < ep && *p >= 0x20) {
+ if (*p == '.') {
+ /* don't remember the directory if it's a temporary file */
+ if (!lastdot && p == sp + 12 &&
+ !memcmp(sp, "<Wimp$Scrap>", 12)) break;
+ lastdot = p;
+ }
+ p++;
+ }
+ if (lastdot) {
+ /* remember the directory */
+ char *new_dir = realloc(save_dir, (lastdot+1)-sp);
+ if (new_dir) {
+ save_dir_len = lastdot - sp;
+ memcpy(new_dir, sp, save_dir_len);
+ new_dir[save_dir_len] = '\0';
+ save_dir = new_dir;
+ }
}
}