Bug 425275 - Come up with a better way of marking actions as hidden
Summary: Come up with a better way of marking actions as hidden
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: Flatpak Backend (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-12 22:53 UTC by Nate Graham
Modified: 2020-12-01 19:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2020-08-12 22:53:42 UTC
libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp:311

    for(const QVariant& act: theActions) {
        QAction* action = qobject_cast<QAction*>(act.value<QObject*>());
        if (action->toolTip() == id) {
            action->setEnabled(false);
            action->setVisible(false);
        }
    }



Comparing the id to the tooltip text (which then has to be untranslated) is of a hacky way of making the action not show up. It's abusing the tooltip text and there's also no code comment to explain this.

Let's come up with a better way of hiding actions that's ideally self-documenting and opens the door to being able to set user-friendly tooltips that are translated.
Comment 1 Aleix Pol 2020-12-01 19:39:34 UTC
Git commit a6d227780189e33d9d96b1d9f0423ec99e9570a2 by Aleix Pol.
Committed on 01/12/2020 at 19:38.
Pushed by apol into branch 'master'.

flatpak: Improve tooltip in the "Add Flathub" button

M  +3    -2    libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp

https://invent.kde.org/plasma/discover/commit/a6d227780189e33d9d96b1d9f0423ec99e9570a2