• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • KNS
  • CoreEngine
Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
KNS::CoreEngine Class Reference

#include <coreengine.h>

Inheritance diagram for KNS::CoreEngine:
Inheritance graph
[legend]

Public Types

enum  AutomationPolicy { AutomationOn, AutomationOff }
 
enum  CachePolicy { CacheNever, CacheReplaceable, CacheResident, CacheOnly }
 

Signals

void signalDownloadDialogDone (KNS::Entry::List)
 
void signalEntriesFailed ()
 
void signalEntriesFeedFinished (const KNS::Feed *feed)
 
void signalEntriesFinished ()
 
void signalEntryChanged (KNS::Entry *entry)
 
void signalEntryFailed ()
 
void signalEntryLoaded (KNS::Entry *entry, const KNS::Feed *feed, const KNS::Provider *provider)
 
void signalEntryRemoved (KNS::Entry *entry, const KNS::Feed *feed)
 
void signalEntryUploaded ()
 
void signalInstallationFailed ()
 
void signalInstallationFinished ()
 
void signalPayloadFailed (KNS::Entry *entry)
 
void signalPayloadLoaded (KUrl payload)
 
void signalPreviewFailed ()
 
void signalPreviewLoaded (KUrl preview)
 
void signalProgress (const QString &message, int percentage)
 
void signalProviderChanged (KNS::Provider *provider)
 
void signalProviderLoaded (KNS::Provider *provider)
 
void signalProvidersFailed ()
 
void signalProvidersFinished ()
 

Public Member Functions

 CoreEngine (QObject *parent)
 
 ~CoreEngine ()
 
QString componentName () const
 
void downloadPayload (Entry *entry)
 
void downloadPreview (Entry *entry)
 
bool init (const QString &configfile)
 
bool install (const QString &payloadfile)
 
void loadEntries (Provider *provider)
 
void setAutomationPolicy (AutomationPolicy policy)
 
void setCachePolicy (CachePolicy policy)
 
void start ()
 
bool uninstall (KNS::Entry *entry)
 
bool uploadEntry (Provider *provider, Entry *entry)
 

Protected Member Functions

void mergeEntries (Entry::List entries, Feed *feed, const Provider *provider)
 

Detailed Description

KNewStuff core engine.

A core engine keeps track of data which is available locally and remote and offers high-level synchronization calls as well as upload and download primitives using an underlying GHNS protocol.

Definition at line 47 of file coreengine.h.

Member Enumeration Documentation

enum KNS::CoreEngine::AutomationPolicy

Engine automation can be activated to let the engine take care by itself of all the method calls needed in a workflow.

For example, the download workflow will require entries to be loaded after the providers, and preview images for all entries afterwards.

Calling the methods for those load operations is necessary when automation is off, but it is redundant (and in fact considered an error) when automation is switched on.

The default automation policy is AutomationOff.

Enumerator
AutomationOn 

Turn on automation, and take care of method calls.

Turn off automation, and let the application call the methods. (default)

AutomationOff 

Definition at line 98 of file coreengine.h.

enum KNS::CoreEngine::CachePolicy

Policy on how to cache the data received from the network.

While CacheNever completely switches off all caching, the other two settings CacheReplaceable and CacheResident will optimize the network traffic needed for all workflows. CacheOnly will never download from the network at all and can be used to inspect the local cache.

Provider files, feeds, entries and preview images are subject to this policy.

The default cache policy is CacheNever.

Enumerator
CacheNever 

Do not use any cache.

(default) Use the cache first, but then update from the network.

CacheReplaceable 

Like CacheReplaceable, but only update if necessary.

CacheResident 

Operate on cache files but never update them.

CacheOnly 

Definition at line 75 of file coreengine.h.

Constructor & Destructor Documentation

CoreEngine::CoreEngine ( QObject *  parent)

Constructor.

Definition at line 57 of file coreengine.cpp.

CoreEngine::~CoreEngine ( )

Destructor.

Frees up all the memory again which might be taken by cached entries and providers.

Definition at line 63 of file coreengine.cpp.

Member Function Documentation

QString CoreEngine::componentName ( ) const
Returns
the component name the engine is using, or an empty string if not initialized yet

Definition at line 186 of file coreengine.cpp.

void CoreEngine::downloadPayload ( Entry *  entry)

Downloads a payload file.

The payload file matching most closely the current user language preferences will be downloaded. The file will not be installed set, for this install must be called.

Parameters
entryEntry to download payload file for
See also
signalPayloadLoaded
signalPayloadFailed

Definition at line 300 of file coreengine.cpp.

void CoreEngine::downloadPreview ( Entry *  entry)

Downloads a preview file.

The preview file matching most closely the current user language preferences will be downloaded.

This method should not be called if automation is activated.

Parameters
entryEntry to download preview image for
See also
signalPreviewLoaded
signalPreviewFailed

Definition at line 269 of file coreengine.cpp.

bool CoreEngine::init ( const QString &  configfile)

Initializes the engine.

This step is application-specific and relies on an external configuration file, which determines all the details about the initialization.

Parameters
configfileKNewStuff2 configuration file (*.knsrc)
Returns
true if any valid configuration was found, false otherwise

Definition at line 68 of file coreengine.cpp.

bool CoreEngine::install ( const QString &  payloadfile)

Installs an entry's payload file.

This includes verification, if necessary, as well as decompression and other steps according to the application's *.knsrc file. Note that this method is asynchronous and thus the return value will only report the successful start of the installation.

Parameters
payloadfilePath to file to install
Returns
Whether or not installation was started successfully
See also
signalInstallationFinished
signalInstallationFailed
Note
FIXME: use Entry as parameter
Todo:
when using KIO::get the http header can be accessed and it contains a real file name.

Definition at line 1333 of file coreengine.cpp.

void CoreEngine::loadEntries ( Provider *  provider)

Loads all entries of all the feeds from a provider.

This means that meta information about those entries is retrieved from the cache and/or from the network, depending on the cache policy.

This method should not be called if automation is activated.

Parameters
providerProvider from where to load the entries
See also
signalEntryLoaded
signalEntryChanged
signalEntriesFailed
signalEntriesFinished
signalEntriesFeedFinished

Definition at line 231 of file coreengine.cpp.

void CoreEngine::mergeEntries ( Entry::List  entries,
Feed *  feed,
const Provider *  provider 
)
protected

Definition at line 1036 of file coreengine.cpp.

void CoreEngine::setAutomationPolicy ( AutomationPolicy  policy)

Definition at line 1640 of file coreengine.cpp.

void CoreEngine::setCachePolicy ( CachePolicy  policy)

Definition at line 1645 of file coreengine.cpp.

void KNS::CoreEngine::signalDownloadDialogDone ( KNS::Entry::List  )
signal
void KNS::CoreEngine::signalEntriesFailed ( )
signal
void KNS::CoreEngine::signalEntriesFeedFinished ( const KNS::Feed *  feed)
signal
void KNS::CoreEngine::signalEntriesFinished ( )
signal
void KNS::CoreEngine::signalEntryChanged ( KNS::Entry *  entry)
signal
void KNS::CoreEngine::signalEntryFailed ( )
signal
void KNS::CoreEngine::signalEntryLoaded ( KNS::Entry *  entry,
const KNS::Feed *  feed,
const KNS::Provider *  provider 
)
signal
void KNS::CoreEngine::signalEntryRemoved ( KNS::Entry *  entry,
const KNS::Feed *  feed 
)
signal
void KNS::CoreEngine::signalEntryUploaded ( )
signal
void KNS::CoreEngine::signalInstallationFailed ( )
signal
void KNS::CoreEngine::signalInstallationFinished ( )
signal
void KNS::CoreEngine::signalPayloadFailed ( KNS::Entry *  entry)
signal
void KNS::CoreEngine::signalPayloadLoaded ( KUrl  payload)
signal
void KNS::CoreEngine::signalPreviewFailed ( )
signal
void KNS::CoreEngine::signalPreviewLoaded ( KUrl  preview)
signal
void KNS::CoreEngine::signalProgress ( const QString &  message,
int  percentage 
)
signal
void KNS::CoreEngine::signalProviderChanged ( KNS::Provider *  provider)
signal
void KNS::CoreEngine::signalProviderLoaded ( KNS::Provider *  provider)
signal

Indicates that the list of providers has been successfully loaded.

This signal might occur twice, for the local cache and for updated provider information from the ProvidersUrl.

void KNS::CoreEngine::signalProvidersFailed ( )
signal
void KNS::CoreEngine::signalProvidersFinished ( )
signal
void CoreEngine::start ( )

Starts the engine.

This method reports all cached and registered providers to the application. Depending on the cache policy, the engine will then try to synchronize the cache by updating all information about the providers.

If engine automation is activated, this method will proceed to synchronize all feeds, entries and preview images. For each provider, all feeds are considered. The synchronization is complete if signalEntriesFinished is emitted, but applications should continue watching signalEntryChanged.

See also
signalProviderLoaded
signalProviderChanged
signalProvidersFailed
signalProvidersFinished
signalEntryLoaded
signalEntryChanged
signalEntriesFailed
signalEntriesFinished
signalEntriesFeedFinished
signalPreviewLoaded
signalPreviewFailed

Definition at line 195 of file coreengine.cpp.

bool CoreEngine::uninstall ( KNS::Entry *  entry)

Uninstalls an entry.

It reverses the steps which were performed during the installation.

Parameters
entryThe entry to deinstall
Returns
Whether or not deinstallation was successful
Note
FIXME: I don't believe this works yet :)

Definition at line 1576 of file coreengine.cpp.

bool CoreEngine::uploadEntry ( Provider *  provider,
Entry *  entry 
)

Uploads a complete entry, including its payload and preview files (if present) and all associated meta information.

Note that this method is asynchronous and thus the return value will not report the final success of all upload steps. It will merely check that the provider supports upload and so forth.

Parameters
providerProvider to use for upload
entryEntry to upload with associated files
Returns
Whether or not upload was started successfully
See also
signalEntryUploaded
signalEntryFailed

Definition at line 340 of file coreengine.cpp.


The documentation for this class was generated from the following files:
  • coreengine.h
  • coreengine.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal