From 74c01c7fb7862ec01ad27c4b225b08b7aa0f3b0a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Jan 2024 11:29:56 +0300 Subject: =?UTF-8?q?fixes=20#4110=20(NewStory:=20=D0=BF=D0=B0=D0=B4=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20=D1=8D=D0=BA=D1=81=D0=BF=D0=BE=D1=80=D1=82=20?= =?UTF-8?q?=D0=B2=20json)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/ExternalAPI/m_PluginUpdater.h | 26 ++++++++++++++++++++++++++ plugins/NewStory/src/history_dlg.cpp | 13 ++++++++++++- plugins/NewStory/src/stdafx.h | 1 + plugins/PluginUpdater/src/stdafx.h | 4 +--- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 plugins/ExternalAPI/m_PluginUpdater.h diff --git a/plugins/ExternalAPI/m_PluginUpdater.h b/plugins/ExternalAPI/m_PluginUpdater.h new file mode 100644 index 0000000000..2f3bc2e45c --- /dev/null +++ b/plugins/ExternalAPI/m_PluginUpdater.h @@ -0,0 +1,26 @@ +/* +Copyright (C) 2010 Mataes + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + +#pragma once + +// a service to check updates +#define MS_PU_CHECK "PluginUpdater/CheckUpdates" + +// a service to install missing features +#define MS_PU_SHOWLIST "PluginUpdater/ShowList" diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp index 2d557db8b6..388a027732 100644 --- a/plugins/NewStory/src/history_dlg.cpp +++ b/plugins/NewStory/src/history_dlg.cpp @@ -826,6 +826,18 @@ public: void onClick_Export(CCtrlButton *) { + auto *pDriver = GetDatabasePlugin("JSON"); + if (pDriver == nullptr) { + CMStringW wszText(TranslateT("Import plugin is missing to perform this operation.")); + if (ServiceExists(MS_PU_SHOWLIST)) { + wszText.AppendFormat(L" %s", TranslateT("Do you want to install it using Plugin Updater?")); + if (IDYES == MessageBoxW(m_hwnd, wszText, TranslateT("Missing plugin"), MB_YESNO | MB_ICONQUESTION)) + CallService(MS_PU_SHOWLIST); + } + else MessageBoxW(m_hwnd, wszText, TranslateT("Missing plugin"), MB_OK | MB_ICONERROR); + return; + } + wchar_t FileName[MAX_PATH]; VARSW tszMirDir(L"%miranda_userdata%\\NewStoryExport"); @@ -871,7 +883,6 @@ public: if (PathFileExistsW(FileName)) DeleteFileW(FileName); - auto *pDriver = GetDatabasePlugin("JSON"); auto *pDB = pDriver->Export(FileName); pDB->BeginExport(); pDB->ExportContact(m_hContact); diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h index 42fcc8a89b..f6cb9c2c89 100644 --- a/plugins/NewStory/src/stdafx.h +++ b/plugins/NewStory/src/stdafx.h @@ -60,6 +60,7 @@ along with this program. If not, see . #include #include "m_NewStory.h" +#include "m_PluginUpdater.h" #include "m_smileyadd.h" #ifndef MTEXT_NOHELPERS #define MTEXT_NOHELPERS diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 3248123ed1..7053769c59 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -55,9 +55,7 @@ extern "C" #include "resource.h" #include - -#define MS_PU_CHECK "PluginUpdater/CheckUpdates" -#define MS_PU_SHOWLIST "PluginUpdater/ShowList" +#include #include "Notifications.h" -- cgit v1.2.3