From 5aebbf6c518190ea03ef3e26ef3f0cd74ff928ce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 8 Feb 2022 18:24:36 +0300 Subject: fixes #1281 (Db_autobackups: "Use CloudFile" option should be gray out if CloudFile not installed) --- plugins/Db_autobackups/src/main.cpp | 10 ++++++++++ plugins/Db_autobackups/src/options.cpp | 4 ++-- plugins/Db_autobackups/src/stdafx.h | 1 + plugins/Db_autobackups/src/version.h | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 5fd1b5172c..1b898f31c2 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -98,8 +98,16 @@ static INT_PTR OnTogglePopups(WPARAM, LPARAM) return 0; } +static int PluginLoaded(WPARAM, LPARAM) +{ + g_plugin.bCloudFilePresent = ServiceExists(MS_CLOUDFILE_UPLOAD); + return 0; +} + static int ModulesLoad(WPARAM, LPARAM) { + PluginLoaded(0, 0); + CMenuItem mi(&g_plugin); mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Database"), 500000000); @@ -167,6 +175,8 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad); + HookEvent(ME_SYSTEM_MODULELOAD, PluginLoaded); + HookEvent(ME_SYSTEM_MODULEUNLOAD, PluginLoaded); g_plugin.registerIcon(LPGEN("Database") "/" LPGEN("Database backups"), iconList); diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index cd19058170..0dd0cbb4bf 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -29,7 +29,7 @@ class COptionsDlg : public CDlgBase m_period.Enable(bEnabled); m_periodType.Enable(bEnabled); m_backupProfile.Enable(bEnabled); - m_useCloudFile.Enable(bEnabled); + m_useCloudFile.Enable(g_plugin.bCloudFilePresent && bEnabled); if (!bEnabled) { m_cloudFileService.Disable(); @@ -207,7 +207,7 @@ public: CreateToolTip(tszTooltipText, TranslateT("Variables")); } - m_useCloudFile.Enable(ServiceExists(MS_CLOUDFILE_UPLOAD)); + m_useCloudFile.Enable(g_plugin.bCloudFilePresent); if (ServiceExists(MS_CLOUDFILE_ENUMSERVICES)) { m_cloudFileService.Enable(); CallService(MS_CLOUDFILE_ENUMSERVICES, (WPARAM)&COptionsDlg::EnumCloudFileServices, (LPARAM)&m_cloudFileService); diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h index c0679a5c34..9c84fc678c 100644 --- a/plugins/Db_autobackups/src/stdafx.h +++ b/plugins/Db_autobackups/src/stdafx.h @@ -37,6 +37,7 @@ struct CMPlugin : public PLUGIN { CMPlugin(); + bool bCloudFilePresent = false; HANDLE hevBackup; wchar_t folder[MAX_PATH]; diff --git a/plugins/Db_autobackups/src/version.h b/plugins/Db_autobackups/src/version.h index 5980caff22..d9f773e87d 100644 --- a/plugins/Db_autobackups/src/version.h +++ b/plugins/Db_autobackups/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 5 +#define __BUILD_NUM 6 #include -- cgit v1.2.3