Subversion Repositories Kolibri OS

Rev

Rev 8490 | Rev 8499 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8490 Rev 8492
Line 229... Line 229...
229
				redirect_count = 0;
229
				redirect_count = 0;
230
				http.hfree();
230
				http.hfree();
231
				if (http_get_type==PAGE) {
231
				if (http_get_type==PAGE) {
232
					history.add(http.cur_url);
232
					history.add(http.cur_url);
233
					if (!strchr(http.cur_url, '?')) {
233
					if (!strchr(http.cur_url, '?')) {
234
						cache.add(http.cur_url, http.content_pointer, http.content_received, PAGE);
234
						cache.add(http.cur_url, http.content_pointer, http.content_received, PAGE, WB1.custom_encoding);
235
					}
235
					}
236
					LoadInternalPage(http.content_pointer, http.content_received);
236
					LoadInternalPage(http.content_pointer, http.content_received);
237
					free(http.content_pointer);
237
					free(http.content_pointer);
238
				}
238
				}
239
				else if (http_get_type==IMG) {
239
				else if (http_get_type==IMG) {
240
					_IMG_RES:
240
					_IMG_RES:
241
					if (http.status_code >= 200) && (http.status_code < 300) {
241
					if (http.status_code >= 200) && (http.status_code < 300) {
242
						cache.add(cur_img_url, http.content_pointer, http.content_received, IMG);
242
						cache.add(cur_img_url, http.content_pointer, http.content_received, IMG, NULL);
243
					} else {
243
					} else {
244
						cache.add(cur_img_url, 0, 0, IMG);
244
						cache.add(cur_img_url, 0, 0, IMG, NULL);
245
					}
245
					}
246
					free(http.content_pointer);
246
					free(http.content_pointer);
247
					GetImg(false);
247
					GetImg(false);
248
				}
248
				}
249
			}
249
			}
Line 269... Line 269...
269
	switch (id__)
269
	switch (id__)
270
	{
270
	{
271
		case 1: ExitProcess();
271
		case 1: ExitProcess();
272
		case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: EventTabClose(id__ - TAB_CLOSE_ID); return;
272
		case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: EventTabClose(id__ - TAB_CLOSE_ID); return;
273
		case TAB_ID...TAB_ID+TABS_MAX: EventAllTabsClick(id__ - TAB_ID); return;
273
		case TAB_ID...TAB_ID+TABS_MAX: EventAllTabsClick(id__ - TAB_ID); return;
274
		case ENCODINGS...ENCODINGS+6: EventChangeEncodingAndLoadPage(id__-ENCODINGS); return;
274
		case ENCODINGS...ENCODINGS+6: EventManuallyChangeEncoding(id__-ENCODINGS); return;
275
		case NEW_WINDOW:       RunProgram(#program_path, NULL); return;
275
		case NEW_WINDOW:       RunProgram(#program_path, NULL); return;
276
		case NEW_TAB:          if (!http.transfer) EventOpenNewTab(URL_SERVICE_HOMEPAGE); return;
276
		case NEW_TAB:          if (!http.transfer) EventOpenNewTab(URL_SERVICE_HOMEPAGE); return;
277
		case SCAN_CODE_BS:
277
		case SCAN_CODE_BS:
278
		case BACK_BUTTON:      if (history.back()) OpenPage(history.current()); return;
278
		case BACK_BUTTON:      if (history.back()) OpenPage(history.current()); return;
279
		case FORWARD_BUTTON:   if (history.forward()) OpenPage(history.current()); return;
279
		case FORWARD_BUTTON:   if (history.forward()) OpenPage(history.current()); return;
Line 376... Line 376...
376
	DrawProgress();
376
	DrawProgress();
377
	DrawStatusBar(NULL);
377
	DrawStatusBar(NULL);
378
	DrawTabsBar();
378
	DrawTabsBar();
379
}
379
}
Line 380... Line 380...
380
 
380
 
381
void EventChangeEncodingAndLoadPage(int _new_encoding)
381
void EventManuallyChangeEncoding(int _new_encoding)
382
{
382
{
383
	dword newbuf, newsize;
383
	dword newbuf, newsize;
384
	WB1.custom_encoding = _new_encoding;
384
	WB1.custom_encoding = _new_encoding;
385
	newsize = strlen(WB1.o_bufpointer);
385
	newsize = strlen(WB1.o_bufpointer);
Line 533... Line 533...
533
 
533
 
534
	if (cache.has(#new_url)) {
534
	if (cache.has(#new_url)) {
535
		//CACHED PAGE
535
		//CACHED PAGE
536
		if (cache.current_type==PAGE) {
536
		if (cache.current_type==PAGE) {
-
 
537
			history.add(#new_url);
537
			history.add(#new_url);
538
			WB1.custom_encoding = cache.current_charset;
538
			LoadInternalPage(cache.current_buf, cache.current_size);
539
			LoadInternalPage(cache.current_buf, cache.current_size);
539
		}
540
		}
540
		else {
541
		else {
541
			EventDownloadAndOpenImage(#new_url);
542
			EventDownloadAndOpenImage(#new_url);
Line 542... Line 543...
542
		}
543
		}
543
 
544
 
544
	} else if (!strncmp(#new_url,"WebView:",8)) {
545
	} else if (!strncmp(#new_url,"WebView:",8)) {
-
 
546
		//INTERNAL PAGE
545
		//INTERNAL PAGE
547
		history.add(#new_url);
546
		history.add(#new_url);
548
		WB1.custom_encoding = -1;
547
		if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home));
549
		if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home));
548
		else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buildin_page_help, sizeof(buildin_page_help));
550
		else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buildin_page_help, sizeof(buildin_page_help));
549
		else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test));
551
		else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test));
Line 772... Line 774...
772
}
774
}
Line 773... Line 775...
773
 
775
 
774
void EventSeachWeb()
776
void EventSeachWeb()
775
{
777
{
776
	char new_url[URL_SIZE+1];
778
	char new_url[URL_SIZE+1];
777
	replace_char(#editURL, ' ', '_', URL_SIZE);
779
	replace_char(#editURL, ' ', '+', URL_SIZE);
778
	strcpy(#new_url, "https://www.google.com/search?q=");
780
	strcpy(#new_url, "https://www.google.com/search?q=");
779
	strncat(#new_url, #editURL, URL_SIZE);
781
	strncat(#new_url, #editURL, URL_SIZE);
780
	OpenPage(#new_url);
782
	OpenPage(#new_url);
Line 888... Line 890...
888
void CheckContentType()
890
void CheckContentType()
889
{
891
{
890
	char content_type[64];
892
	char content_type[64];
891
	if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image
893
	if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image
Line -... Line 894...
-
 
894
 
-
 
895
	if (strchr(#content_type, '=')) {
-
 
896
		WB1.custom_encoding = get_encoding_type_by_name(EAX+1);	
-
 
897
	}
892
 
898
 
893
	if (content_type[0] == 'i') {
899
	if (content_type[0] == 'i') {
894
		EventDownloadAndOpenImage(http.cur_url);
900
		EventDownloadAndOpenImage(http.cur_url);
895
		StopLoading();
901
		StopLoading();
896
	}if (content_type[0] == 'a') { 
902
	}if (content_type[0] == 'a') {