Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
fixed: Show disabled addons in the Disabled Add-ons node, allowing th…
Browse files Browse the repository at this point in the history
…em to be re-enabled. Similarly, ensure they don't act as folders in the Outdated node. xbmc#10190.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33874 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
jmarshallnz committed Sep 16, 2010
1 parent 9f6f3e0 commit 4029b9f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
23 changes: 17 additions & 6 deletions xbmc/FileSystem/AddonsDirectory.cpp
Expand Up @@ -53,13 +53,21 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it


VECADDONS addons; VECADDONS addons;
// get info from repository // 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)); 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")) else if (path.GetHostName().Equals("outdated"))
{ {
reposAsFolders = false;
CAddonMgr::Get().GetAllOutdatedAddons(addons); CAddonMgr::Get().GetAllOutdatedAddons(addons);
} }
else if (path.GetHostName().Equals("repos")) else if (path.GetHostName().Equals("repos"))
Expand Down Expand Up @@ -130,7 +138,7 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
} }


items.m_strPath = strPath; items.m_strPath = strPath;
GenerateListing(path, addons, items); GenerateListing(path, addons, items, reposAsFolders);
// check for available updates // check for available updates
if (path.GetHostName().Equals("enabled")) if (path.GetHostName().Equals("enabled"))
{ {
Expand All @@ -157,14 +165,17 @@ bool CAddonsDirectory::GetDirectory(const CStdString& strPath, CFileItemList &it
return true; return true;
} }


void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items) void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{ {
items.ClearItems(); items.ClearItems();
for (unsigned i=0; i < addons.size(); i++) for (unsigned i=0; i < addons.size(); i++)
{ {
AddonPtr addon = addons[i]; AddonPtr addon = addons[i];
CFileItemPtr pItem = (addon->Type() == ADDON_REPOSITORY) ? FileItemFromAddon(addon, "addons://", true) CFileItemPtr pItem;
: FileItemFromAddon(addon, path.Get(), false); if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
pItem = FileItemFromAddon(addon, "addons://", true);
else
pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2; AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2)) if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305)); pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
Expand Down
2 changes: 1 addition & 1 deletion xbmc/FileSystem/AddonsDirectory.h
Expand Up @@ -49,7 +49,7 @@ namespace XFILE
\return true if more than one item is found, false otherwise. \return true if more than one item is found, false otherwise.
*/ */
static bool GetScriptsAndPlugins(const CStdString &content, CFileItemList &items); 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); static CFileItemPtr FileItemFromAddon(ADDON::AddonPtr &addon, const CStdString &basePath, bool folder = false);
}; };
} }
4 changes: 2 additions & 2 deletions xbmc/addons/AddonManager.cpp
Expand Up @@ -277,11 +277,11 @@ bool CAddonMgr::HasAddons(const TYPE &type, bool enabled /*= true*/)
return GetAddons(type, addons, enabled); 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) for (int i = ADDON_UNKNOWN+1; i < ADDON_VIZ_LIBRARY; ++i)
{ {
if (ADDON_REPOSITORY == (TYPE)i) if (!allowRepos && ADDON_REPOSITORY == (TYPE)i)
continue; continue;
VECADDONS temp; VECADDONS temp;
if (CAddonMgr::Get().GetAddons((TYPE)i, temp, enabled)) if (CAddonMgr::Get().GetAddons((TYPE)i, temp, enabled))
Expand Down
2 changes: 1 addition & 1 deletion xbmc/addons/AddonManager.h
Expand Up @@ -89,7 +89,7 @@ namespace ADDON
bool GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabled = true); bool GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabled = true);
bool HasAddons(const TYPE &type, bool enabled = true); bool HasAddons(const TYPE &type, bool enabled = true);
bool GetAddons(const TYPE &type, VECADDONS &addons, 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 /*! \brief Get all addons with available updates
\param addons List to fill with all outdated addons \param addons List to fill with all outdated addons
\param enabled Whether to get only enabled or disabled addons \param enabled Whether to get only enabled or disabled addons
Expand Down

0 comments on commit 4029b9f

Please sign in to comment.