2 * Copyright (C) 2015-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "AddonManagementEvent.h"
11 #include "addons/gui/GUIDialogAddonInfo.h"
12 #include "filesystem/AddonsDirectory.h"
13 #include "guilib/LocalizeStrings.h"
14 #include "utils/URIUtils.h"
16 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
17 const CVariant
& description
)
18 : CAddonEvent(addon
, description
)
21 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
22 const CVariant
& description
,
23 const CVariant
& details
)
24 : CAddonEvent(addon
, description
, details
)
27 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
28 const CVariant
& description
,
29 const CVariant
& details
,
30 const CVariant
& executionLabel
)
31 : CAddonEvent(addon
, description
, details
, executionLabel
)
34 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
36 const CVariant
& description
)
37 : CAddonEvent(addon
, level
, description
)
40 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
42 const CVariant
& description
,
43 const CVariant
& details
)
44 : CAddonEvent(addon
, level
, description
, details
)
47 CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr
& addon
,
49 const CVariant
& description
,
50 const CVariant
& details
,
51 const CVariant
& executionLabel
)
52 : CAddonEvent(addon
, level
, description
, details
, executionLabel
)
55 std::string
CAddonManagementEvent::GetExecutionLabel() const
57 std::string executionLabel
= CAddonEvent::GetExecutionLabel();
58 if (!executionLabel
.empty())
59 return executionLabel
;
61 return g_localizeStrings
.Get(24139);
64 bool CAddonManagementEvent::Execute() const
69 CFileItemPtr addonItem
= XFILE::CAddonsDirectory::FileItemFromAddon(m_addon
, URIUtils::AddFileToFolder("addons://", m_addon
->ID()));
70 if (addonItem
== nullptr)
73 return CGUIDialogAddonInfo::ShowForItem(addonItem
);