Qx v0.5.8
Qt Extensions Library
|
The DesktopEntry class provides the base functionality common to all Linux desktop entry files. More...
#include <qx/linux/qx-desktopentry.h>
Public Member Functions | |
QString | comment () const |
virtual QString | extension () const =0 |
QString | genericName () const |
QString | icon () const |
bool | isHidden () const |
bool | isNoDisplay () const |
QString | name () const |
QStringList | notShowIn () const |
QStringList | onlyShowIn () const |
void | setComment (const QString &comment) |
void | setGenericName (const QString &name) |
void | setHidden (bool hidden) |
void | setIcon (const QString &icon) |
void | setName (const QString &name) |
void | setNoDisplay (bool display) |
void | setNotShowIn (const QStringList ¬In) |
void | setOnlyShowIn (const QStringList &showIn) |
virtual QString | toString () const |
virtual QString | type () const =0 |
Static Public Member Functions | |
static IoOpReport | writeToDisk (QString path, const DesktopEntry *entry) |
Static Protected Member Functions | |
static QString | keyValueString (const QString &key, bool value) |
static QString | keyValueString (const QString &key, const char *value) |
static QString | keyValueString (const QString &key, const QString &value) |
static QString | keyValueString (const QString &key, const QStringList &value) |
Desktop entry files act as extensible GUI shortcuts in a manner similar to Windows .lnk
files, although with greater capabilities, and are supported by most major Linux desktop environments.
Standard entry files exist in one of three forms:
This class acts only as a base for all properties and facilities that are common to all desktop entry types. To create a desktop entry, instantiate one of the type specific derivatives.
This implementation aims to comply with version 1.5 of the XDG Desktop Entry Specification.
QString Qx::DesktopEntry::comment | ( | ) | const |
Returns the entry's comment.
|
pure virtual |
Returns the proper extension of the entry that corresponds to its type.
Implemented in Qx::ApplicationDesktopEntry, Qx::DirectoryDesktopEntry, and Qx::LinkDesktopEntry.
QString Qx::DesktopEntry::genericName | ( | ) | const |
Returns the generic name of the entry.
QString Qx::DesktopEntry::icon | ( | ) | const |
Returns the entry's icon path/name.
bool Qx::DesktopEntry::isHidden | ( | ) | const |
Returns true
if the entry is marked as 'deleted'; otherwise, returns false
;
bool Qx::DesktopEntry::isNoDisplay | ( | ) | const |
Returns true
if the entry should not be displayed to the user; otherwise, returns false
.
Creates a string of key and value in the same arrangement they would appear in a file.
This is useful for implementing a custom desktop entry type.
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
staticprotected |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
QString Qx::DesktopEntry::name | ( | ) | const |
Returns the name of the entry.
QStringList Qx::DesktopEntry::notShowIn | ( | ) | const |
Returns the blacklist of environemnts that the entry should not be displayed on.
QStringList Qx::DesktopEntry::onlyShowIn | ( | ) | const |
Returns the whitelist of environemnts that the entry should be displayed on.
void Qx::DesktopEntry::setComment | ( | const QString & | comment | ) |
Sets comment of the entry to comment.
void Qx::DesktopEntry::setGenericName | ( | const QString & | name | ) |
Sets the generic name of the entry to name.
void Qx::DesktopEntry::setHidden | ( | bool | hidden | ) |
Sets whether or not he entry should be considered 'deleted'.
void Qx::DesktopEntry::setIcon | ( | const QString & | icon | ) |
Sets the icon path/name of the entry to icon.
void Qx::DesktopEntry::setName | ( | const QString & | name | ) |
Sets the name of the entry to name.
void Qx::DesktopEntry::setNoDisplay | ( | bool | display | ) |
Sets whether or not the entry should be displayed to the user.
void Qx::DesktopEntry::setNotShowIn | ( | const QStringList & | notIn | ) |
Sets the blacklist of desktop environments that the entry should not be displayed on.
void Qx::DesktopEntry::setOnlyShowIn | ( | const QStringList & | showIn | ) |
Sets the whitelist of desktop environments that the entry should be displayed on.
|
virtual |
Composites the desktop entry into its string form, as would be found in an entry file on disk.
Reimplemented in Qx::ApplicationDesktopEntry, Qx::DirectoryDesktopEntry, and Qx::LinkDesktopEntry.
|
pure virtual |
Returns the type string of the entry.
Implemented in Qx::ApplicationDesktopEntry, Qx::DirectoryDesktopEntry, and Qx::LinkDesktopEntry.
|
static |
Writes the DesktopEntry to the file specified by path, overwriting any existing entry if any, and sets the file's owner executable bit.
The correct extension is automatically appended to the filename portion of the path if it is not already present.
To completely conform with the XDG Desktop Entry Specification, the filename of the entry should follow the "reverse DNS" convention, with the primary name portion in CamelCase: