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

KNewStuff

KNS::CoreEngine

KNS::CoreEngine Class Reference

KNewStuff core engine. More...

#include <coreengine.h>

Inheritance diagram for KNS::CoreEngine:

Inheritance graph
[legend]

List of all members.


Public Types

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

Signals

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)
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)
 ~CoreEngine ()

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.

For internal use only.

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

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:
entry Entry to download payload file for
See also:
signalPayloadLoaded

signalPayloadFailed

Definition at line 291 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:
entry Entry to download preview image for
See also:
signalPreviewLoaded

signalPreviewFailed

Definition at line 260 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:
configfile KNewStuff2 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:
payloadfile Path 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 1316 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:
provider Provider from where to load the entries
See also:
signalEntryLoaded

signalEntryChanged

signalEntriesFailed

signalEntriesFinished

signalEntriesFeedFinished

Reimplemented in KNS::DxsEngine.

Definition at line 222 of file coreengine.cpp.

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

Definition at line 1019 of file coreengine.cpp.

void CoreEngine::setAutomationPolicy ( AutomationPolicy  policy  ) 

Definition at line 1618 of file coreengine.cpp.

void CoreEngine::setCachePolicy ( CachePolicy  policy  ) 

Definition at line 1623 of file coreengine.cpp.

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 186 of file coreengine.cpp.

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

Uninstalls an entry.

It reverses the steps which were performed during the installation.

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

Definition at line 1554 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:
provider Provider to use for upload
entry Entry to upload with associated files
Returns:
Whether or not upload was started successfully
See also:
signalEntryUploaded

signalEntryFailed

Definition at line 331 of file coreengine.cpp.


The documentation for this class was generated from the following files:
  • coreengine.h
  • coreengine.cpp

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal