# class Engine

###

Module | knewstuff
Namespace | KNS
Class | Engine
Inherits |

The KNewStuff2 engine is the top-level class to handle GHNS and DXS workflows.

An engine implements GHNS workflows, which consist of discrete steps performed by the inherited engine. Depending on the provider, traditional GHNS or DXS are used transparently. This class is the one which applications should use. In most cases, either upload() or download() will be called by the application to upload or download data.

### methods

- Engine (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  Engine constructor.

  As many engines as needed can be instantiated, although one should use the static methods download() and upload() instead.

- Engine (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KNS.Engine |

- download ( )

  returns KNS::Entry.List
  static

  Recommended download workflow entry point.

  This method is a static convenience wrapper around downloadDialogModal() which does not require the manual construction of an engine object. The engine will be configured to load appname.knsrc. The resulting entry list must not be freed, as the engine will continue to keep track of it.

  Returns List of installed or deinstalled entries NOTE: this is a copy of each entry because this call deletes its own engine which deletes the original entries, so you need to delete the entries returned in the list

  See also downloadDialogModal()

- downloadDialog ( )

  returns Nothing

  Asynchronous way of starting the download workflow.

  This method should be used whenever a blocking application with a non-blocking GUI during GHNS operations is not suitable. Affected entries will be reported by signals.

  See also downloadDialogModal()

- downloadDialogModal (parent)

  returns KNS::Entry.List

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  Synchronous way of starting the download workflow.

  Starts the download workflow. This workflow will turn up a dialog where the user can select entries for installation and uninstallation. This method is a modal one. It will return all affected entries as a list.

  NOTE: this list must be queried to see which ones were installed and which were uninstalled since both are in the one list. i.e. (entry->status() == KNS.Entry.Installed)

  Returns List of installed or deinstalled entries

- init (config)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  config | QString |

- upload (file)

  returns KNS.Entry
  static

  Argument | Type | Default
  --- | --- | ---
  file | QString |

  Recommended upload workflow entry point.

  This method is a static convenience wrapper around uploadDialogModal() which does not require the manual construction of an engine object. The engine will be configured to load appname.knsrc. The resulting entry must not be freed, as the engine will continue to keep track of it.

  Returns Uploaded entry, or null in case of failures

  See also uploadDialogModal()

- uploadDialog (file)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  file | QString |

  Asynchronous way of starting the upload workflow.

  This method should be used whenever a blocking application with a non-blocking GUI during GHNS operations is not suitable. The affected entry will be reported by signals.

  See also uploadDialogModal()

- uploadDialogModal (file)

  returns KNS.Entry

  Argument | Type | Default
  --- | --- | ---
  file | QString |

  Synchronous way of starting the upload workflow.

  Starts the upload workflow. This workflow will offer provider selection and afterwards upload all files associated with an entry. This method is a modal one. It will return the uploaded entry.

  Returns Uploaded entry, or null in case of failures