diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 0f53bab2e3..b44efc617d 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -30,6 +30,7 @@ #include "..\lib\patterns\toolbar_button.h" #include "show_src.h" +bool download_and_exit = false; #include "download_manager.h" _history history; #include "history.h" @@ -72,6 +73,7 @@ enum { NEW_WINDOW, VIEW_HISTORY, DOWNLOAD_MANAGER, + UPDATE_BROWSER, COPY_LINK_URL, DOWNLOAD_LINK_CONTENTS, }; @@ -98,13 +100,19 @@ void LoadLibraries() void HandleParam() { if (param) { - if (!strncmp(#param, "-d ", 3)) { - strcpy(#downloader_edit, #param+3); - CreateThread(#Downloader,#downloader_stak+4092); + if (!strncmp(#param, "-download_and_exit ", 19)) { + download_and_exit = true; + strcpy(#downloader_edit, #param+19); + Downloader(); ExitProcess(); - } else if (!strncmp(#param, "-s ", 3)) { + } else if (!strncmp(#param, "-download ", 10)) { + strcpy(#downloader_edit, #param+10); + //CreateThread(#Downloader,#downloader_stak+4092); + Downloader(); + ExitProcess(); + } else if (!strncmp(#param, "-source ", 8)) { source_mode = true; - history.add(#param + 3); + history.add(#param + 8); } else { history.add(#param); } @@ -359,6 +367,9 @@ void ProcessEvent(dword id__) CreateThread(#Downloader,#downloader_stak+4092); } return; + case UPDATE_BROWSER: + EventUpdateBrowser(); + return; case COPY_LINK_URL: Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); notify("'URL copied to clipboard'O"); @@ -673,11 +684,58 @@ void EventOpenDialog() void EventViewSource() { char source_view_param[URL_SIZE+1]; - strcpy(#source_view_param, "-s "); + strcpy(#source_view_param, "-source "); strncat(#source_view_param, history.current(), URL_SIZE); RunProgram(#program_path, #source_view_param); } +dword GetFileSize(dword _path) +{ + BDVK bdvk; + if (GetFileInfo(_path, #bdvk)!=0) { + return 0; + } else { + return bdvk.sizelo; + } +} + +void EventUpdateBrowser() +{ + dword downloader_id, slot_n; + dword current_size; + dword new_size; + int error; + + draw_window(); + + downloader_id = RunProgram(#program_path, #update_param); + do { + slot_n = GetProcessSlot(downloader_id); + pause(10); + } while (slot_n!=0); + + current_size = GetFileSize(#program_path); + new_size = GetFileSize("/tmp0/1/Downloads/WebView.com"); + + if (!new_size) || (new_size<5000) { + notify(#update_download_error); + return; + } + + if (current_size == new_size) { + notify(#update_is_current); + return; + } + + if (error = CopyFileAtOnce(new_size, "/tmp0/1/Downloads/WebView.com", #program_path)) { + notify(#update_can_not_copy); + } else { + notify(#update_ok); + RunProgram(#program_path, history.current()); + ExitProcess(); + } +} + void DrawStatusBar(dword _status_text) { status_text.font_color = system.color.work_text; diff --git a/programs/cmm/browser/download_manager.h b/programs/cmm/browser/download_manager.h index 811b0dcb76..6e578c6dba 100644 --- a/programs/cmm/browser/download_manager.h +++ b/programs/cmm/browser/download_manager.h @@ -89,6 +89,7 @@ void Downloader() if (downloader.state == STATE_COMPLETED) { SaveDownloadedFile(); + if (download_and_exit) ExitProcess(); StopDownloading(); DL_Draw_Window(); break; @@ -145,6 +146,7 @@ void StartDownloading() return; } if (!downloader.Start(#downloader_edit)) { + if (download_and_exit) ExitProcess(); notify("'Error while starting download process.\nPlease, check entered path and internet connection.' -E"); StopDownloading(); return; @@ -217,10 +219,11 @@ void SaveDownloadedFile() for (i=0; iСправка WebView

Справка WebView

+ +Клавиши быстрого вызова + [CTRL + N или CTRL + T] Новое окно [CTRL + R или F5] Перезагрузить страницу [CTRL + O] Вызвать диалог выбора файла diff --git a/programs/cmm/browser/html/homepage_en.htm b/programs/cmm/browser/html/homepage_en.htm index eacaebbd26..7bb333dcee 100644 --- a/programs/cmm/browser/html/homepage_en.htm +++ b/programs/cmm/browser/html/homepage_en.htm @@ -8,8 +8,11 @@ 2. KolibriN homepage 3. Kolibri Stuff -Hint: to run a web search, type a text in the adress box -and press Ctrl+Enter. You can also use other Hotkeys. +By the way, +• You can check for browser updates from the main menu. +• To run a web search, type a text in the adress box and press Ctrl+Enter. +• You can also use other Hotkeys. +
diff --git a/programs/cmm/browser/html/homepage_ru.htm b/programs/cmm/browser/html/homepage_ru.htm index d435717640..78253f3568 100644 --- a/programs/cmm/browser/html/homepage_ru.htm +++ b/programs/cmm/browser/html/homepage_ru.htm @@ -8,9 +8,11 @@ 2. KolibriN10 3. Kolibri Store -Для поиска в Google наберите тест в адресной строке -и нажмите Ctrl+Enter. Есть также другие Горячие клавиши. - +Кстати, +• Из главного меню можно проверить наличие обновлений +• Для поиска в Google наберите тест в адресной строке и нажмите Ctrl+Enter +• Есть также другие Горячие клавиши. + diff --git a/programs/cmm/browser/texts.h b/programs/cmm/browser/texts.h index f2faaf36a4..b1f448ac31 100644 --- a/programs/cmm/browser/texts.h +++ b/programs/cmm/browser/texts.h @@ -1,4 +1,4 @@ -char version[]="WebView 2.2"; +char version[]="WebView 2.25"; #ifdef LANG_RUS char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; @@ -12,11 +12,18 @@ char main_menu[] = "Открыть файл Новое окно История -Менеджер загрузок"; +Менеджер загрузок +Обновить браузер"; char link_menu[] = "Копировать ссылку Скачать содержимое ссылки"; char loading_text[] = "Загрузка..."; + +char update_param[] = "-download_and_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Вы уже используете последнюю версию.' -I"; +char update_can_not_copy[] = "'WebView\nНе могу переместить новую версию из папки Downloads на Ramdisk. Возможно, не достаточно места.' -E"; #else char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; char homepage[] = FROM "html\\homepage_en.htm""\0"; @@ -29,11 +36,17 @@ char main_menu[] = "Open local file New window History -Download Manager"; +Download Manager +Update browser"; char link_menu[] = "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_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.' -I"; +char update_can_not_copy[] = "'WebView\nError copying a new version from Downloads folder!\nProbably too litle space on Ramdisk.' -E"; #endif #define URL_SERVICE_HISTORY "WebView:history" diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index edb369e3c2..6e546a7d81 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -339,6 +339,40 @@ void DrawPixieTitle(dword _t) theme.color_top_panel_folder_name, list.font_type, #title); } +void DrawAboutWindow() +{ + proc_info pop_up; + loop() switch(WaitEvent()) + { + case evButton: + ExitProcess(); + break; + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + case evReDraw: + DefineDragableWindow(150, 200, 400, 400); + GetProcessInfo(#pop_up, SelfInfo); + + DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_top_panel_bg); + DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); + + DefineHiddenButton(pop_up.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); + //img_draw stdcall(skin.image, pop_up.width-28, 0, 28, 18, skin.w - 29, 0); + DrawCaptButton(pop_up.width-10-80, pop_up.height - 34, 80, 24, 2, + 0x171717, 0xF5EFB3, "Cool"); + + WriteText(131,16, 0x81, 0x8E7C61, "Pixie Player"); + WriteText(130,15, 0x81, 0xF5EFB3, "Pixie Player"); + + WriteTextLines(10, 40, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); + DrawIcon32(45, 15, theme.color_top_panel_bg, 65); + DrawIcon32(pop_up.width-32-45, 15, theme.color_top_panel_bg, 65); + + } +} + //===================================================// // // // EVENTS // @@ -408,7 +442,9 @@ void EventStartPlaying() current_filename[strrchr(#current_filename, '.')-1] = '\0'; DrawPlayList(); DrawTopPanel(); + //start_playing_time = player_run_id = RunProgram("/sys/media/ac97snd", #item_path); + //player_run_id = RunProgram("/kolibrios/media/minimp3", #item_path); sprintf(#notify_message,"'Now playing:\n%s' -St",#current_filename); if (!repeat) && (window_mode==WINDOW_MODE_SMALL) { @@ -538,41 +574,7 @@ void EventPermanentlyDeleteFile() void EventShowAbout() { - CreateThread(#ShowAboutThread,#menu_stak+4092); -} - -void ShowAboutThread() -{ - proc_info pop_up; - loop() switch(WaitEvent()) - { - case evButton: - ExitProcess(); - break; - case evKey: - GetKeys(); - if (key_scancode == SCAN_CODE_ESC) ExitProcess(); - break; - case evReDraw: - DefineDragableWindow(150, 200, 400, 400); - GetProcessInfo(#pop_up, SelfInfo); - - DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_top_panel_bg); - DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); - - DefineHiddenButton(pop_up.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); - //img_draw stdcall(skin.image, pop_up.width-28, 0, 28, 18, skin.w - 29, 0); - DrawCaptButton(pop_up.width-10-80, pop_up.height - 34, 80, 24, 2, - 0x171717, 0xF5EFB3, "Cool"); - - WriteText(131,16, 0x81, 0x8E7C61, "Pixie Player"); - WriteText(130,15, 0x81, 0xF5EFB3, "Pixie Player"); - - WriteTextLines(10, 40, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); - DrawIcon32(45, 15, theme.color_top_panel_bg, 65); - DrawIcon32(pop_up.width-32-45, 15, theme.color_top_panel_bg, 65); - - } + CreateThread(#DrawAboutWindow,#menu_stak+4092); } /*