Esempio n. 1
0
void ro_gui_drag_save_link(gui_save_type save_type, const char *url,
		const char *title, struct gui_window *g)
{
	wimp_pointer pointer;
	char icon_buf[20];
	os_error *error;

	/* Close the save window because otherwise we need two contexts
	*/
	xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
	ro_gui_dialog_close(dialog_saveas);

	gui_save_url = url;
	gui_save_title = title;
	gui_save_sourcew = g->window;
	saving_from_dialog = false;

	error = xwimp_get_pointer_info(&pointer);
	if (error) {
		LOG(("xwimp_get_pointer_info: 0x%x: %s",
				error->errnum, error->errmess));
		warn_user("WimpError", error->errmess);
		return;
	}

	ro_gui_save_set_state(NULL, save_type, url, save_leafname, icon_buf);

	gui_current_drag_type = GUI_DRAG_SAVE;

	ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
}
Esempio n. 2
0
void ro_gui_save_prepare(gui_save_type save_type, hlcache_handle *h,
		struct selection *s, const char *url, const char *title)
{
	char name_buf[FILENAME_MAX];
	size_t leaf_offset = 0;
	char icon_buf[20];

	assert( (save_type == GUI_SAVE_LINK_URI) ||
			(save_type == GUI_SAVE_LINK_URL) ||
			(save_type == GUI_SAVE_LINK_TEXT) ||
			(save_type == GUI_SAVE_HOTLIST_EXPORT_HTML) ||
			(save_type == GUI_SAVE_HISTORY_EXPORT_HTML) ||
			(save_type == GUI_SAVE_TEXT_SELECTION) || h);

	gui_save_selection = s;
	gui_save_url = url;
	gui_save_title = title;

	if (save_dir) {
		leaf_offset = save_dir_len;
		memcpy(name_buf, save_dir, leaf_offset);
		name_buf[leaf_offset++] = '.';
	}

	ro_gui_save_set_state(h, save_type, h ? content_get_url(h) : url,
			name_buf + leaf_offset, icon_buf);

	ro_gui_set_icon_sprite(dialog_saveas, ICON_SAVE_ICON, saveas_area,
			icon_buf);

	ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_PATH, name_buf, true);
	ro_gui_wimp_event_memorise(dialog_saveas);
}
Esempio n. 3
0
void gui_drag_save_object(gui_save_type save_type, hlcache_handle *c,
		struct gui_window *g)
{
	wimp_pointer pointer;
	char icon_buf[20];
	os_error *error;

	/* Close the save window because otherwise we need two contexts
	*/
	xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
	ro_gui_dialog_close(dialog_saveas);

	gui_save_sourcew = g->window;
	saving_from_dialog = false;

	error = xwimp_get_pointer_info(&pointer);
	if (error) {
		LOG(("xwimp_get_pointer_info: 0x%x: %s",
				error->errnum, error->errmess));
		warn_user("WimpError", error->errmess);
		return;
	}

	ro_gui_save_set_state(c, save_type, nsurl_access(hlcache_handle_get_url(c)),
			save_leafname, LEAFNAME_MAX,
			icon_buf, sizeof(icon_buf));

	gui_current_drag_type = GUI_DRAG_SAVE;

	ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
}
Esempio n. 4
0
/**
 * Prepares the save box to reflect gui_save_type and a content, and
 * opens it.
 *
 * \param  save_type  type of save
 * \param  h          content to save
 * \param  s          selection to save
 * \param  url        url to be saved (link types)
 * \param  title      title (if any), when saving links
 */
void ro_gui_save_prepare(gui_save_type save_type, struct hlcache_handle *h,
		char *s, const nsurl *url, const char *title)
{
	char name_buf[FILENAME_MAX];
	size_t leaf_offset = 0;
	char icon_buf[20];

	assert( (save_type == GUI_SAVE_LINK_URI) ||
			(save_type == GUI_SAVE_LINK_URL) ||
			(save_type == GUI_SAVE_LINK_TEXT) ||
			(save_type == GUI_SAVE_HOTLIST_EXPORT_HTML) ||
			(save_type == GUI_SAVE_HISTORY_EXPORT_HTML) ||
			(save_type == GUI_SAVE_TEXT_SELECTION) || h);

	if (gui_save_selection == NULL)
		free(gui_save_selection);

	gui_save_selection = s;
	if (url != NULL) {
		gui_save_url = nsurl_access(url);
	} else {
		gui_save_url = NULL;
	}
	gui_save_title = title;

	if (save_dir) {
		leaf_offset = save_dir_len;
		memcpy(name_buf, save_dir, leaf_offset);
		name_buf[leaf_offset++] = '.';
	}

	if (h != NULL) {
		url = hlcache_handle_get_url(h);
	}

	ro_gui_save_set_state(h, save_type, url,
			name_buf + leaf_offset, FILENAME_MAX - leaf_offset,
			icon_buf, sizeof(icon_buf));

	ro_gui_set_icon_sprite(dialog_saveas, ICON_SAVE_ICON, saveas_area,
			icon_buf);

	ro_gui_set_icon_string(dialog_saveas, ICON_SAVE_PATH, name_buf, true);
	ro_gui_wimp_event_memorise(dialog_saveas);
}
Esempio n. 5
0
void gui_drag_save_selection(struct selection *s, struct gui_window *g)
{
	wimp_pointer pointer;
	char icon_buf[20];
	os_error *error;

	/* Close the save window because otherwise we need two contexts
	*/
	xwimp_create_menu(wimp_CLOSE_MENU, 0, 0);
	ro_gui_dialog_close(dialog_saveas);

	gui_save_sourcew = g->window;
	saving_from_dialog = false;

	error = xwimp_get_pointer_info(&pointer);
	if (error) {
		LOG(("xwimp_get_pointer_info: 0x%x: %s",
				error->errnum, error->errmess));
		warn_user("WimpError", error->errmess);
		return;
	}


	if (gui_save_selection == NULL)
		free(gui_save_selection);

	gui_save_selection = selection_get_copy(s);

	ro_gui_save_set_state(NULL, GUI_SAVE_TEXT_SELECTION, NULL,
			save_leafname, LEAFNAME_MAX,
			icon_buf, sizeof(icon_buf));

	gui_current_drag_type = GUI_DRAG_SAVE;

	ro_gui_drag_icon(pointer.pos.x, pointer.pos.y, icon_buf);
}