2 * Copyright (C) 2005-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 "GUIViewStateAddonBrowser.h"
12 #include "FileItemList.h"
13 #include "filesystem/File.h"
14 #include "guilib/WindowIDs.h"
15 #include "utils/StringUtils.h"
16 #include "utils/URIUtils.h"
17 #include "view/ViewState.h"
18 #include "windowing/GraphicContext.h"
20 using namespace XFILE
;
21 using namespace ADDON
;
23 CGUIViewStateAddonBrowser::CGUIViewStateAddonBrowser(const CFileItemList
& items
)
24 : CGUIViewState(items
)
26 if (URIUtils::PathEquals(items
.GetPath(), "addons://"))
28 AddSortMethod(SortByNone
, 551, LABEL_MASKS("%F", "", "%L", ""));
29 SetSortMethod(SortByNone
);
31 else if (URIUtils::PathEquals(items
.GetPath(), "addons://recently_updated/", true))
33 AddSortMethod(SortByLastUpdated
, 12014, LABEL_MASKS("%L", "%v", "%L", "%v"),
34 SortAttributeIgnoreFolders
, SortOrderDescending
);
38 AddSortMethod(SortByLabel
, SortAttributeIgnoreFolders
, 551,
39 LABEL_MASKS("%L", "%s", "%L", "%s"));
41 if (StringUtils::StartsWith(items
.GetPath(), "addons://sources/"))
42 AddSortMethod(SortByLastUsed
, 12012, LABEL_MASKS("%L", "%u", "%L", "%u"),
43 SortAttributeIgnoreFolders
, SortOrderDescending
); //Label, Last used
45 if (StringUtils::StartsWith(items
.GetPath(), "addons://user/") &&
46 items
.GetContent() == "addons")
47 AddSortMethod(SortByInstallDate
, 12013, LABEL_MASKS("%L", "%i", "%L", "%i"),
48 SortAttributeIgnoreFolders
, SortOrderDescending
);
50 SetSortMethod(SortByLabel
);
52 SetViewAsControl(DEFAULT_VIEW_AUTO
);
54 LoadViewState(items
.GetPath(), WINDOW_ADDON_BROWSER
);
57 void CGUIViewStateAddonBrowser::SaveViewState()
59 SaveViewToDb(m_items
.GetPath(), WINDOW_ADDON_BROWSER
);
62 std::string
CGUIViewStateAddonBrowser::GetExtensions()