| Home · All Classes · Main Classes · Deprecated |

Public Member Functions | |
| MDesktopEntry (const QString &fileName) | |
| virtual | ~MDesktopEntry () |
| QString | fileName () const |
| virtual bool | isValid () const |
| virtual uint | hash () const |
| QString | type () const |
| QString | version () const |
| QString | name () const |
| QString | nameUnlocalized () const |
| QString | genericName () const |
| bool | noDisplay () const |
| QString | comment () const |
| QString | icon () const |
| bool | hidden () const |
| QStringList | onlyShowIn () const |
| QStringList | notShowIn () const |
| QString | tryExec () const |
| QString | exec () const |
| QString | path () const |
| bool | terminal () const |
| QStringList | mimeType () const |
| QStringList | categories () const |
| bool | startupNotify () const |
| QString | startupWMClass () const |
| QString | url () const |
| QString | xMaemoService () const |
| QString | value (const QString &key) const |
| QString | value (const QString &group, const QString &key) const |
| bool | contains (const QString &key) const |
| bool | contains (const QString &group, const QString &key) const |
MDesktopEntry provides the means to read freedesktop.org desktop entry files.
MDesktopEntry object reads desktop file data from the desktop file given as a construction parameter.
The isValid() method determines whether the input desktop file conforms to the standard defined by freedesktop.org.
For more information see: http://standards.freedesktop.org/desktop-entry-spec/latest/index.html
Definition at line 43 of file corelib/core/mdesktopentry.h.
| MDesktopEntry::MDesktopEntry | ( | const QString & | fileName | ) |
Reads input desktop file and constructs new MDesktopEntry object of it.
| fileName | the name of the file to read the desktop entry from |
Definition at line 175 of file mdesktopentry.cpp.
:
d_ptr(new MDesktopEntryPrivate(fileName))
{
}
| MDesktopEntry::~MDesktopEntry | ( | ) | [virtual] |
| QStringList MDesktopEntry::categories | ( | ) | const |
Returns the value of Categories key or an empty string list if it is not defined in the input desktop entry file.
Definition at line 366 of file mdesktopentry.cpp.
{
return d_ptr->stringListValue(CategoriesKey);
}
| QString MDesktopEntry::comment | ( | ) | const |
Returns the value of Comment key or an empty string if it is not defined in the input desktop entry file.
Definition at line 311 of file mdesktopentry.cpp.
{
return value(CommentKey);
}

| bool MDesktopEntry::contains | ( | const QString & | key | ) | const |
Indicates whether map contains key or not. Returns false if key is not present.
Definition at line 195 of file mdesktopentry.cpp.
{
return d_ptr->desktopEntriesMap.contains(key);
}
Indicates whether map contains group/key or not. Returns false if key is not present.
Definition at line 200 of file mdesktopentry.cpp.
{
return d_ptr->desktopEntriesMap.contains(group + '/' + key);
}
| QString MDesktopEntry::exec | ( | ) | const |
Returns the value of Exec key or an empty string if it is not defined in the input desktop entry file.
Definition at line 341 of file mdesktopentry.cpp.

| QString MDesktopEntry::fileName | ( | ) | const |
Returns the name of the file where the information for this desktop entry was read from.
Definition at line 190 of file mdesktopentry.cpp.
{
return d_ptr->sourceFileName;
}
| QString MDesktopEntry::genericName | ( | ) | const |
Returns the value of GenericName key or an empty string if it is not defined in the input desktop entry file.
Definition at line 301 of file mdesktopentry.cpp.
{
return value(GenericNameKey);
}

| uint MDesktopEntry::hash | ( | ) | const [virtual] |
Calculates a hash value based on the required type and name keys of the desktop definition.
Definition at line 246 of file mdesktopentry.cpp.

| bool MDesktopEntry::hidden | ( | ) | const |
Indicates whether value of Hidden key is true or false. Returns false if Hidden key is undefined.
Definition at line 321 of file mdesktopentry.cpp.
{
return d_ptr->boolValue(HiddenKey);
}
| QString MDesktopEntry::icon | ( | ) | const |
Returns the value of Icon key or an empty string if it is not defined in the input desktop entry file.
Definition at line 316 of file mdesktopentry.cpp.

| bool MDesktopEntry::isValid | ( | ) | const [virtual] |
Indicates whether desktop entry information adheres to the requirements set in the freedesktop.org standard. Freedesktop.org defines required keys that one has to fill to have a valid desktop file. This checks whether those keys are defined.
Reimplemented in MApplicationExtensionMetaData, and MAppletMetaData.
Definition at line 215 of file mdesktopentry.cpp.
{
// The Type and Name keys always have to be present
if (!contains(TypeKey)) {
return false;
}
if (!contains(NameKey)) {
return false;
}
// In case of an application the Exec key needs to be present
if (type() == "Application" && !contains(ExecKey)) {
return false;
}
// In case of a link the URL key needs to be present
if (type() == "Link" && !contains(URLKey)) {
return false;
}
// In case the desktop entry is invalid for some explicit reason
// Some cases are:
// 1. Group name defined multiple times
// 2. Desktop entry's first group should be "Desktop Entry"
if (!d_ptr->valid) {
return false;
}
return true;
}

