![]() |
LeechCraft
0.6.70-13729-g7046a9d2a7
Modular cross-platform feature rich live environment.
|
Describes a single XDG .desktop
entry.
More...
#include "item.h"
Public Member Functions | |
bool | IsValid () const |
Checks whether this XDG item is valid. More... | |
bool | IsHidden () const |
Checks whether this XDG item should be hidden. More... | |
void | Execute (ICoreProxy_ptr proxy) const |
Executes this item, if possible. More... | |
QString | GetName (const QString &language) const |
Returns the name of this item. More... | |
QString | GetGenericName (const QString &language) const |
Returns the generic name of this item. More... | |
QString | GetComment (const QString &language) const |
Returns the comment of this item. More... | |
QString | GetIconName () const |
Returns the name of the icon for this item. More... | |
QStringList | GetCategories () const |
Returns the categories where this item belongs. More... | |
Type | GetType () const |
Returns the type of this item. More... | |
QString | GetCommand () const |
Returns type type-specific command for this item. More... | |
QString | GetWorkingDirectory () const |
Returns the working directory for command execution. More... | |
QString | GetPermanentID () const |
Returns the permanent ID of this item. More... | |
QIcon | GetIcon (const ICoreProxy_ptr &) const |
Returns the icon previously set by SetIcon(). More... | |
QDebug | DebugPrint (QDebug stream) const |
Serializes item contents to the debugging stream. More... | |
Static Public Member Functions | |
static Item_ptr | FromDesktopFile (const QString &file) |
Loads the XDG .desktop item from file. More... | |
Friends | |
UTIL_XDG_API bool | operator== (const Item &left, const Item &right) |
Checks whether left and right are equal. More... | |
UTIL_XDG_API bool | operator!= (const Item &left, const Item &right) |
Checks whether left and right are not equal. More... | |
Describes a single XDG .desktop
entry.
XDG entries can language-dependent fields like name, generic name or comment. The values of these fields are obtained via GetName(), GetGenericName() and GetComment() respectively, taking the language code and returning either the localized field for that language or the version of the field for the default (typically English) language.
QDebug LC::Util::XDG::Item::DebugPrint | ( | QDebug | stream | ) | const |
Serializes item contents to the debugging stream.
This function is provided for convenience to pretty-print contents of this item to a debugging stream.
[in] | stream | The stream to debug-print |
Definition at line 196 of file item.cpp.
Referenced by LC::Util::XDG::operator<<().
void LC::Util::XDG::Item::Execute | ( | ICoreProxy_ptr | proxy | ) | const |
Executes this item, if possible.
Depending on the type of this item, execution can mean launching an application (for Type::Application), opening a default URL handler (for Type::URL) and so on.
[in] | proxy | The ICoreProxy_ptr object to use if needed during execution. |
Definition at line 75 of file item.cpp.
References LC::Util::XDG::Application, LC::FromUserInitiated, GetCommand(), GetType(), GetWorkingDirectory(), LC::Util::MakeEntity(), LC::OnlyHandle, and LC::Util::XDG::URL.
|
static |
Loads the XDG .desktop
item from file.
[in] | file | The file to load the item from. |
false
) if the file is invalid.std::runtime_error | If file cannot be opened. |
Definition at line 221 of file item.cpp.
References LC::Util::XDG::Application, LC::Util::XDG::Dir, LC::Util::XDG::Other, and LC::Util::XDG::URL.
QStringList LC::Util::XDG::Item::GetCategories | ( | ) | const |
QString LC::Util::XDG::Item::GetCommand | ( | ) | const |
Returns type type-specific command for this item.
A command could be a name of the application for Type::Application, an URL for Type::URL, and so on.
Definition at line 149 of file item.cpp.
Referenced by Execute(), and GetPermanentID().
QString LC::Util::XDG::Item::GetComment | ( | const QString & | language | ) | const |
QString LC::Util::XDG::Item::GetGenericName | ( | const QString & | language | ) | const |
Returns the generic name of this item.
[in] | language | The code of the desired language for the localized generic name. |
QIcon LC::Util::XDG::Item::GetIcon | ( | const ICoreProxy_ptr & | proxy | ) | const |
Returns the icon previously set by SetIcon().
If no icon has been set previously via SetIcon(), this method returns a null icon even if GetIconName() returns a perfectly valid name of an existing icon.
This method is not related to GetIconName() in any way and (along with SetIcon()) is provided purely for convenience, for example, to associate a loaded icon with the item.
Definition at line 188 of file item.cpp.
References GetIconName().
QString LC::Util::XDG::Item::GetIconName | ( | ) | const |
Returns the name of the icon for this item.
Please note this is not related to the GetIcon() method which (along with SetIcon()) is provided purely for convenience.
Definition at line 134 of file item.cpp.
Referenced by GetIcon().
QString LC::Util::XDG::Item::GetName | ( | const QString & | language | ) | const |
Returns the name of this item.
[in] | language | The code of the desired language for the localized name. |
QString LC::Util::XDG::Item::GetPermanentID | ( | ) | const |
Returns the permanent ID of this item.
The returned ID is language-agnostic and is suitable to, for instance, identify the item in a favorites list.
Definition at line 159 of file item.cpp.
References GetCommand().
Type LC::Util::XDG::Item::GetType | ( | ) | const |
QString LC::Util::XDG::Item::GetWorkingDirectory | ( | ) | const |
Returns the working directory for command execution.
This directory specifies the working directory where the command returned by GetCommand() should be executed.
Definition at line 154 of file item.cpp.
Referenced by Execute().
bool LC::Util::XDG::Item::IsHidden | ( | ) | const |
bool LC::Util::XDG::Item::IsValid | ( | ) | const |
|
friend |
|
friend |