https://bugs.kde.org/show_bug.cgi?id=511746

Lito Parra <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected],
                   |                            |[email protected]

--- Comment #3 from Lito Parra <[email protected]> ---
I've digged a bit through the desktop files code and the name resolution seems
to boil down to this:

frameworks/KConfig > src/core/kdesktopfile.cpp

QString KDesktopFile::readName() const
{
    Q_D(const KDesktopFile);
    return d->desktopGroup.readEntry("Name", QString());
}

> src/core/kconfiggroup.cpp

QString KConfigGroup::readEntry(const char *key, const QString &aDefault) const
{
    Q_ASSERT_X(isValid(), "KConfigGroup::readEntry", "accessing an invalid
group");

    bool expand = false;

    // read value from the entry map
    QString aValue = config()->d_func()->lookupData(d->fullName(), key,
KEntryMap::SearchLocalized, &expand);
    if (aValue.isNull()) {
        aValue = aDefault;
    }

    if (expand) {
        return KConfigPrivate::expandString(aValue);
    }

    return aValue;
}

> src/core/kdesktopfile.cpp

QString KConfigPrivate::lookupData(const QString &group, QAnyStringView key,
KEntryMap::SearchFlags flags, bool *expand) const
{
    if (bReadDefaults) {
        flags |= KEntryMap::SearchDefaults;
    }
    return entryMap.getEntry(group, key, QString(), flags, expand);
}

And this note on kconfig.h:

> src/core/kconfig.h

/**
    [...]
     * Returns a map of entries in the group specified, indexed by key.
     *         The returned map may be empty if the group is empty, or not
found.
     */
    QMap<QString, QString> entryMap(const QString &aGroup = QString()) const;


---

My initial suspicion is that, for folders other than the default ~/Desktop, the
"Desktop Entry" group as defined by:

 > src/core/kdesktopfile.cpp

class KDesktopFilePrivate : public KConfigPrivate
{
public:
    KDesktopFilePrivate(QStandardPaths::StandardLocation resourceType, const
QString &fileName)
        : KConfigPrivate(KConfig::SimpleConfig, resourceType)
    {
        changeFileName(fileName);

        // make sure the [Desktop Entry] group is always the first one, as
required by the spec
        mBackend.setPrimaryGroup(QStringLiteral("Desktop Entry"));
    }
    KConfigGroup desktopGroup;
};

doesn't exist.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to