From d5b0e0db3f7a7045cb8e6906b5a9bca22962415c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 4 Jun 2017 00:44:09 +0200 Subject: Linux/MacOSX: Replace User Guide PDF with local HTML documentation. Replace UI links to point towards local HTML documentation if it exists --- src/Main/GraphicUserInterface.cpp | 97 ++++++++++++++++++++------------------- src/Main/Main.make | 8 ++-- 2 files changed, 53 insertions(+), 52 deletions(-) mode change 100644 => 100755 src/Main/GraphicUserInterface.cpp mode change 100644 => 100755 src/Main/Main.make (limited to 'src/Main') diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp old mode 100644 new mode 100755 index f69a2413..83e1ce91 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -1101,21 +1101,26 @@ namespace VeraCrypt url = wxString (TC_HOMEPAGE); buildUrl = false; } + else if (linkId == L"onlinehelp") + { + url = L"https://www.veracrypt.fr/en/Documentation.html"; + buildUrl = false; + } else if (linkId == L"localizations") { - url = L"Language%20Packs.html"; + url = L"Language Packs.html"; } else if (linkId == L"beginnerstutorial" || linkId == L"tutorial") { - url = L"Beginner%27s%20Tutorial.html"; + url = L"Beginner's Tutorial.html"; } else if (linkId == L"releasenotes" || linkId == L"history") { - url = L"Release%20Notes.html"; + url = L"Release Notes.html"; } else if (linkId == L"hwacceleration") { - url = L"Hardware%20Acceleration.html"; + url = L"Hardware Acceleration.html"; } else if (linkId == L"parallelization") { @@ -1131,23 +1136,23 @@ namespace VeraCrypt } else if (linkId == L"introcontainer") { - url = L"Creating%20New%20Volumes.html"; + url = L"Creating New Volumes.html"; } else if (linkId == L"introsysenc") { - url = L"System%20Encryption.html"; + url = L"System Encryption.html"; } else if (linkId == L"hiddensysenc") { - url = L"VeraCrypt%20Hidden%20Operating%20System.html"; + url = L"VeraCrypt Hidden Operating System.html"; } else if (linkId == L"sysencprogressinfo") { - url = L"System%20Encryption.html"; + url = L"System Encryption.html"; } else if (linkId == L"hiddenvolume") { - url = L"Hidden%20Volume.html"; + url = L"Hidden Volume.html"; } else if (linkId == L"aes") { @@ -1175,7 +1180,7 @@ namespace VeraCrypt } else if (linkId == L"hashalgorithms") { - url = L"Hash%20Algorithms.html"; + url = L"Hash Algorithms.html"; } else if (linkId == L"isoburning") { @@ -1184,15 +1189,15 @@ namespace VeraCrypt } else if (linkId == L"sysfavorites") { - url = L"System%20Favorite%20Volumes.html"; + url = L"System Favorite Volumes.html"; } else if (linkId == L"favorites") { - url = L"Favorite%20Volumes.html"; + url = L"Favorite Volumes.html"; } else if (linkId == L"hiddenvolprotection") { - url = L"Protection%20of%20Hidden%20Volumes.html"; + url = L"Protection of Hidden Volumes.html"; } else if (linkId == L"faq") { @@ -1217,7 +1222,35 @@ namespace VeraCrypt if (buildUrl) { - url = L"https://www.veracrypt.fr/en/" + url; + wxString htmlPath = wstring (Application::GetExecutableDirectory()); + bool localFile = true; + +#ifdef TC_RESOURCE_DIR + htmlPath = StringConverter::ToWide (string (TC_TO_STRING (TC_RESOURCE_DIR)) + "/doc/HTML/"); +#elif defined (TC_WINDOWS) + htmlPath += L"\\docs\\html\\en\\"; +#elif defined (TC_MACOSX) + htmlPath += L"/../Resources/doc/HTML/"; +#elif defined (TC_UNIX) + htmlPath = L"/usr/share/veracrypt/doc/HTML/"; +#else + htmlPath = L"https://www.veracrypt.fr/en/"; + localFile = false; +#endif + if (localFile) + { + /* check if local file exists */ + wxFileName htmlFile = htmlPath + url; + htmlFile.Normalize(); + if (!htmlFile.FileExists()) + { + htmlPath = L"https://www.veracrypt.fr/en/"; + url.Replace (L" ", L"%20"); + url.Replace (L"'", L"%27"); + } + } + + url = htmlPath + url; } return url; @@ -1235,44 +1268,12 @@ namespace VeraCrypt void GraphicUserInterface::OpenOnlineHelp (wxWindow *parent) { - OpenHomepageLink (parent, L"help"); + OpenHomepageLink (parent, L"onlinehelp"); } void GraphicUserInterface::OpenUserGuide (wxWindow *parent) { - try - { - wxString docPath = wstring (Application::GetExecutableDirectory()); - -#ifdef TC_RESOURCE_DIR - docPath = StringConverter::ToWide (string (TC_TO_STRING (TC_RESOURCE_DIR)) + "/doc/VeraCrypt User Guide.pdf"); -#elif defined (TC_WINDOWS) - docPath += L"\\VeraCrypt User Guide.pdf"; -#elif defined (TC_MACOSX) - docPath += L"/../Resources/VeraCrypt User Guide.pdf"; -#elif defined (TC_UNIX) - docPath = L"/usr/share/veracrypt/doc/VeraCrypt User Guide.pdf"; -#else -# error TC_RESOURCE_DIR undefined -#endif - - wxFileName docFile = docPath; - docFile.Normalize(); - - try - { - Gui->OpenDocument (parent, docFile); - } - catch (...) - { - if (Gui->AskYesNo (LangString ["HELP_READER_ERROR"], true)) - OpenOnlineHelp (parent); - } - } - catch (Exception &e) - { - Gui->ShowError (e); - } + OpenHomepageLink (parent, L"help"); } void GraphicUserInterface::RestoreVolumeHeaders (shared_ptr volumePath) const diff --git a/src/Main/Main.make b/src/Main/Main.make old mode 100644 new mode 100755 index 3ce03844..7041d66e --- a/src/Main/Main.make +++ b/src/Main/Main.make @@ -152,7 +152,7 @@ endif endif ifeq "$(PLATFORM)" "MacOSX" - mkdir -p $(APPNAME).app/Contents/MacOS $(APPNAME).app/Contents/Resources + mkdir -p $(APPNAME).app/Contents/MacOS $(APPNAME).app/Contents/Resources/doc/HTML -rm -f $(APPNAME).app/Contents/MacOS/$(APPNAME) -rm -f $(APPNAME).app/Contents/MacOS/$(APPNAME)_console @@ -174,7 +174,7 @@ endif cp $(PWD)/Resources/Icons/VeraCrypt.icns $(APPNAME).app/Contents/Resources cp $(PWD)/Resources/Icons/VeraCrypt_Volume.icns $(APPNAME).app/Contents/Resources - cp "$(PWD)/../doc/VeraCrypt User Guide.pdf" $(APPNAME).app/Contents/Resources + cp $(PWD)/../doc/html/* $(APPNAME).app/Contents/Resources/doc/HTML echo -n APPLTRUE >$(APPNAME).app/Contents/PkgInfo sed -e 's/_VERSION_/$(patsubst %a,%.1,$(patsubst %b,%.2,$(TC_VERSION)))/' ../Build/Resources/MacOSX/Info.plist.xml >$(APPNAME).app/Contents/Info.plist @@ -199,12 +199,12 @@ endif ifeq "$(PLATFORM)" "Linux" ifeq "$(TC_BUILD_CONFIG)" "Release" mkdir -p $(PWD)/Setup/Linux/usr/bin - mkdir -p $(PWD)/Setup/Linux/usr/share/$(APPNAME)/doc + mkdir -p $(PWD)/Setup/Linux/usr/share/$(APPNAME)/doc/HTML cp $(PWD)/Main/$(APPNAME) $(PWD)/Setup/Linux/usr/bin/$(APPNAME) cp $(PWD)/Setup/Linux/$(APPNAME)-uninstall.sh $(PWD)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh chmod +x $(PWD)/Setup/Linux/usr/bin/$(APPNAME)-uninstall.sh cp $(PWD)/License.txt $(PWD)/Setup/Linux/usr/share/$(APPNAME)/doc/License.txt - cp "$(PWD)/../doc/VeraCrypt User Guide.pdf" "$(PWD)/Setup/Linux/usr/share/$(APPNAME)/doc/VeraCrypt User Guide.pdf" + cp $(PWD)/../doc/html/* "$(PWD)/Setup/Linux/usr/share/$(APPNAME)/doc/HTML" ifndef TC_NO_GUI mkdir -p $(PWD)/Setup/Linux/usr/share/applications -- cgit v1.2.3