D19837: Add support for applications in KNSBackend

Aleix Pol Gonzalez noreply at phabricator.kde.org
Mon Mar 18 10:07:02 GMT 2019


apol added inline comments.

INLINE COMMENTS

> KNSBackend.cpp:151
>  
> -    const auto topLevelName = knsrcPlasma.contains(fileName)? i18n("Plasma Addons") : i18n("Application Addons");
> -    const QUrl decoration(knsrcPlasma.contains(fileName)? QStringLiteral("https://c2.staticflickr.com/4/3148/3042248532_20bd2e38f4_b.jpg") : QStringLiteral("https://c2.staticflickr.com/8/7067/6847903539_d9324dcd19_o.jpg"));
> -    auto addonsCategory = new Category(topLevelName, QStringLiteral("plasma"), filters, backendName, {actualCategory}, decoration, true);
> -    m_rootCategories = { addonsCategory };
> +    if(knsrcApplications.contains(fileName)) {
> +        m_hasApplications = true;

we can just compare with == here, it will be easier to read.

> KNSBackend.cpp:159
> +        QStringList tagFilter = m_engine->tagFilter();
> +        if(QSysInfo::currentCpuArchitecture() == QLatin1String("arm")) {
> +            tagFilter << QLatin1String("application##architecture=armhf");

I wonder if that's alright, it's very ad-hoc to the opendesktop semantics, isn't it?

> KNSBackend.cpp:186
> +        const auto topLevelName = knsrcPlasma.contains(fileName)? i18n("Plasma Addons") : i18n("Application Addons");
> +        const QUrl decoration(knsrcPlasma.contains(fileName)? QStringLiteral("https://c2.staticflickr.com/4/3148/3042248532_20bd2e38f4_b.jpg") : QStringLiteral("https://c2.staticflickr.com/8/7067/6847903539_d9324dcd19_o.jpg"));
> +        auto addonsCategory = new Category(topLevelName, QStringLiteral("plasma"), filters, backendName, {actualCategory}, decoration, true);

decoration isn't used anymore, it could make sense to not include it at all over here.

> KNSBackend.cpp:242
>  {
> +
>      KNSResource* r = static_cast<KNSResource*>(m_resourcesByName.value(entry.uniqueId()));

Unrelated change.

> KNSBackend.cpp:469
> +        for(const QString& category : m_categories) {
> +            if(m_hasApplications || filter.category->matchesCategoryName(category)) {
> +                auto r = new ResultsStream(QStringLiteral("KNS-search-")+name());

Just use contains?

REPOSITORY
  R134 Discover Software Store

REVISION DETAIL
  https://phabricator.kde.org/D19837

To: leinir, apol, ngraham, #discover_software_store
Cc: plasma-devel, #discover_software_store, jraleigh, bam, GB_2, ragreen, ixoos, Pitel, ZrenBot, James, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190318/f793fea7/attachment-0001.html>


More information about the Plasma-devel mailing list