1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* Copyright (C) 2015-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "AddonManagementEvent.h"
#include "addons/gui/GUIDialogAddonInfo.h"
#include "filesystem/AddonsDirectory.h"
#include "guilib/LocalizeStrings.h"
#include "utils/URIUtils.h"
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
const CVariant& description)
: CAddonEvent(addon, description)
{ }
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
const CVariant& description,
const CVariant& details)
: CAddonEvent(addon, description, details)
{ }
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
const CVariant& description,
const CVariant& details,
const CVariant& executionLabel)
: CAddonEvent(addon, description, details, executionLabel)
{ }
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
EventLevel level,
const CVariant& description)
: CAddonEvent(addon, level, description)
{ }
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
EventLevel level,
const CVariant& description,
const CVariant& details)
: CAddonEvent(addon, level, description, details)
{ }
CAddonManagementEvent::CAddonManagementEvent(const ADDON::AddonPtr& addon,
EventLevel level,
const CVariant& description,
const CVariant& details,
const CVariant& executionLabel)
: CAddonEvent(addon, level, description, details, executionLabel)
{ }
std::string CAddonManagementEvent::GetExecutionLabel() const
{
std::string executionLabel = CAddonEvent::GetExecutionLabel();
if (!executionLabel.empty())
return executionLabel;
return g_localizeStrings.Get(24139);
}
bool CAddonManagementEvent::Execute() const
{
if (!CanExecute())
return false;
CFileItemPtr addonItem = XFILE::CAddonsDirectory::FileItemFromAddon(m_addon, URIUtils::AddFileToFolder("addons://", m_addon->ID()));
if (addonItem == nullptr)
return false;
return CGUIDialogAddonInfo::ShowForItem(addonItem);
}
|