Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 8277 → Rev 8278

/programs/cmm/browser/buidin_pages/page_not_found_en.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages/help_en.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages/homepage_ru.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages/page_not_found_ru.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages/help_ru.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages/homepage_en.htm
File deleted
\ No newline at end of file
/programs/cmm/browser/buidin_pages
Property changes:
Deleted: tsvn:logminsize
-5
\ No newline at end of property
/programs/cmm/browser/download_manager.h
File deleted
\ No newline at end of file
/programs/cmm/browser/editbox_icons.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programs/cmm/browser/editbox_icons.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programs/cmm/browser/WebView.c
30,14 → 30,15
#include "..\lib\patterns\toolbar_button.h"
#include "..\lib\patterns\restart_process.h"
 
char editbox_icons[] = FROM "res/editbox_icons.raw";
 
#define URL_SIZE 4000
 
char version[]="WebView 2.65b";
char version[]="WebView 2.66";
 
#include "texts.h"
#include "cache.h"
#include "show_src.h"
#include "download_manager.h"
 
bool debug_mode = false;
 
101,8 → 102,6
edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff,
0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19};
 
char editbox_icons[] = FROM "editbox_icons.raw";
 
dword shared_url;
 
dword http_get_type;
120,17 → 119,10
 
void HandleParam()
{
if (param) {
if (!strncmp(#param, "-download_and_exit ", 19)) {
download_and_exit = true;
strcpy(#downloader_edit, #param+19);
Downloader();
ExitProcess();
} else if (!strncmp(#param, "-download ", 10)) {
strcpy(#downloader_edit, #param+10);
Downloader();
ExitProcess();
} else if (!strncmp(#param, "-source ", 8)) {
if (!param) {
history.add(URL_SERVICE_HOMEPAGE);
} else {
if (!strncmp(#param, "-source ", 8)) {
source_mode = true;
history.add(#param + 8);
} else if (!strncmp(#param, "-new ", 5)) {
144,8 → 136,6
ExitProcess();
}
}
} else {
history.add(URL_SERVICE_HOMEPAGE);
}
shared_url = memopen(#webview_shared, URL_SIZE+1, SHM_CREATE + SHM_WRITE);
ESDWORD[shared_url] = '\0';
155,7 → 145,6
{
int i, redirect_count=0;
LoadLibraries();
CreateDir("/tmp0/1/Downloads");
//CreateDir("/tmp0/1/WebView_Cache");
HandleParam();
WB1.list.SetFont(8, 14, 10011000b);
438,10 → 427,7
OpenPage(URL_SERVICE_HISTORY);
return;
case DOWNLOAD_MANAGER:
if (!downloader_opened) {
downloader_edit = NULL;
CreateThread(#Downloader,#downloader_stak+4092);
}
EventOpenDownloader("");
return;
case UPDATE_BROWSER:
EventUpdateBrowser();
462,11 → 448,7
notify("'URL copied to clipboard'O");
return;
case DOWNLOAD_LINK_CONTENTS:
if (!downloader_opened) {
id__ = GetAbsoluteActiveURL();
strcpy(#downloader_edit, id__);
CreateThread(#Downloader,#downloader_stak+4092);
}
EventOpenDownloader( GetAbsoluteActiveURL() );
return;
case OPEN_FILE:
EventOpenDialog();
594,10 → 576,10
 
} else if (!strncmp(#new_url,"WebView:",8)) {
//INTERNAL PAGE
if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buidin_page_home, sizeof(buidin_page_home));
else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buidin_page_help, sizeof(buidin_page_help));
if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home));
else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buildin_page_help, sizeof(buildin_page_help));
else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory();
else LoadInternalPage(#buidin_page_error, sizeof(buidin_page_error));
else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
 
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
//WEB PAGE
618,7 → 600,7
 
if (!http.transfer) {
StopLoading();
LoadInternalPage(#buidin_page_error, sizeof(buidin_page_error));
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
}
} else {
//LOCAL PAGE
630,11 → 612,16
strcpy(#new_url, "/tmp0/1/temp/word/document.xml");
}
if (!GetLocalFileData(#new_url)) {
LoadInternalPage(#buidin_page_error, sizeof(buidin_page_error));
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
}
}
}
 
dword EventOpenDownloader(dword _url)
{
//char download_params[URL_SIZE+50];
return RunProgram("/sys/network/dl", _url);
}
 
bool EventClickAnchor()
{
720,11 → 707,7
if (UrlExtIs(#new_url,".png")==true) || (UrlExtIs(#new_url,".jpg")==true)
|| (UrlExtIs(#new_url,".zip")==true) || (UrlExtIs(#new_url,".kex")==true) || (UrlExtIs(#new_url,".pdf")==true)
|| (UrlExtIs(#new_url,".7z")==true) {
if (!downloader_opened) {
strcpy(#downloader_edit, #new_url);
CreateThread(#Downloader,#downloader_stak+4092);
}
else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
EventOpenDownloader(#new_url);
return;
}
}
747,7 → 730,7
 
void LoadInternalPage(dword _bufdata, _in_bufsize){
if (!_bufdata) || (!_in_bufsize) {
LoadInternalPage(#buidin_page_error, sizeof(buidin_page_error));
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
} else {
WB1.list.first = 0; //scroll page to the top
DrawOmnibox();
892,7 → 875,7
 
draw_window();
 
downloader_id = RunProgram(#program_path, #update_param);
downloader_id = EventOpenDownloader(#update_param);
do {
slot_n = GetProcessSlot(downloader_id);
pause(10);
/programs/cmm/browser/res/editbox_icons.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/cmm/browser/res/editbox_icons.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/cmm/browser/res/help_en.htm
0,0 → 1,28
<html>
<head>
<meta charset="uft">
<title>WebView Help</title>
</head>
<body>
 
<h1>WebView Text-Based Browser</h1>
 
It is free and open-source. If you have any suggestions or want to help improving it please visit its topic at <a href="http://board.kolibrios.org/viewtopic.php?f=40&amp;t=1075">board.kolibrios.org</a><pre>
 
<b>Shortcut keys</b>
 
<font bg="#C7CEE4">[CTRL + N or CTRL + T]</font> New window
<font bg="#C7CEE4">[CTRL + R or F5]</font> Refresh the current page
<font bg="#C7CEE4">[CTRL + O]</font> Start OpenDialog to open local file
<font bg="#C7CEE4">[CTRL + U]</font> View a web page's source code
<font bg="#C7CEE4">[CTRL + H]</font> Open browser history
<font bg="#C7CEE4">[CTRL + J]</font> Display the file downloader
<font bg="#C7CEE4">[CTRL + W]</font> Exit browser
<font bg="#C7CEE4">[CTRL + ENTER]</font> Submit a web search
<font bg="#C7CEE4">[CTRL + LEFT]</font> Back a page.
<font bg="#C7CEE4">[CTRL + RIGHT]</font> Forward a page.
<font bg="#C7CEE4">[F6]</font> Moves a text cursor to the omnibox
 
</pre>
</body>
</html>
/programs/cmm/browser/res/homepage_en.htm
0,0 → 1,21
<html>
<head>
<meta charset="uft">
<title>Homepage</title>
</head>
<body><pre>Bookmarks:
1. <a href="http://kolibrios.org" id="valera">KolibriOS homepage</a>
2. <a href="http://kolibri-n.org" id="hodor">KolibriN homepage</a>
3. <a href="http://store.kolibri-n.org">Kolibri Stuff</a>
 
<font bg=#F8F15B>By the way,</font>
<font color="#555555">&bull; You can check for browser updates from the main menu.
&bull; To run a web search, type a text in the adress box and press Ctrl+Enter.
&bull; You can also use other <a href="WebView:help"><font color="#555555">Hotkeys</font></a>.
&bull; Click on a label in the bottom right corner to change the encoding of a page.
</font>
 
 
</pre>
</body>
</html>
/programs/cmm/browser/res/homepage_ru.htm
0,0 → 1,20
<html>
<head>
<meta charset="cp-866">
<title>„®¬ è­ïï áâà ­¨æ </title>
</head>
<body><pre>‡ ª« ¤ª¨:
1. <a href="http://kolibrios.org" id="valera">„®¬ è­ïï áâà ­¨æ  KolibriOS</a>
2. <a href="http://kolibri-n.org" id="hodor">KolibriN10</a>
3. <a href="http://store.kolibri-n.org">Kolibri Store</a>
 
<font bg=#F8F15B>Šáâ â¨,</font>
<font color="#555555">&bull; ˆ§ £« ¢­®£® ¬¥­î ¬®¦­® ¯à®¢¥à¨âì ­ «¨ç¨¥ ®¡­®¢«¥­¨©
&bull; „«ï ¯®¨áª  ¢ Google ­ ¡¥à¨â¥ â¥áâ ¢  ¤à¥á­®© áâப¥ ¨ ­ ¦¬¨â¥ Ctrl+Enter
&bull; …áâì â ª¦¥ ¤à㣨¥ <a href="WebView:help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.
&bull; Œ®¦­® ¨§¬¥­¨âì ª®¤¨à®¢ªã áâà ­¨æë, ¤«ï í⮣® ­ ¦¬¨â¥ ­  ­ ¤¯¨áì ¢ ¯à ¢®¬ ­¨¦­¥¬ 㣫㠮ª­ .
</font>
 
</pre>
</body>
</html>
/programs/cmm/browser/res/help_ru.htm
0,0 → 1,24
<html>
<head>
<meta charset="cp-866">
<title>‘¯à ¢ª  WebView</title>
</head>
<body><pre><h1>‘¯à ¢ª  WebView</h1>
 
<b>Š« ¢¨è¨ ¡ëáâண® ¢ë§®¢ </b>
 
<font bg="#C7CEE4">[CTRL + N ¨«¨ CTRL + T]</font> ®¢®¥ ®ª­®
<font bg="#C7CEE4">[CTRL + R ¨«¨ F5]</font> ¥à¥§ £à㧨âì áâà ­¨æã
<font bg="#C7CEE4">[CTRL + O]</font> ‚맢 âì ¤¨ «®£ ¢ë¡®à  ä ©« 
<font bg="#C7CEE4">[CTRL + U]</font> ‘¬®âà¥âì ¨á室­ë© ª®¤ áâà ­¨æë
<font bg="#C7CEE4">[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥­­ëå áâà ­¨æ
<font bg="#C7CEE4">[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
<font bg="#C7CEE4">[CTRL + W]</font> ‡ ªàëâì ¡à ã§¥à
<font bg="#C7CEE4">[CTRL + ENTER]</font> ®¨áª ¢ ¨­â¥à­¥â¥ á ¯®¬®éìî Google
<font bg="#C7CEE4">[CTRL + ‚‹…‚Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ " § ¤" ¢ ¡à ã§¥à¥
<font bg="#C7CEE4">[CTRL + ‚€‚Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ "‚¯¥à¥¤"
<font bg="#C7CEE4">[F6]</font> ¥à¥¬¥é ¥â ⥪áâ®¢ë© ªãàá®à ¢ ®¬­¨¡®ªá
 
</pre>
</body>
</html>
/programs/cmm/browser/res/page_not_found_ru.htm
0,0 → 1,27
<html>
<head>
<meta charset="cp-866">
<title>‘âà ­¨æ  ­¥ ­ ©¤¥­ </title>
</head>
<body>
<h1>&nbsp;‚¥¡-áâà ­¨æ  ­¥¤®áâ㯭 </h1>
<h2>&nbsp;—â® ¬®¦­® ᤥ« âì:</h2>
<ul>
<li>
“¡¥¤¨â¥áì, çâ® ¥áâì ¯®¤ª«î祭¨¥ ª á¥â¨ ˆ­â¥à­¥â.<br>
Žâªà®©â¥ <a href="/sys/network/netcfg">Netcfg</a> ¤«ï ¤¨ £­®á⨪¨ á¥â¨.<br>
</li>
<li>
à®¢¥àì⥠ ¤à¥áá áâà ­¨æë, ¢®§¬®¦­®, ¡ë«  ᤥ« ­  ®¯¥ç âª .<br>
</li>
<li>
‘¥à¢¥à ¢à¥¬¥­­® ­¥¤®áâ㯥­. <br>
Ž¡­®¢¨â¥ áâà ­¨æã.<br>
</li>
<li>
’¥ªáâ®¢ë© ¡à ã§¥à ­¥ ¯à ¢¨«ì­® ®¡à ¡®â « ®â¢¥â á¥à¢¥à .<br>
‘®®¡é¨â¥ ®¡ ®è¨¡ª¥.<br>
</li>
</ul>
</body>
</html>
/programs/cmm/browser/res/page_not_found_en.htm
0,0 → 1,27
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=cp-866" />
<title>Page not found</title>
</head>
<body>
<h1>&nbsp;Webpage Not Available</h1>
<h2>&nbsp;What could be done:</h2>
<ul>
<li>
Make sure that evetything fine with Internet connection.<br>
Open <a href="/sys/network/netcfg">Netcfg</a> network diagnostic tool.<br>
</li>
<li>
Check page address, there may have been made a typo.<br>
</li>
<li>
Server is temporarily unavailable.<br>
Refresh the page.<br>
</li>
<li>
Browser doesn't handled properly server's response.<br>
Please, report an error.<br>
</li>
</ul>
</body>
</html>
/programs/cmm/browser/res
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property
/programs/cmm/browser/texts.h
1,7 → 1,7
#ifdef LANG_RUS
char buidin_page_error[] = FROM "buidin_pages\\page_not_found_ru.htm""\0";
char buidin_page_home[] = FROM "buidin_pages\\homepage_ru.htm""\0";
char buidin_page_help[] = FROM "buidin_pages\\help_ru.htm""\0";
char buildin_page_error[] = FROM "res/page_not_found_ru.htm""\0";
char buildin_page_home[] = FROM "res/homepage_ru.htm""\0";
char buildin_page_help[] = FROM "res/help_ru.htm""\0";
char accept_language[]= "Accept-Language: ru\n";
char rmb_menu[] =
"®á¬®âà¥âì ¨á室­¨ª|Ctrl+U
22,7 → 22,7
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
char loading_text[] = "‡ £à㧪 ...";
 
char update_param[] = "-download_and_exit http://builds.kolibrios.org/rus/data/programs/cmm/browser/WebView.com";
char update_param[] = "-exit http://builds.kolibrios.org/rus/data/programs/cmm/browser/WebView.com";
char update_download_error[] = "'WebView\nŽè¨¡ª  ¯à¨ ¯®«ã祭¨¨ ®¡­®¢«¥­¨©!' -tE";
char update_ok[] = "'WebView\nà ã§¥à ¡ë« ãᯥ譮 ®¡­®¢«¥­!' -tO";
char update_is_current[] = "'WebView\n‚ë 㦥 ¨á¯®«ì§ã¥â¥ ¯®á«¥¤­îî ¢¥àá¨î.' -tI";
29,9 → 29,9
char update_can_not_copy[] = "'WebView\n¥ ¬®£ã ¯¥à¥¬¥áâ¨âì ­®¢ãî ¢¥àá¨î ¨§ ¯ ¯ª¨ Downloads ­  Ramdisk. ‚®§¬®¦­®, ­¥ ¤®áâ â®ç­® ¬¥áâ .' -tE";
char clear_cache_ok[] = "'WebView\nŠíè ®ç¨é¥­.' -tI";
#else
char buidin_page_error[] = FROM "buidin_pages\\page_not_found_en.htm""\0";
char buidin_page_home[] = FROM "buidin_pages\\homepage_en.htm""\0";
char buidin_page_help[] = FROM "buidin_pages\\help_en.htm""\0";
char buildin_page_error[] = FROM "res/page_not_found_en.htm""\0";
char buildin_page_home[] = FROM "res/homepage_en.htm""\0";
char buildin_page_help[] = FROM "res/help_en.htm""\0";
char accept_language[]= "Accept-Language: en\n";
char rmb_menu[] =
"View source|Ctrl+U
51,7 → 51,7
Copy link
Download link contents";
char loading_text[] = "Loading...";
char update_param[] = "-download_and_exit http://builds.kolibrios.org/eng/data/programs/cmm/browser/WebView.com";
char update_param[] = "-exit http://builds.kolibrios.org/eng/data/programs/cmm/browser/WebView.com";
char update_download_error[] = "'WebView\nError receiving an up to date information!' -tE";
char update_ok[] = "'WebView\nThe browser has been updated!' -tO";
char update_is_current[] = "'WebView\nThe browser is up to date.' -tI";
/programs/cmm/downloader/const.h
0,0 → 1,38
//Copyright 2020 by Leency
 
#ifndef AUTOBUILD
#include "lang.h--"
#endif
 
#ifdef LANG_RUS
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
#define START_DOWNLOADING " ç âì § ª çªã"
#define STOP_DOWNLOADING "Žâ¬¥­ "
#define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt"
#define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì å®à ­¥­ ª ª\n%s' -Et"
#define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥... %s ¯®«ã祭®"
#define T_ERROR_STARTING_DOWNLOAD "'¥¢®§¬®¦­® ­ ç âì ᪠稢 ­¨¥.\n®¦ «ã©áâ , ¯à®¢¥àì⥠¢¢¥¤¥­­ë© ¯ãâì ¨ ᮥ¤¨­¥­¨¥ á ˆ­â¥à­¥â®¬.' -E"
char accept_language[]= "Accept-Language: ru\n";
#else
#define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading"
#define STOP_DOWNLOADING "Cancel"
#define SHOW_IN_FOLDER "Show in folder"
#define OPEN_FILE_TEXT "Open file"
#define FILE_SAVED_AS "'Download manager\nFile saved as %s' -Dt"
#define FILE_NOT_SAVED "'Download manager\nError! Can\96t save file as %s' -Et"
#define KB_RECEIVED "Downloading... %s received"
#define T_ERROR_STARTING_DOWNLOAD "'Error while starting download process.\nPlease, check entered path and Internet connection.' -E"
char accept_language[]= "Accept-Language: en\n";
#endif
 
#define GAPX 15
#define WIN_W 580
#define WIN_H 100
 
#define URL_SIZE 4000
 
char save_to[] = "/tmp0/1/Downloads";
char dl_shared[] = "DL";
/programs/cmm/downloader/dl.c
0,0 → 1,242
//Copyright 2020 by Leency
 
#define MEMSIZE 1024 * 100
#include "../lib/gui.h"
#include "../lib/random.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/http.h"
#include "../lib/patterns/http_downloader.h"
 
#include "const.h"
 
DOWNLOADER downloader;
 
char downloader_edit[4000];
char filepath[4096];
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,
sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19};
progress_bar pb = {0, GAPX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
bool exit_when_done = false;
 
void main()
{
dword shared_url;
load_dll(boxlib, #box_lib_init,0);
load_dll(libHTTP, #http_lib_init,1);
 
if (!dir_exists(#save_to)) CreateDir(#save_to);
 
if (param) {
if (!strncmp(#param, "-exit ", 6)) {
exit_when_done = true;
param += 6;
}
 
if (!strncmp(#param, "-mem", 5)) {
shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
strcpy(#downloader_edit, shared_url);
} else {
strcpy(#downloader_edit, #param);
}
}
if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://");
ed.size = ed.pos = ed.shift = ed.shift_old = strlen(#downloader_edit);
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
@SetWindowLayerBehaviour(-1, ZPOS_ALWAYS_TOP);
loop() switch(@WaitEvent())
{
case evMouse:
edit_box_mouse stdcall (#ed);
break;
 
case evButton:
ProcessEvent(GetButtonID());
break;
 
case evKey:
GetKeys();
edit_box_key stdcall(#ed);
if (key_scancode==SCAN_CODE_ENTER) ProcessEvent(301);
break;
 
case evReDraw:
DrawWindow();
break;
default:
if (!downloader.MonitorProgress()) break;
pb.max = downloader.httpd.content_length / 100;
EDI = downloader.httpd.content_received/100;
if (pb.value != EDI)
{
pb.value = EDI;
progressbar_draw stdcall(#pb);
DrawDownloading();
}
if (downloader.state == STATE_COMPLETED)
{
SaveDownloadedFile();
if (exit_when_done) ExitProcess();
StopDownloading();
DrawWindow();
break;
}
}
}
void ProcessEvent(int id)
{
if (id==001) { StopDownloading(); ExitProcess(); }
if (id==301) && (downloader.httpd.transfer <= 0) StartDownloading();
if (id==302) StopDownloading();
if (id==305) RunProgram("/sys/File managers/Eolite", #filepath);
if (id==306) {
SetCurDir(#save_to);
RunProgram("/sys/@open", #filepath);
}
}
void DrawWindow()
{
int but_x = 0;
int but_y = 58;
 
sc.get();
pb.frame_color = sc.work_dark;
DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9, WIN_H + 5 + skin_height, 0x34, sc.work, DL_WINDOW_HEADER, 0);
 
if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED)
{
but_x = GAPX + DrawStandartCaptButton(GAPX, but_y, 301, START_DOWNLOADING);
if (filepath[0])
{
but_x += DrawStandartCaptButton(but_x, but_y, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, but_y, 306, OPEN_FILE_TEXT);
}
}
if (downloader.state == STATE_IN_PROGRESS)
{
DrawStandartCaptButton(WIN_W - 190, but_y, 302, STOP_DOWNLOADING);
DrawDownloading();
}
ed.offset=0;
DrawEditBox(#ed);
}
void StartDownloading()
{
char http_url[URL_SIZE];
char proxy_url[URL_SIZE];
StopDownloading();
if (!strncmp(#downloader_edit,"https://",7)) {
notify("'HTTPS for download is not supported, trying to download the file via HTTP' -W");
miniprintf(#http_url, "http://%s", #downloader_edit+8);
if (!downloader.Start(#http_url)) {
notify("'Download failed.' -E");
StopDownloading();
}
//sprintf(#proxy_url, "http://gate.aspero.pro/?site=%s", #downloader_edit);
//if (!downloader.Start(#proxy_url)) {
// notify("'Download failed.' -E");
// StopDownloading();
//}
DrawWindow();
return;
}
if (!downloader.Start(#downloader_edit)) {
if (exit_when_done) ExitProcess();
notify(T_ERROR_STARTING_DOWNLOAD);
StopDownloading();
return;
}
ed.blur_border_color = 0xCACACA;
ed.flags = 100000000000b;
pb.value = 0;
DrawWindow();
}
 
/*
struct TIME
{
dword old;
dword cur;
dword gone;
} time = {0,0,0};
 
dword netdata_received;
dword speed;
 
void CalculateSpeed()
{
time.cur = GetStartTime();
 
if (time.old) {
time.gone = time.cur - time.old;
if (time.gone > 200) {
speed = downloader.httpd.content_received - netdata_received / time.gone * 100;
debugval("speed", speed);
debugln(ConvertSizeToKb(speed) );
time.old = time.cur;
netdata_received = downloader.httpd.content_received;
}
}
else time.old = time.cur;
}
*/
void DrawDownloading()
{
char bytes_received[70];
miniprintf(#bytes_received, KB_RECEIVED, ConvertSizeToKb(downloader.httpd.content_received) );
WriteTextWithBg(GAPX, pb.top + 22, 0xD0, sc.work_text, #bytes_received, sc.work);
//CalculateSpeed();
progressbar_draw stdcall(#pb);
}
void StopDownloading()
{
downloader.Stop();
ed.blur_border_color = 0xFFFfff;
ed.flags = 10b;
DrawWindow();
}
 
void SaveDownloadedFile()
{
int i;
char aux[2048];
char notify_message[4296];
 
// Clean all slashes at the end
strcpy(#aux, #downloader_edit);
while (aux[strlen(#aux)-1] == '/') {
aux[strlen(#aux)-1] = 0;
}
 
//miniprintf(#filepath, "%s/", #save_to);
strcpy(#filepath, #save_to);
chrcat(#filepath, '/');
strcat(#filepath, #aux+strrchr(#aux, '/'));
for (i=0; i<strlen(#filepath); i++) if(filepath[i]==':')||(filepath[i]=='?')filepath[i]='-';
 
if (CreateFile(downloader.httpd.content_received, downloader.bufpointer, #filepath)==0) {
miniprintf(#notify_message, FILE_SAVED_AS, #filepath);
} else {
miniprintf(#notify_message, FILE_NOT_SAVED, #filepath);
}
 
/*
if (CreateFile(downloader.httpd.content_received, downloader.bufpointer, #filepath)==0) {
strcpy(#notify_message, "'Download complete' -Dt");
} else {
strcpy(#notify_message, "'Error saving downloaded file!' -Et");
}
*/
if (!exit_when_done) notify(#notify_message);
}
/programs/cmm/installer/install.c
37,6 → 37,7
#endif
 
#define B_INSTALL 10
#define B_EXIT 11
 
bool install_complete = false;
 
50,8 → 51,8
{
case evButton:
btn = GetButtonID();
if (btn == 1) ExitProcess();
if (btn == B_INSTALL) EventInstall();
if (btn == 1) || (B_EXIT == btn) ExitProcess();
if (B_INSTALL == btn) EventInstall();
break;
case evKey:
96,7 → 97,7
{
DrawIcon32(WINW-32/2, 140, sc.work, 49);
WriteTextCenter(0,185, WINW, sc.work_text, T_COMPLETE);
DrawCaptButton(WINW-110/2, WINH-70, 110, 28, CLOSE_BTN,
DrawCaptButton(WINW-110/2, WINH-70, 110, 28, B_EXIT,
0x0092D8, 0xFFFfff, T_EXIT);
}
 
/programs/cmm/lib/strings.h
842,6 → 842,16
return ret;
}
 
void miniprintf(dword dst, format, insert_line)
{
dword in_pos = strchr(format, '%');
if (ESBYTE[in_pos+1] == 's') {
strlcpy(dst, format, in_pos - format);
strcat(dst, insert_line);
strcat(dst, in_pos+2);
}
}
 
inline cdecl int sprintf(dword buf, format,...)
{
#define END_ARGS 0xFF00FF //ARGS FUNCTION