Skip to content
Browse files

fixed: Show disabled addons in the Disabled Add-ons node, allowing th…

…em to be re-enabled. Similarly, ensure they don't act as folders in the Outdated node. #10190.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33874 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
1 parent 9f6f3e0 commit 4029b9f5a5b035485c9a380be47160fb0c401d43 jmarshallnz committed
View
23 xbmc/FileSystem/AddonsDirectory.cpp
@@ -53,13 +53,21 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
VECADDONS addons;
// get info from repository
- if (path.GetHostName().Equals("enabled") || path.GetHostName().Equals("disabled"))
+ bool reposAsFolders = true;
+ if (path.GetHostName().Equals("enabled"))
{
- CAddonMgr::Get().GetAllAddons(addons, path.GetHostName().Equals("enabled"));
+ CAddonMgr::Get().GetAllAddons(addons, true);
items.SetProperty("reponame",g_localizeStrings.Get(24062));
}
+ else if (path.GetHostName().Equals("disabled"))
+ { // grab all disabled addons, including disabled repositories
+ reposAsFolders = false;
+ CAddonMgr::Get().GetAllAddons(addons, false, true);
+ items.SetProperty("reponame",g_localizeStrings.Get(24039));
+ }
else if (path.GetHostName().Equals("outdated"))
{
+ reposAsFolders = false;
CAddonMgr::Get().GetAllOutdatedAddons(addons);
}
else if (path.GetHostName().Equals("repos"))
@@ -130,7 +138,7 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
}
items.m_strPath = strPath;
- GenerateListing(path, addons, items);
+ GenerateListing(path, addons, items, reposAsFolders);
// check for available updates
if (path.GetHostName().Equals("enabled"))
{
@@ -157,14 +165,17 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
return true;
}
-void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items)
+void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{
items.ClearItems();
for (unsigned i=0; i < addons.size(); i++)
{
AddonPtr addon = addons[i];
- CFileItemPtr pItem = (addon->Type() == ADDON_REPOSITORY) ? FileItemFromAddon(addon, "addons://", true)
- : FileItemFromAddon(addon, path.Get(), false);
+ CFileItemPtr pItem;
+ if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
+ pItem = FileItemFromAddon(addon, "addons://", true);
+ else
+ pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
View
2 xbmc/FileSystem/AddonsDirectory.h
@@ -49,7 +49,7 @@ namespace XFILE
\return true if more than one item is found, false otherwise.
*/
static bool GetScriptsAndPlugins(const CStdString &content, CFileItemList &items);
- static void GenerateListing(CURL &path, ADDON::VECADDONS& addons, CFileItemList &items);
+ static void GenerateListing(CURL &path, ADDON::VECADDONS& addons, CFileItemList &items, bool reposAsFolders = true);
static CFileItemPtr FileItemFromAddon(ADDON::AddonPtr &addon, const CStdString &basePath, bool folder = false);
};
}
View
4 xbmc/addons/AddonManager.cpp
@@ -277,11 +277,11 @@ bool CAddonMgr::HasAddons(const TYPE &type, bool enabled /*= true*/)
return GetAddons(type, addons, enabled);
}
-bool CAddonMgr::GetAllAddons(VECADDONS &addons, bool enabled /*= true*/)
+bool CAddonMgr::GetAllAddons(VECADDONS &addons, bool enabled /*= true*/, bool allowRepos /* = false */)
{
for (int i = ADDON_UNKNOWN+1; i < ADDON_VIZ_LIBRARY; ++i)
{
- if (ADDON_REPOSITORY == (TYPE)i)
+ if (!allowRepos && ADDON_REPOSITORY == (TYPE)i)
continue;
VECADDONS temp;
if (CAddonMgr::Get().GetAddons((TYPE)i, temp, enabled))
View
2 xbmc/addons/AddonManager.h
@@ -89,7 +89,7 @@ namespace ADDON
bool GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabled = true);
bool HasAddons(const TYPE &type, bool enabled = true);
bool GetAddons(const TYPE &type, VECADDONS &addons, bool enabled = true);
- bool GetAllAddons(VECADDONS &addons, bool enabled = true);
+ bool GetAllAddons(VECADDONS &addons, bool enabled = true, bool allowRepos = false);
/*! \brief Get all addons with available updates
\param addons List to fill with all outdated addons
\param enabled Whether to get only enabled or disabled addons

0 comments on commit 4029b9f

Please sign in to comment.
Something went wrong with that request. Please try again.