![]() |
LeechCraft 0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
|
Finds and parses XDG .desktop
files.
More...
#include "itemsfinder.h"
Signals | |
void | itemsListChanged () |
Notifies when the list of items changes in any way. | |
Public Member Functions | |
ItemsFinder (const ICoreProxy_ptr &, const QList< Type > &types, QObject *parent=nullptr) | |
Constructs the items finder for the given types. | |
bool | IsReady () const |
Checks whether this items finder is ready. | |
Cat2Items_t | GetItems () const |
Returns the categorized list of XDG items. | |
Item_ptr | FindItem (const QString &permanentID) const |
Finds an XDG item for the given permanent ID. | |
Protected Member Functions | |
void | Update () |
Finds and parses XDG .desktop
files.
The .desktop
files are found in the directories matching the types passed to the object's constructor.
Parsing is done asynchronously in a separate thread, and the itemsListChanged() signal is emitted each time the list of files changes.
This class does not watch for changes in the said paths. Use the ItemsDatabase instead if that functionality is required.
Definition at line 40 of file itemsfinder.h.
LC::Util::XDG::ItemsFinder::ItemsFinder | ( | const ICoreProxy_ptr & | proxy, |
const QList< Type > & | types, | ||
QObject * | parent = nullptr ) |
Constructs the items finder for the given types.
ToPaths() is used to get the list of directories for each of the types.
The ItemsFinder will asynchronously update itself automatically a few moments after creation and emit itemsListChanged() when the update finishes.
[in] | proxy | The proxy to use to get the icons of the items that were found. |
[in] | types | The item types to watch for. |
[in] | parent | The parent object of this finder. |
Definition at line 22 of file itemsfinder.cpp.
References Update().
Referenced by LC::Util::XDG::ItemsDatabase::ItemsDatabase().
Item_ptr LC::Util::XDG::ItemsFinder::FindItem | ( | const QString & | permanentID | ) | const |
Finds an XDG item for the given permanent ID.
[in] | permanentID | The permanent ID of the item as returned by Item::GetPermanentID(). |
Definition at line 41 of file itemsfinder.cpp.
Cat2Items_t LC::Util::XDG::ItemsFinder::GetItems | ( | ) | const |
Returns the categorized list of XDG items.
The returned hash contains the mapping from XDG category ID to the list of items in that category. A single item can appear in multiple categories at the same time.
If the finder is not ready (IsReady() returns false), this function returns an empty hash.
Definition at line 36 of file itemsfinder.cpp.
bool LC::Util::XDG::ItemsFinder::IsReady | ( | ) | const |
Checks whether this items finder is ready.
An items finder is ready if it has finished at least one search process. In other words, IsReady() returns true iff itemsListChanged() has been emitted at least once.
Definition at line 31 of file itemsfinder.cpp.
|
signal |
Notifies when the list of items changes in any way.
Referenced by Update().
|
protected |
Definition at line 215 of file itemsfinder.cpp.
References itemsListChanged().
Referenced by LC::Util::XDG::ItemsDatabase::ItemsDatabase(), and ItemsFinder().