diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -77,6 +77,47 @@ If neither of these options are powerful enough for your needs, you can access the functionality directly through the classes in the KNSCore namespace. -Related information such as creation of *.knsrc files can be found on -techbase in the [Get Hot New Stuff +Related information can be found on techbase in the [Get Hot New Stuff tutorials](https://techbase.kde.org/Development/Tutorials#Get_Hot_New_Stuff). + +## Creating knsrc Files + +KNewStuff's engine is configured by a .knsrc file containing the KHotNewStuff configuration. +The following is not an exhaustive list of options, as there are many tweaks which can +be found in the KNSCore::Engine documentation (such as installation and adoption commands, and +tag filters). + +Your application should install a file called: `$KDEDIR/share/config/appname.knsrc` +The file could look like this for wallpapers: + + [KNewStuff3] + Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200 + StandardResource=wallpaper + Uncompress=archive + +Uncompress can be one of: always, never, archive, or subdir: + +* *always* - assume all downloaded files are archives and need to be extracted +* *never* - never try to extract the file +* *archive* - if the file is an archive, uncompress it, otherwise just pass it on +* *subdir* - logic as archive, but decompress into a subdirectory named after the payload filename + +You have different options to set the target install directory: + +* *StandardResource* - not available in KF5, use XdgTargetDir instead. +* *TargetDir* - since KF5, this is equivalent to XdgTargetDir. +* *XdgTargetDir* - a directory in the $XDG_DATA_HOME directory such as `.local/share/wallpapers`. + This is what `QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + name` will return. + +If you expect to be using a service other than the KDE Store (such as for example if you wish to use +a static XML feed), you will also need to specify a ProvidersUrl entry. As an example, the one implied +when using the KDE Store is: + + ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml + +However, again, this should only be done in the case you do not want to use the KDE Store. + +*Note* - If you are targeting old versions of the KNewStuff and Attica frameworks, prior to +version 5.67 and expect to be able to run on systems without Plasma Desktop installed, you +should set a ProvidersUrl, since the code responsible for providing this default did not +exist before then outside of the attica-kde plugin. diff --git a/src/core/cache.cpp b/src/core/cache.cpp --- a/src/core/cache.cpp +++ b/src/core/cache.cpp @@ -156,6 +156,9 @@ e.setEntryXML(stuff); e.setSource(EntryInternal::Cache); + // For any future watchers - this is a legacy area, and while this seems like it would want + // to be either changed or have autoconfig added in the check, that did not exist during the + // period the files this function operates on existed, so let's leave that out. if (e.payload().startsWith(QLatin1String("http://download.kde.org/khotnewstuff"))) { // This is 99% sure a opendesktop file, make it a real one. e.setProviderId(QStringLiteral("https://api.opendesktop.org/v1/")); diff --git a/src/core/engine.h b/src/core/engine.h --- a/src/core/engine.h +++ b/src/core/engine.h @@ -87,7 +87,7 @@ * on an external configuration file, which determines all the details * about the initialization. * - * @param configfile KNewStuff2 configuration file (*.knsrc) + * @param configfile KNewStuff3 configuration file (*.knsrc) * @return \b true if any valid configuration was found, \b false otherwise */ bool init(const QString &configfile); diff --git a/src/downloaddialog.h b/src/downloaddialog.h --- a/src/downloaddialog.h +++ b/src/downloaddialog.h @@ -44,34 +44,6 @@ * for installation, updates and removal. * Preview images as well as other meta information can be seen. * - * \section knsrc knsrc Files - * The Dialog is configured by a .knsrc file containing the KHotNewStuff configuration. - * Your application should install a file into the XDG configuration location called: /etc/xdg/appname.knsrc - * - * The file could look like this for wallpapers: - *
-   [KNewStuff3]
-   ProvidersUrl=https://download.kde.org/ocs/providers.xml
-   Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200
-   XdgTargetDir=wallpapers
-   Uncompress=archive
- * 
- * - * Uncompress can be one of: always, never or archive: - *
    - *
  1. always: assume all downloaded files are archives and need to be extracted
  2. - *
  3. never: never try to extract the file
  4. - *
  5. archive: if the file is an archive, uncompress it, otherwise just pass it on
  6. - *
  7. subdir: logic as archive, but decompress into a subdirectory named after the payload filename
  8. - *
- * - * You have different options to set the target install directory: - *
  1. StandardResource: not available in KF5, use XdgTargetDir instead.
  2. - *
  3. TargetDir: since KF5, this is equivalent to XdgTargetDir. - *
  4. XdgTargetDir: a directory in the $XDG_DATA_HOME directory such as .local/share/wallpapers. - * This is what QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + name will return.
  5. - *
- * * @since 4.4 */ class KNEWSTUFF_EXPORT DownloadDialog : public QDialog diff --git a/src/downloadwidget.h b/src/downloadwidget.h --- a/src/downloadwidget.h +++ b/src/downloadwidget.h @@ -44,34 +44,6 @@ * for installation, updates and removal. * Preview images as well as other meta information can be seen. * - * \section knsrc knsrc Files - * The Dialog is configured by a .knsrc file containing the KHotNewStuff configuration. - * Your application should install a file called: $KDEDIR/share/config/appname.knsrc - * - * The file could look like this for wallpapers: - *
-   [KNewStuff3]
-   ProvidersUrl=https://download.kde.org/ocs/providers.xml
-   Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200
-   StandardResource=wallpaper
-   Uncompress=archive
- * 
- * - * Uncompress can be one of: always, never or archive: - *
    - *
  1. always: assume all downloaded files are archives and need to be extracted
  2. - *
  3. never: never try to extract the file
  4. - *
  5. archive: if the file is an archive, uncompress it, otherwise just pass it on
  6. - *
  7. subdir: logic as archive, but decompress into a subdirectory named after the payload filename
  8. - *
- * - * You have different options to set the target install directory: - *
  1. StandardResource: not available in KF5, use XdgTargetDir instead.
  2. - *
  3. TargetDir: since KF5, this is equivalent to XdgTargetDir. - *
  4. XdgTargetDir: a directory in the $XDG_DATA_HOME directory such as .local/share/wallpapers. - * This is what QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + name will return.
  5. - *
- * * @since 4.5 */ class KNEWSTUFF_EXPORT DownloadWidget : public QWidget diff --git a/tests/khotnewstuff.knsrc b/tests/khotnewstuff.knsrc --- a/tests/khotnewstuff.knsrc +++ b/tests/khotnewstuff.knsrc @@ -1,5 +1,5 @@ [KNewStuff3] -ProvidersUrl=http://download.kde.org/ocs/providers.xml +ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200 TargetDir=testdirectory diff --git a/tests/khotnewstuff_upload.knsrc b/tests/khotnewstuff_upload.knsrc --- a/tests/khotnewstuff_upload.knsrc +++ b/tests/khotnewstuff_upload.knsrc @@ -1,4 +1,4 @@ [KNewStuff3] -ProvidersUrl=http://download.kde.org/ocs/providers.xml +ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml UploadCategories=KDE Wallpaper 800x600