Bug 385429

Summary: Ability to sepecify kns:/providerHost/productId/linkId in order to download the 2nd or 3rd zip for a lookandfeel
Product: [Frameworks and Libraries] frameworks-frameworkintegration Reporter: Chris Holland <zrenfire>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: simonandric5
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

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