| QStringList MDesktopEntry::mimeType | ( | ) | const |
Returns the value of MimeTypes key or an empty string list if it is not defined in the input desktop entry file.
Definition at line 361 of file mdesktopentry.cpp.
{
return d_ptr->stringListValue(MimeTypeKey);
}
| QString MDesktopEntry::name | ( | ) | const |
Returns the localized value of Name key or an empty string if it is not defined in the input desktop entry file. The localization requires either a X-MeeGo-Logical-Id attribute with optional X-MeeGo-Translation-Catalog attribute or freedesktop.org standard style localized name attribute. Returns the name as unlocalized if the logical id cannot be found from the catalog.
Definition at line 261 of file mdesktopentry.cpp.
{
QString name = value(NameKey);
if (contains(LogicalIdKey)) {
// Get the name from the translation catalog;
// if it does not exist use the unlocalized name prefixed
// by the engineering English marker "!! ":
QString translation = qtTrId(value(LogicalIdKey).toAscii().data());
if (translation == value(LogicalIdKey))
name = "!! " + name;
else
name = translation;
} else {
MLocale locale;
QString lang(locale.language());
QString country(locale.country());
QString variant(locale.variant());
QString postfixKey;
if (contains(postfixKey = NameKey + '[' + lang + '_' +
country + '@' +
variant + ']') ||
contains(postfixKey = NameKey + '[' + lang + '_' +
country + ']') ||
contains(postfixKey = NameKey + '[' + lang + '@' +
variant + ']') ||
contains(postfixKey = NameKey + '[' + lang + ']')) {
// Use the freedesktop.org standard localization style
name = value(postfixKey);
}
}
return name;
}

| QString MDesktopEntry::nameUnlocalized | ( | ) | const |
Returns the unlocalized value of Name key or an empty string if it is not defined in the input desktop entry file.
Definition at line 296 of file mdesktopentry.cpp.

| bool MDesktopEntry::noDisplay | ( | ) | const |
Indicates whether value of NoDisplay key is true or false. Returns false if NoDisplay key is undefined.
Definition at line 306 of file mdesktopentry.cpp.
{
return d_ptr->boolValue(NoDisplayKey);
}
| QStringList MDesktopEntry::notShowIn | ( | ) | const |
Returns the value of NotShowIn key or an empty string list if it is not defined in the input desktop entry file.
Definition at line 331 of file mdesktopentry.cpp.
{
return d_ptr->stringListValue(NotShowInKey);
}
| QStringList MDesktopEntry::onlyShowIn | ( | ) | const |
Returns the value of OnlyShowIn key or an empty string list if it is not defined in the input desktop entry file.
Definition at line 326 of file mdesktopentry.cpp.
{
return d_ptr->stringListValue(OnlyShowInKey);
}
| QString MDesktopEntry::path | ( | ) | const |
Returns the value of Path key or an empty string if it is not defined in the input desktop entry file.
Definition at line 351 of file mdesktopentry.cpp.

| bool MDesktopEntry::startupNotify | ( | ) | const |
Indicates whether value of StartupNotify key is true or false. Returns false if StartupNotify key is undefined.
Definition at line 371 of file mdesktopentry.cpp.
{
return d_ptr->boolValue(StartupNotifyKey);
}
| QString MDesktopEntry::startupWMClass | ( | ) | const |
Returns the value of StartupWMClass key or an empty string if it is not defined in the input desktop entry file.
Definition at line 376 of file mdesktopentry.cpp.
{
return value(StartupWMClassKey);
}

| bool MDesktopEntry::terminal | ( | ) | const |
Indicates whether value of Terminal key is true or false. Returns false if Terminal key is undefined.
Definition at line 356 of file mdesktopentry.cpp.
{
return d_ptr->boolValue(TerminalKey);
}
| QString MDesktopEntry::tryExec | ( | ) | const |
Returns the value of TryExec key or an empty string if it is not defined in the input desktop entry file.
Definition at line 336 of file mdesktopentry.cpp.
{
return value(TryExecKey);
}

| QString MDesktopEntry::type | ( | ) | const |
Returns the value of Type key or an empty string if it is not defined in the input desktop entry file.
Definition at line 251 of file mdesktopentry.cpp.

| QString MDesktopEntry::url | ( | ) | const |
Returns the value of URL key or an empty string if it is not defined in the input desktop entry file.
Definition at line 381 of file mdesktopentry.cpp.

Returns the value of the group-key stored as "group/key" key or an empty string if it is not defined in the input desktop entry file.
Definition at line 210 of file mdesktopentry.cpp.
{
return d_ptr->desktopEntriesMap.value(group + '/' + key);
}
Returns the value of the key- key or an empty string if it is not defined in the input desktop entry file.
Definition at line 205 of file mdesktopentry.cpp.
{
return d_ptr->desktopEntriesMap.value(key);
}
| QString MDesktopEntry::version | ( | ) | const |
Returns the value of Version key or an empty string if it is not defined in the input desktop entry file.
Definition at line 256 of file mdesktopentry.cpp.
{
return value(VersionKey);
}

| QString MDesktopEntry::xMaemoService | ( | ) | const |
Returns the value of X-Osso-Service key or an empty string if it is not defined in the input desktop entry file.
Definition at line 346 of file mdesktopentry.cpp.
{
return value(XMaemoServiceKey);
}

| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:24 (PDT) Doxygen 1.7.1 |
MeeGo Touch |