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

Nepomuk-Core

  • Nepomuk2
  • ResourceWatcher
Public Slots | Signals | Public Member Functions | List of all members
Nepomuk2::ResourceWatcher Class Reference
Nepomuk Data Management

#include <resourcewatcher.h>

Inheritance diagram for Nepomuk2::ResourceWatcher:
Inheritance graph
[legend]

Public Slots

void addProperty (const Types::Property &property)
 
void addResource (const Nepomuk2::Resource &res)
 
void addResource (const QUrl &resUri)
 
void addType (const Types::Class &type)
 
QList< Types::Property > properties () const
 
int propertyCount () const
 
void removeProperty (const Types::Property &property)
 
void removeResource (const Nepomuk2::Resource &res)
 
void removeResource (const QUrl &resUri)
 
void removeType (const Types::Class &type)
 
int resourceCount () const
 
QList< Nepomuk2::Resource > resources () const
 
void setProperties (const QList< Types::Property > &properties_)
 
void setResources (const QList< Nepomuk2::Resource > &resources_)
 
void setTypes (const QList< Types::Class > &types_)
 
bool start ()
 
void stop ()
 
int typeCount () const
 
QList< Types::Class > types () const
 

Signals

void propertyAdded (const Nepomuk2::Resource &resource, const Nepomuk2::Types::Property &property, const QVariant &value)
 
void propertyChanged (const Nepomuk2::Resource &resource, const Nepomuk2::Types::Property &property, const QVariantList &addedValues, const QVariantList &removedValues)
 
void propertyRemoved (const Nepomuk2::Resource &resource, const Nepomuk2::Types::Property &property, const QVariant &value)
 
void resourceCreated (const Nepomuk2::Resource &resource, const QList< QUrl > &types)
 
void resourceRemoved (const QUrl &uri, const QList< QUrl > &types)
 
void resourceTypeAdded (const Nepomuk2::Resource &res, const Nepomuk2::Types::Class &type)
 
void resourceTypeRemoved (const Nepomuk2::Resource &res, const Nepomuk2::Types::Class &type)
 

Public Member Functions

 ResourceWatcher (QObject *parent=0)
 
virtual ~ResourceWatcher ()
 

Detailed Description

Selectively monitor the nepomuk repository for changes.

Resources may be monitored on the basis of types, properties, and uris.

Changes may be monitored in one of the following ways:

  1. By resources - Specify the exact resources that should be watched. Any changes made to the specified resources (Excluding Resource Metadata) will be notified through the propertyAdded() and propertyRemoved() signals. Notifications will also be sent if any of the watched resources is deleted.
  2. By resources and properties - Specify the exact resources and their properties. Any changes made to the specified resources which touch one of the specified properties will be notified through the propertyAdded() and propertyRemoved() signals.
  3. By types - Specific types may be specified via add/setType. If types are set, then notifications will be sent for all new resources of that type. This includes property changes and resource creation and removal. TODO: add flags that allow to only watch for resource creation and removal.
  4. By types and properties - Both the types and properties may be specified. Notifications will be sent for property changes in resource with the specified types.

Resource Watcher Usage Example

The following code creates a new ResourceWatcher, configures it to listen to changes on the nmm:performer property on one specific resource res.

Nepomuk2::ResourceWatcher* watcher = new Nepomuk2::ResourceWatcher(this);
watcher->addResource(res);
watcher->addProperty(NMM::performer());
connect(watcher, SIGNAL(propertyAdded(Nepomuk2::Resource, Nepomuk2::Types::Property, QVariant)),
this, SLOT(slotPropertyChanged()));
connect(watcher, SIGNAL(propertyRemoved(Nepomuk2::Resource, Nepomuk2::Types::Property, QVariant)),
this, SLOT(slotPropertyChanged()));
rwatcher->start();
Author
Vishesh Handa handa.nosp@m..vis.nosp@m.h@gma.nosp@m.il.c.nosp@m.om, Sebastian Trueg trueg.nosp@m.@kde.nosp@m..org

Definition at line 81 of file resourcewatcher.h.

Constructor & Destructor Documentation

Nepomuk2::ResourceWatcher::ResourceWatcher ( QObject *  parent = 0)

Create a new ResourceWatcher instance.

This instance will not emit any signals before it has been configured and started.

Definition at line 72 of file resourcewatcher.cpp.

Nepomuk2::ResourceWatcher::~ResourceWatcher ( )
virtual

Destructor.

Definition at line 83 of file resourcewatcher.cpp.

Member Function Documentation

void Nepomuk2::ResourceWatcher::addProperty ( const Types::Property &  property)
slot

Add a property to be watched.

Every change to a value of this property will be signalled, depending on the configured resources() or types().

See also
setProperties()

Definition at line 176 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::addResource ( const Nepomuk2::Resource &  res)
slot

Add a resource to be watched.

Every change to this resource will be signalled, depending on the configured properties().

See also
setResources()

Definition at line 184 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::addResource ( const QUrl &  resUri)
slot

Add a resource to be watched.

Every change to this resource will be signalled, depending on the configured properties().

See also
setResources()

Definition at line 189 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::addType ( const Types::Class &  type)
slot

Add a type to be watched.

Every resource of this type will be watched for changes.

See also
setTypes()

Definition at line 198 of file resourcewatcher.cpp.

QList< Nepomuk2::Types::Property > Nepomuk2::ResourceWatcher::properties ( ) const
slot

The properties that have been configured via addProperty() and setProperties().

Every change to a value of any of these properties will be signalled, depending on the configured resources() or types().

Definition at line 235 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::propertyAdded ( const Nepomuk2::Resource &  resource,
const Nepomuk2::Types::Property &  property,
const QVariant &  value 
)
signal

