Note that this only clears the HTTP cache (used for files), but not the directory used for persistent data such as Cookies, Local Databases, etc. There's no Qt API to do that. Fortunately, this directory should be small.
Showing the changes to interface/src/Menu.cpp (1 of 5 files). Show all
Unified · Split
| @@ -29,6 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include <VrMenu.h> | 29 | #include <VrMenu.h> |
| 30 | #include <ScriptEngines.h> | 30 | #include <ScriptEngines.h> |
| 31 | #include <MenuItemProperties.h> | 31 | #include <MenuItemProperties.h> |
| 32 | #include <ui/types/FileTypeProfile.h> | ||
| 33 | #include <ui/types/HFWebEngineProfile.h> | ||
| 32 | 34 | ||
| 33 | #include "Application.h" | 35 | #include "Application.h" |
| 34 | #include "AccountManager.h" | 36 | #include "AccountManager.h" |
| @@ -635,8 +637,12 @@ Menu::Menu() { · 600 unmodified lines | |||
| 635 | 637 | ||
| 636 | action = addActionToQMenuAndActionHash(networkMenu, MenuOption::ClearDiskCaches); | 638 | action = addActionToQMenuAndActionHash(networkMenu, MenuOption::ClearDiskCaches); |
| 637 | connect(action, &QAction::triggered, [] { | 639 | connect(action, &QAction::triggered, [] { |
| 638 | // This cache is cleared immediately | 640 | // The following caches are cleared immediately |
| 639 | DependencyManager::get<AssetClient>()->clearCache(); | 641 | DependencyManager::get<AssetClient>()->clearCache(); |
| 642 | #ifndef Q_OS_ANDROID | ||
| 643 | FileTypeProfile::clearCache(); | ||
| 644 | HFWebEngineProfile::clearCache(); | ||
| 645 | #endif | ||
| 640 | 646 | ||
| 641 | // Clear the KTX cache on the next restart. It can't be cleared immediately because its files might be in use. | 647 | // Clear the KTX cache on the next restart. It can't be cleared immediately because its files might be in use. |
| 642 | Setting::Handle<int>(KTXCache::SETTING_VERSION_NAME, KTXCache::INVALID_VERSION).set(KTXCache::INVALID_VERSION); | 648 | Setting::Handle<int>(KTXCache::SETTING_VERSION_NAME, KTXCache::INVALID_VERSION).set(KTXCache::INVALID_VERSION); |