Bug 425275

Summary: Come up with a better way of marking actions as hidden
Product: [Applications] Discover Reporter: Nate Graham <nate>
Component: Flatpak BackendAssignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, jgrulich
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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