This signal is emitted when a property value is added.

Parameters
resourceThe changed resource.
propertyThe property which has a new value.
valueThe newly added property value.
void Nepomuk2::ResourceWatcher::propertyChanged ( const Nepomuk2::Resource &  resource,
const Nepomuk2::Types::Property &  property,
const QVariantList &  addedValues,
const QVariantList &  removedValues 
)
signal

This signal is emitted when a property value is changed.

This signal is essentially a combination of the propertyAdded and propertyRemoved signals.

Be aware that removing and then adding a property will result in two separate propertyChanged signals. They are never combined.

Specially, since one could theoretically take forever between the removal and the setting of the property.

Parameters
resourceThe changed resource.
propertyThe property which was changed.
addedValuesThe values that have been added.
removedValuesThe values that have been removed.
int Nepomuk2::ResourceWatcher::propertyCount ( ) const
slot

Return the number of properties that are being watched.

This method is slightly faster than called properties().count()

See also
properties addProperty setProperty

Definition at line 259 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::propertyRemoved ( const Nepomuk2::Resource &  resource,
const Nepomuk2::Types::Property &  property,
const QVariant &  value 
)
signal

This signal is emitted when a property value is removed.

Parameters
resourceThe changed resource.
propertyThe property which was changed.
valueThe removed property value.
void Nepomuk2::ResourceWatcher::removeProperty ( const Types::Property &  property)
slot

Remove a property to be watched.

Every change to a value of this property will be signalled, depending on the configured resources() or types().

See also
setProperties()

Definition at line 206 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::removeResource ( const Nepomuk2::Resource &  res)
slot

Remove a resource to be watched.

Every change to this resource will be signalled, depending on the configured properties().

See also
setResources()

Definition at line 214 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::removeResource ( const QUrl &  resUri)
slot

Remove a resource to be watched.

Every change to this resource will be signalled, depending on the configured properties().

See also
setResources()

Definition at line 219 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::removeType ( const Types::Class &  type)
slot

Remove a type to be watched.

Every resource of this type will be watched for changes.

See also
setTypes()

Definition at line 227 of file resourcewatcher.cpp.

int Nepomuk2::ResourceWatcher::resourceCount ( ) const
slot

Return the number of resources that are being watched.

This method is slightly faster than called resources().count()

See also
resources addResource setResources

Definition at line 264 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::resourceCreated ( const Nepomuk2::Resource &  resource,
const QList< QUrl > &  types 
)
signal

This signal is emitted when a new resource is created.

Parameters
resourceThe newly created resource.
typesThe types the new resource has. If types() have been configured this list will always contain one of the configured types.
void Nepomuk2::ResourceWatcher::resourceRemoved ( const QUrl &  uri,
const QList< QUrl > &  types 
)
signal

This signal is emitted when a resource is deleted.

Parameters
uriThe resource URI of the removed resource.
typesThe types the removed resource had. If types() have been configured this list will always contain one of the configured types.
QList< Nepomuk2::Resource > Nepomuk2::ResourceWatcher::resources ( ) const
slot

The resources that have been configured via addResource() and setResources().

Every change to one of these resources will be signalled, depending on the configured properties().

Definition at line 243 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::resourceTypeAdded ( const Nepomuk2::Resource &  res,
const Nepomuk2::Types::Class &  type 
)
signal

This signal is emitted when a type has been added to a resource.

This does not include creation which is signalled via resourceCreated(). It only applies to changes in a resource's types.

Parameters
resThe changed resource.
typeThe newly added type. If types() have been configured it will be one of them.
void Nepomuk2::ResourceWatcher::resourceTypeRemoved ( const Nepomuk2::Resource &  res,
const Nepomuk2::Types::Class &  type 
)
signal

This signal is emitted when a type has been removed from a resource.

This does not include removal of entire resources which is signalled via resourceRemoved(). It only applies to changes in a resource's types.

Parameters
resThe changed resource.
typeThe removed type. If types() have been configured it will be one of them.
void Nepomuk2::ResourceWatcher::setProperties ( const QList< Types::Property > &  properties_)
slot

Set the properties to be watched.

Every change to a value of any of these properties will be signalled, depending on the configured resources() or types().

See also
addProperty()

Definition at line 275 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::setResources ( const QList< Nepomuk2::Resource > &  resources_)
slot

Set the resources to be watched.

Every change to one of these resources will be signalled, depending on the configured properties().

See also
addResource()

Definition at line 287 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::setTypes ( const QList< Types::Class > &  types_)
slot

Set the types to be watched.

Every resource having one of these types will be watched for changes.

See also
addType()

Definition at line 299 of file resourcewatcher.cpp.

bool Nepomuk2::ResourceWatcher::start ( )
slot

Start the signalling of changes.

Before calling this method no signal will be emitted. In combination with stop() this allows to suspend the watching. Calling start() multiple times has no effect.

Definition at line 89 of file resourcewatcher.cpp.

void Nepomuk2::ResourceWatcher::stop ( )
slot

Stop the signalling of changes.

Allows to stop the watcher which has been started via start(). Calling stop() multiple times has no effect.

Definition at line 162 of file resourcewatcher.cpp.

int Nepomuk2::ResourceWatcher::typeCount ( ) const
slot

Return the number of types that are being watched.

This method is slightly faster than called types().count()

See also
types addType setType

Definition at line 269 of file resourcewatcher.cpp.

QList< Nepomuk2::Types::Class > Nepomuk2::ResourceWatcher::types ( ) const
slot

The types that have been configured via addType() and setTypes().

Every resource having one of these types will be watched for changes.

Definition at line 251 of file resourcewatcher.cpp.


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

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • 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