Bug 385429 - Ability to sepecify kns:/providerHost/productId/linkId in order to download the 2nd or 3rd zip for a lookandfeel
Summary: Ability to sepecify kns:/providerHost/productId/linkId in order to download t...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-frameworkintegration
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-06 06:07 UTC by Chris Holland
Modified: 2017-11-09 19:14 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Holland 2017-10-06 06:07:08 UTC
LookAndFeels introduced the ability to set dependencies, that are downloaded first before installing the look and feel package.
https://userbase.kde.org/Plasma/Create_a_Look_and_Feel_Package

Eg: X-KPackage-Dependencies=kns://plasmoids.knsrc/api.kde-look.org/1160672

It will call:
/usr/lib/x86_64-linux-gnu/libexec/kf5/kpackagehandlers/knshandler kns://colorschemes.knsrc/api.kde-look.org/1001720

Which has it's source code here:
https://github.com/KDE/frameworkintegration/blob/master/src/kpackage-install-handlers/kns/main.cpp

In the file, it calls engine.install(entry);
the second argument (linkId) isn't supplied so it defaults to 1.

void install(KNSCore::EntryInternal entry, int linkId = 1);

This means it downloads the first link, which for me is the oldest version of the widget typically.

https://api.kde-look.org/ocs/v1/content/download/1160672/1
tells it to download tiledmenu-v05-kde5.5.plasmoid

while
https://api.kde-look.org/ocs/v1/content/download/1160672/3
tells it to download the latest version tiledmenu-v18-kde5.9.plasmoid

So back in the kpackage-install-handlers/kns/main.cpp, I'd like to request it to either accept

kns://plasmoids.knsrc/api.kde-look.org/1160672
kns://plasmoids.knsrc/api.kde-look.org/1160672/3

So something like:

-if (pathParts.size() != 2) {
+if (pathParts.size() < 2) {


+auto linkId = 1;
+if (pathParts.size() >= 3) {
+linkId = pathParts.at(0) converted to int


-...[providerid, &engine, &installedCount]...
+...[providerid, linkId, &engine, &installedCount]...


-engine.install(entry);
+engine.install(entry, linkId);
Comment 1 Chris Holland 2017-11-07 02:12:44 UTC
Git commit 35656828f12c72f7943a27ec59dab7332335f1a0 by Chris Holland.
Committed on 07/11/2017 at 01:35.
Pushed by cholland into branch 'master'.

Support downloading the 2nd or 3rd download link from a KNS product

This lets LookAndFeel packages depend on specific versions of a KNS product.
This patch adds the ability to specify which link to download with the ?linkid=3 query parameter.
Eg: kns://plasmoids.knsrc/api.kde-look.org/1160672?linkid=3

Testing:
alias knshandler='/usr/lib/x86_64-linux-gnu/libexec/kf5/kpackagehandlers/knshandler'

Works:
knshandler kns://plasmoids.knsrc/api.kde-look.org/1160672
knshandler kns://plasmoids.knsrc/api.kde-look.org/1160672?linkid=3

Errors:
knshandler kns://plasmoids.knsrc/api.kde-look.org/1160672?linkid=test

Installs first download link (since it wasn't specified):
knshandler kns://plasmoids.knsrc/api.kde-look.org/1160672?rawr=blarg

Differential Revision: https://phabricator.kde.org/D8636

M  +15   -2    src/kpackage-install-handlers/kns/main.cpp

https://commits.kde.org/frameworkintegration/35656828f12c72f7943a27ec59dab7332335f1a0